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

Function test_duck_array_decode_times

xarray/tests/test_coding_times.py:1985–1998  ·  view source on GitHub ↗
(calendar)

Source from the content-addressed store, hash-verified

1983 ],
1984)
1985def test_duck_array_decode_times(calendar) -> None:
1986 from xarray.core.indexing import LazilyIndexedArray
1987
1988 days = LazilyIndexedArray(DuckArrayWrapper(np.array([1.0, 2.0, 3.0])))
1989 var = Variable(
1990 ["time"], days, {"units": "days since 2001-01-01", "calendar": calendar}
1991 )
1992 decoded = conventions.decode_cf_variable(
1993 "foo", var, decode_times=CFDatetimeCoder(use_cftime=None)
1994 )
1995 if calendar not in _STANDARD_CALENDAR_NAMES:
1996 assert decoded.dtype == np.dtype("O")
1997 else:
1998 assert decoded.dtype == np.dtype("=M8[ns]")
1999
2000
2001@pytest.mark.parametrize("decode_timedelta", [True, False])

Callers

nothing calls this directly

Calls 5

LazilyIndexedArrayClass · 0.90
DuckArrayWrapperClass · 0.90
VariableClass · 0.90
CFDatetimeCoderClass · 0.85
dtypeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…