()
| 778 | @requires_cftime |
| 779 | @requires_scipy |
| 780 | def test_cftime_list_of_strings() -> None: |
| 781 | from cftime import DatetimeProlepticGregorian |
| 782 | |
| 783 | times = xr.date_range( |
| 784 | "2000", periods=24, freq="D", calendar="proleptic_gregorian", use_cftime=True |
| 785 | ) |
| 786 | da = xr.DataArray(np.arange(24), coords=[times], dims="time") |
| 787 | |
| 788 | times_new = ["2000-01-01T12:00", "2000-01-02T12:00", "2000-01-03T12:00"] |
| 789 | actual = da.interp(time=times_new) |
| 790 | |
| 791 | times_new_array = _parse_array_of_cftime_strings( |
| 792 | np.array(times_new), DatetimeProlepticGregorian |
| 793 | ) |
| 794 | expected = xr.DataArray([0.5, 1.5, 2.5], coords=[times_new_array], dims=["time"]) |
| 795 | |
| 796 | assert_allclose(actual, expected) |
| 797 | |
| 798 | |
| 799 | @requires_cftime |
nothing calls this directly
no test coverage detected
searching dependent graphs…