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

Function test_parse_array_of_cftime_strings

xarray/tests/test_cftimeindex.py:1199–1217  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1197
1198@requires_cftime
1199def test_parse_array_of_cftime_strings():
1200 from cftime import DatetimeNoLeap
1201
1202 strings = np.array([["2000-01-01", "2000-01-02"], ["2000-01-03", "2000-01-04"]])
1203 expected = np.array(
1204 [
1205 [DatetimeNoLeap(2000, 1, 1), DatetimeNoLeap(2000, 1, 2)],
1206 [DatetimeNoLeap(2000, 1, 3), DatetimeNoLeap(2000, 1, 4)],
1207 ]
1208 )
1209
1210 result = _parse_array_of_cftime_strings(strings, DatetimeNoLeap)
1211 np.testing.assert_array_equal(result, expected)
1212
1213 # Test scalar array case
1214 strings = np.array("2000-01-01")
1215 expected = np.array(DatetimeNoLeap(2000, 1, 1))
1216 result = _parse_array_of_cftime_strings(strings, DatetimeNoLeap)
1217 np.testing.assert_array_equal(result, expected)
1218
1219
1220@requires_cftime

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…