auto_anomaly

earthkit.transforms.climatology.auto_anomaly(dataarray: Dataset | DataArray, *_args, climatology_range: tuple | None = None, climatology_how: str = 'mean', climatology_frequency: str | None = None, relative: bool = False, **_kwargs)[source]

Calculate the anomaly from a reference climatology.

Parameters:
  • dataarray (xarray.DataArray) – The DataArray over which to calculate the anomaly from the reference climatology. Must contain a time dimension.

  • climatology_range ((list or tuple, optional)) – Start and end year of the period to be used for the reference climatology. Default is to use the entire time-series.

  • climatology_how (string) – Method used to calculate climatology, default is “mean”. Accepted values are “median”, “min”, “max”

  • climatology_frequency (str (optional)) – Valid options are None (default), dayofyear, weekofyear and month. If None, the climatology is calculated over all time-steps and the anomaly is returned on the same frequency as the input data.

  • frequency (str (optional)) – Valid options are day, week, month and year. The default is to return the anomaly on the same frequency as the input data.

  • bin_widths (int or list (optional)) – If bin_widths is an int, it defines the width of each group bin on the frequency provided by frequency. If bin_widths is a sequence it defines the edges of each bin, allowing for non-uniform bin widths.

  • time_dim (str (optional)) – Name of the time dimension in the data object, default behaviour is to detect the time dimension from the input object

  • relative (bool (optional)) – Return the relative anomaly, i.e. the percentage change w.r.t the climatological period

  • **reduce_kwargs – Any other kwargs that are accepted by earthkit.transforms.resample

Return type:

xarray.DataArray