whittaker

whittaker_smoothing(ds, var, lmbdas=100.0, weights=None, a=0.5, max_iter=10, out_fh=None, xdim='time', max_dist=None, new_x=None, export_all=False, chunks={}, make_plots=None, valid_drange=[-inf, inf], **kwargs)

Apply Whittaker smoothing to a variable in a dataset.

Parameters
  • ds (xr.Dataset) – Dataset containing a variable var which has at least the dimension called xdim.

  • var (str) – Name of the variable in ds to smooth. The variable can have a shape (nt), (nx,ny,nt) or (n,nt) with nt the size of the dimension xdim.

  • lmbdas (int | float | np.array | xr.DataArray, optional) – Lambda value to use for smoothing, shape should be (), (m) or (nx, ny), by default 100.

  • a (float, optional) – Apply quantile smoothing, value can be between 0.01 and 0.99. When 0.5, no iterations (limited by max_iter) are done, by default 0.5

  • max_iter (int, optional) – Maximum number of iterations to perform when applying quantile smoothing, by default 10

  • out_fh (_type_, optional) – Path to store results, when None the output is saved in the same folder as the input, by default None.

  • xdim (str, optional) – The dimension describing the x values of the variable to be smoothed, by default “time”

  • new_x (_type_, optional) – Extra values to add to the x dimension (used for interpolation), by default None

  • export_all (bool, optional) – Whether to save only the smoothed data or also diagnostics information, by default False

Returns

Dataset containing at least (depending on export_all) a variable called {var}_smoothed.

Return type

xr.Dataset