def test_month(self, q_series): q = q_series(np.arange(1000)) o = generic.select_resample_op(q, "count", freq="YS", month=3) np.testing.assert_array_equal(o, 31)
def test_season_default(self, q_series): # Will use freq='YS', so count J, F and D of each year. q = q_series(np.arange(1000)) o = generic.select_resample_op(q, "min", season="DJF") assert o[0] == 0 assert o[1] == 366
def test_season(self, q_series): q = q_series(np.arange(1000)) o = generic.select_resample_op(q, "count", freq="AS-DEC", season="DJF") assert o[0] == 31 + 29
def frequency_analysis_method(ds, *, dim, method): sub = select_resample_op(ds.x, op=op) params = fit(sub, dist="genextreme", method=method) out = parametric_quantile(params, q=1 - 1.0 / period) return out.isel(quantile=0, drop=True).rename("out").to_dataset()