MCPcopy
hub / github.com/pydata/xarray / test_interp_calendar

Function test_interp_calendar

xarray/tests/test_calendar_ops.py:277–296  ·  view source on GitHub ↗
(source, target)

Source from the content-addressed store, hash-verified

275 ],
276)
277def test_interp_calendar(source, target):
278 src = DataArray(
279 date_range("2004-01-01", "2004-07-30", freq="D", calendar=source),
280 dims=("time",),
281 name="time",
282 )
283 tgt = DataArray(
284 date_range("2004-01-01", "2004-07-30", freq="D", calendar=target),
285 dims=("time",),
286 name="time",
287 )
288 da_src = DataArray(
289 np.linspace(0, 1, src.size), dims=("time",), coords={"time": src}
290 )
291 conv = interp_calendar(da_src, tgt)
292
293 assert_identical(tgt.time, conv.time)
294
295 np.testing.assert_almost_equal(conv.max(), 1, 2)
296 assert conv.min() == 0
297
298
299@requires_cftime

Callers

nothing calls this directly

Calls 7

DataArrayClass · 0.90
date_rangeFunction · 0.90
interp_calendarFunction · 0.90
assert_identicalFunction · 0.90
linspaceMethod · 0.80
maxMethod · 0.45
minMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…