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

Function test_interp_calendar_errors

xarray/tests/test_calendar_ops.py:300–321  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

298
299@requires_cftime
300def test_interp_calendar_errors():
301 src_nl = DataArray(
302 [1] * 100,
303 dims=("time",),
304 coords={
305 "time": date_range("0000-01-01", periods=100, freq="MS", calendar="noleap")
306 },
307 )
308 tgt_360 = date_range("0001-01-01", "0001-12-30", freq="MS", calendar="standard")
309
310 with pytest.raises(
311 ValueError, match="Source time coordinate contains dates with year 0"
312 ):
313 interp_calendar(src_nl, tgt_360)
314
315 da1 = DataArray([0, 1, 2], dims=("x",), name="x")
316 da2 = da1 + 1
317
318 with pytest.raises(
319 ValueError, match=r"Both 'source.x' and 'target' must contain datetime objects."
320 ):
321 interp_calendar(da1, da2, dim="x")
322
323
324@requires_cftime

Callers

nothing calls this directly

Calls 3

DataArrayClass · 0.90
date_rangeFunction · 0.90
interp_calendarFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…