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

Function test_get_clean_interp_index_dt

xarray/tests/test_missing.py:616–625  ·  view source on GitHub ↗

In the gregorian case, the index should be proportional to normal datetimes.

(cf_da, calendar, freq)

Source from the content-addressed store, hash-verified

614@pytest.mark.parametrize("calendar", ["gregorian", "proleptic_gregorian"])
615@pytest.mark.parametrize("freq", ["1D", "1ME", "1YE"])
616def test_get_clean_interp_index_dt(cf_da, calendar, freq) -> None:
617 """In the gregorian case, the index should be proportional to normal datetimes."""
618 g = cf_da(calendar, freq=freq)
619 g["stime"] = xr.Variable(
620 data=g.time.to_index().to_datetimeindex(time_unit="ns"), dims=("time",)
621 )
622
623 gi = get_clean_interp_index(g, "time")
624 si = get_clean_interp_index(g, "time", use_coordinate="stime")
625 np.testing.assert_array_equal(gi, si)
626
627
628@requires_cftime

Callers

nothing calls this directly

Calls 4

get_clean_interp_indexFunction · 0.90
cf_daFunction · 0.85
to_datetimeindexMethod · 0.80
to_indexMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…