
Smooth a stack with a local-linear-trend Kalman smoother.
kalman_smooth.RdFits a per-pixel local-linear-trend Kalman filter and smoother over
the time axis and returns the smoothed level (and optionally its
standard error). Convenience wrapper: one scan_over() per
requested output, sharing one kalman_llt() parameterisation.
Usage
kalman_smooth(
x,
sigma_lvl,
sigma_slp,
sigma_obs = 1,
obs_var = NULL,
boundaries = NULL,
outputs = c("mean", "sd"),
dtype = "f32",
bands = NULL,
...
)Arguments
- x
Observation stack (
LazyRasterwith ataxis), or aLazyDataset(each band smoothed independently).- sigma_lvl, sigma_slp, sigma_obs
Noise standard deviations (level disturbance, slope disturbance, observation).
- obs_var
Optional relative observation-variance stack on the same grid (
Var(v_t) = sigma_obs^2 * obs_var_t).- boundaries
Optional 0/1 stack on the same grid marking years that start a new regime (see
kalman_llt(), section "Regime boundaries"); needsobs_var(pass a stack of ones for none).- outputs
Which outputs to build (
"mean","sd", the forward-filtered"fmean","fsd", and"innov"; seekalman_llt()).- dtype
Output dtype (default f32).
- bands
LazyDatasetonly: bands to smooth (default: all value bands). A dataset takes noobs_varorboundaries.- ...
Passed to
kalman_llt().
See also
hampel_smooth() for outlier removal, fill_gaps() for
simple gap filling, scan_over() for custom scans.