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

Function test_cftime_single_string

xarray/tests/test_interp.py:801–817  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

799@requires_cftime
800@requires_scipy
801def test_cftime_single_string() -> None:
802 from cftime import DatetimeProlepticGregorian
803
804 times = xr.date_range(
805 "2000", periods=24, freq="D", calendar="proleptic_gregorian", use_cftime=True
806 )
807 da = xr.DataArray(np.arange(24), coords=[times], dims="time")
808
809 times_new = "2000-01-01T12:00"
810 actual = da.interp(time=times_new)
811
812 times_new_array = _parse_array_of_cftime_strings(
813 np.array(times_new), DatetimeProlepticGregorian
814 )
815 expected = xr.DataArray(0.5, coords={"time": times_new_array})
816
817 assert_allclose(actual, expected)
818
819
820@requires_scipy

Callers

nothing calls this directly

Calls 4

interpMethod · 0.95
assert_allcloseFunction · 0.90
arangeMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…