()
| 799 | @requires_cftime |
| 800 | @requires_scipy |
| 801 | def 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 |
nothing calls this directly
no test coverage detected
searching dependent graphs…