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

Function test_decoded_cf_datetime_array_2d

xarray/tests/test_coding_times.py:491–499  ·  view source on GitHub ↗
(time_unit: PDDatetimeUnitOptions)

Source from the content-addressed store, hash-verified

489
490@requires_cftime
491def test_decoded_cf_datetime_array_2d(time_unit: PDDatetimeUnitOptions) -> None:
492 # regression test for GH1229
493 variable = Variable(
494 ("x", "y"), np.array([[0, 1], [2, 3]]), {"units": "days since 2000-01-01"}
495 )
496 result = CFDatetimeCoder(time_unit=time_unit).decode(variable)
497 assert result.dtype == f"datetime64[{time_unit}]"
498 expected = pd.date_range("2000-01-01", periods=4).values.reshape(2, 2)
499 assert_array_equal(np.asarray(result), expected)
500
501
502@pytest.mark.parametrize("decode_times", [True, False])

Callers

nothing calls this directly

Calls 3

VariableClass · 0.90
CFDatetimeCoderClass · 0.85
decodeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…