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

Function test_cf_timedelta_2d

xarray/tests/test_coding_times.py:622–632  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

620
621
622def test_cf_timedelta_2d() -> None:
623 units = "days"
624 numbers = np.atleast_2d([1, 2, 3])
625
626 timedeltas = pd.to_timedelta(["1D", "2D", "3D"]).as_unit("ns")
627 timedeltas_2d = np.atleast_2d(timedeltas.to_numpy())
628 expected = timedeltas_2d
629
630 actual = decode_cf_timedelta(numbers, units)
631 assert_array_equal(expected, actual)
632 assert expected.dtype == actual.dtype
633
634
635@pytest.mark.parametrize("encoding_unit", FREQUENCIES_TO_ENCODING_UNITS.values())

Callers

nothing calls this directly

Calls 2

decode_cf_timedeltaFunction · 0.90
to_numpyMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…