mesmer.stats.fit_harmonic_model#
- mesmer.stats.fit_harmonic_model(yearly_predictor, monthly_target, max_order=6, time_dim='time')#
fit harmonic model i.e. a Fourier Series to every gridcell using BIC score to select the order and least squares to fit the coefficients for each order.
- Parameters:
yearly_predictor (xr.DataArray of shape (n_years, n_gridcells)) – Yearly values used as predictors, containing one value per year.
monthly_target (xr.DataArray of shape (n_months, n_gridcells)) – 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.
max_order (Integer, default 6) – Maximum order of Fourier Series to fit for. Default is 6 since highest meaningful maximum order is sample_frequency/2, i.e. 12/2 to fit for monthly data.
- Returns:
data_vars (xr.Dataset) – Dataset containing the selected order of Fourier Series (selected_order), the estimated coefficients of the Fourier Series (coeffs) and the resulting predictions for monthly values (predictions).