MCPcopy Index your code
hub / github.com/pydata/xarray / test_get_clean_interp_index_cf_calendar

Function test_get_clean_interp_index_cf_calendar

xarray/tests/test_missing.py:602–610  ·  view source on GitHub ↗

The index for CFTimeIndex is in units of days. This means that if two series using a 360 and 365 days calendar each have a trend of .01C/year, the linear regression coefficients will be different because they have different number of days. Another option would be to have an index in uni

(cf_da, calendar)

Source from the content-addressed store, hash-verified

600@requires_cftime
601@pytest.mark.parametrize("calendar", _CFTIME_CALENDARS)
602def test_get_clean_interp_index_cf_calendar(cf_da, calendar):
603 """The index for CFTimeIndex is in units of days. This means that if two series using a 360 and 365 days
604 calendar each have a trend of .01C/year, the linear regression coefficients will be different because they
605 have different number of days.
606
607 Another option would be to have an index in units of years, but this would likely create other difficulties.
608 """
609 i = get_clean_interp_index(cf_da(calendar), dim="time")
610 np.testing.assert_array_equal(i, np.arange(10) * 1e9 * 86400)
611
612
613@requires_cftime

Callers

nothing calls this directly

Calls 3

get_clean_interp_indexFunction · 0.90
cf_daFunction · 0.85
arangeMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…