toad.compute_shifts

toad.compute_shifts(td, var, method, output_label_suffix='', overwrite=False)

Apply an abrupt shift detection algorithm to a dataset along the specified temporal dimension.

Parameters:
  • td (TOAD) – TOAD object

  • var (str) – Name of the variable in the dataset to analyze for abrupt shifts

  • method (ShiftsMethod) – The abrupt shift detection algorithm to use. Choose from predefined method objects in toad.shifts or create your own following the base class in toad.shifts.methods.base

  • output_label_suffix (str) – A suffix to add to the output label. Defaults to “”.

  • overwrite (bool) – Whether to overwrite existing variable. Defaults to False.

Returns:

If merge_input is True, returns an xarray.Dataset containing

the original data and the detected shifts. If merge_input is False, returns an xarray.DataArray containing the detected shifts.

Return type:

Union[xr.Dataset, xr.DataArray]

Raises:

ValueError – If data is invalid or required parameters are missing