diff --git a/mesmer/stats/_harmonic_model.py b/mesmer/stats/_harmonic_model.py index 20f0f70b..0b7a8070 100644 --- a/mesmer/stats/_harmonic_model.py +++ b/mesmer/stats/_harmonic_model.py @@ -190,7 +190,7 @@ def _fit_fourier_order_np(yearly_predictor, monthly_target, max_order): ------- selected_order : Integer Selected order of Fourier Series. - coeffs : array-like of size (4*n_sel,) + coeffs : array-like of size (4 * max_order,) Fitted coefficients for the selected order of Fourier Series. predictions : array-like of size (n_years*12,) Predicted monthly values from final model. @@ -247,9 +247,9 @@ def fit_harmonic_model(yearly_predictor, monthly_target, max_order=6, time_dim=" Returns ------- data_vars : `xr.Dataset` - Dataset containing the selected order of Fourier Series (n_sel), the estimated - coefficients of the Fourier Series (coeffs) and the resulting predictions for - monthly values (predictions). + 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). """ @@ -269,7 +269,7 @@ def fit_harmonic_model(yearly_predictor, monthly_target, max_order=6, time_dim=" # subtract annual mean to have seasonal anomalies around 0 seasonal_deviations = monthly_target - yearly_predictor - n_sel, coeffs, preds = xr.apply_ufunc( + selected_order, coeffs, preds = xr.apply_ufunc( _fit_fourier_order_np, yearly_predictor, seasonal_deviations, @@ -283,7 +283,7 @@ def fit_harmonic_model(yearly_predictor, monthly_target, max_order=6, time_dim=" preds = yearly_predictor + preds data_vars = { - "n_sel": n_sel, + "selected_order": selected_order, "coeffs": coeffs, "predictions": preds.transpose(time_dim, ...), } diff --git a/tests/unit/test_harmonic_model.py b/tests/unit/test_harmonic_model.py index b4cc9d34..bdf0850f 100644 --- a/tests/unit/test_harmonic_model.py +++ b/tests/unit/test_harmonic_model.py @@ -156,7 +156,7 @@ def test_fit_harmonic_model(): # test if the model can recover the monthly target from perfect fourier series result = mesmer.stats.fit_harmonic_model(yearly_predictor, monthly_target) - np.testing.assert_equal(result.n_sel.values, orders) + np.testing.assert_equal(result.selected_order.values, orders) xr.testing.assert_allclose(result["predictions"], monthly_target) # test if the model can recover the underlying cycle with noise on top of monthly target