toad.shifts.methods.base

Classes

ShiftsMethod()

class toad.shifts.methods.base.ShiftsMethod

Bases: ABC

abstractmethod fit_predict(values_1d, times_1d)

Apply the shifts detection method.

Parameters:
  • values_1d (ndarray) – Input values.

  • times_1d (ndarray) – Input times.

Returns:

A detection time series with the same length as the input,

where each value indicates the presence or magnitude of a detected shift.

Return type:

np.ndarray

pre_validation(data_array, td)

Optional validation method that runs once before applying the method to all grid cells.

This method is called once in compute_shifts() before xr.apply_ufunc() processes all grid cells. Override this method in subclasses to implement method-specific validations (e.g., checking for regular temporal spacing, validating parameters, converting timescale parameters, etc.).

Parameters:
  • data_array (xr.DataArray) – The masked data array that will be processed

  • td (TOAD) – The TOAD object containing the dataset and metadata

Raises:

ValueError – If validation fails

Return type:

None