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

Function test_scalar_unit

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

Source from the content-addressed store, hash-verified

1343
1344@requires_cftime
1345def test_scalar_unit() -> None:
1346 # test that a scalar units (often NaN when using to_netcdf) does not raise an error
1347 variable = Variable(("x", "y"), np.array([[0, 1], [2, 3]]), {"units": np.nan})
1348 result = CFDatetimeCoder().decode(variable)
1349 assert np.isnan(result.attrs["units"])
1350
1351
1352@requires_cftime

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…