mesmer.stats.HarmonicModel.residuals

mesmer.stats.HarmonicModel.residuals#

HarmonicModel.residuals(yearly_predictor, monthly_target, *, time_dim='time')#

Calculate the residuals of the fitted harmonic model

Parameters:
  • yearly_predictor (xr.DataArray) – yearly values used as predictors, must contain time_dim but can have additional dimensions for example gridcells or members.

  • monthly_target (xr.DataArray) – Monthly values to fit to, containing one value per month, for every year in yearly_predictor (starting with January). So n_months = 12 \(\cdot\) n_years. Must contain time_dim and possibly additional dimensions as yearly_predictor.

  • time_dim (str, default: “time”) – Name of the time dimension on yearly_predictor. Will also be the name of the time_dim of the output xr.DataArray.

Returns:

residuals (xr.DataArray) – DataArray containing the residuals of the model (residuals)