Enable pandas type checking #13205
1 052 fail, 1 545 skipped, 17 407 pass in 1h 24m 49s
Annotations
Check warning on line 0 in xarray.tests.test_backends.TestZarrWriteEmpty
github-actions / Test Results
6 out of 9 runs failed: test_encoding_kwarg_dates (xarray.tests.test_backends.TestZarrWriteEmpty)
artifacts/Test results for Linux-3.11 all-but-dask/pytest.xml [took 0s]
artifacts/Test results for Linux-3.12/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9 min-all-deps/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9/pytest.xml [took 0s]
artifacts/Test results for macOS-3.12/pytest.xml [took 0s]
artifacts/Test results for macOS-3.9/pytest.xml [took 0s]
Raw output
NameError: name 'NPDatetimeUnitOptions' is not defined
self = <xarray.tests.test_backends.TestZarrWriteEmpty object at 0x7f7ef760a790>
def test_encoding_kwarg_dates(self) -> None:
ds = Dataset({"t": pd.date_range("2000-01-01", periods=3)})
units = "days since 1900-01-01"
kwargs = dict(encoding={"t": {"units": units}})
> with self.roundtrip(ds, save_kwargs=kwargs) as actual:
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/tests/test_backends.py#x1B[0m:1148:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
#x1B[1m#x1B[31m/home/runner/micromamba/envs/xarray-tests/lib/python3.11/contextlib.py#x1B[0m:137: in __enter__
return next(self.gen)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/tests/test_backends.py#x1B[0m:2106: in roundtrip
self.save(data, store_target, **save_kwargs)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/tests/test_backends.py#x1B[0m:2088: in save
return dataset.to_zarr(store=store_target, **kwargs, **self.version_kwargs)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/dataset.py#x1B[0m:2551: in to_zarr
return to_zarr( # type: ignore[call-overload,misc]
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/api.py#x1B[0m:1710: in to_zarr
dump_to_store(dataset, zstore, writer, encoding=encoding)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/api.py#x1B[0m:1397: in dump_to_store
store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/zarr.py#x1B[0m:664: in store
variables_encoded, attributes = self.encode(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/common.py#x1B[0m:302: in encode
variables = {k: self.encode_variable(v) for k, v in variables.items()}
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/common.py#x1B[0m:302: in <dictcomp>
variables = {k: self.encode_variable(v) for k, v in variables.items()}
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/zarr.py#x1B[0m:598: in encode_variable
variable = encode_zarr_variable(variable)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/zarr.py#x1B[0m:314: in encode_zarr_variable
var = conventions.encode_cf_variable(var, name=name)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/conventions.py#x1B[0m:196: in encode_cf_variable
var = coder.encode(var, name=name)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:977: in encode
(data, units, calendar) = encode_cf_datetime(data, units, calendar, dtype)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:726: in encode_cf_datetime
return _eagerly_encode_cf_datetime(dates, units, calendar, dtype)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:738: in _eagerly_encode_cf_datetime
data_units = infer_datetime_units(dates)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:446: in infer_datetime_units
units = _infer_time_units_from_diff(unique_timedeltas)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:400: in _infer_time_units_from_diff
if np.all(unique_timedeltas % unit_timedelta(time_unit) == zero_timedelta):
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:384: in _unit_timedelta_numpy
numpy_units = _netcdf_to_numpy_timeunit(units)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
units = 'days'
def _netcdf_to_numpy_timeunit(units: str) -> NPDatetimeUnitOptions:
units = units.lower()
if not units.endswith("s"):
units = f"{units}s"
return cast(
> NPDatetimeUnitOptions,
{
"nanoseconds": "ns",
"microseconds": "us",
"milliseconds": "ms",
"seconds": "s",
"minutes": "m",
"hours": "h",
"days": "D",
}[units],
)
#x1B[1m#x1B[31mE NameError: name 'NPDatetimeUnitOptions' is not defined#x1B[0m
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:119: NameError
Check warning on line 0 in xarray.tests.test_backends.TestZarrWriteEmpty
github-actions / Test Results
6 out of 9 runs failed: test_append_overwrite_values (xarray.tests.test_backends.TestZarrWriteEmpty)
artifacts/Test results for Linux-3.11 all-but-dask/pytest.xml [took 0s]
artifacts/Test results for Linux-3.12/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9 min-all-deps/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9/pytest.xml [took 0s]
artifacts/Test results for macOS-3.12/pytest.xml [took 0s]
artifacts/Test results for macOS-3.9/pytest.xml [took 0s]
Raw output
NameError: name 'NPDatetimeUnitOptions' is not defined
self = <xarray.tests.test_backends.TestZarrWriteEmpty object at 0x7f7ef7618650>
def test_append_overwrite_values(self) -> None:
# regression for GH1215
data = create_test_data()
with create_tmp_file(allow_cleanup_failure=False) as tmp_file:
> self.save(data, tmp_file, mode="w")
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/tests/test_backends.py#x1B[0m:1229:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/tests/test_backends.py#x1B[0m:2088: in save
return dataset.to_zarr(store=store_target, **kwargs, **self.version_kwargs)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/dataset.py#x1B[0m:2551: in to_zarr
return to_zarr( # type: ignore[call-overload,misc]
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/api.py#x1B[0m:1710: in to_zarr
dump_to_store(dataset, zstore, writer, encoding=encoding)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/api.py#x1B[0m:1397: in dump_to_store
store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/zarr.py#x1B[0m:664: in store
variables_encoded, attributes = self.encode(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/common.py#x1B[0m:302: in encode
variables = {k: self.encode_variable(v) for k, v in variables.items()}
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/common.py#x1B[0m:302: in <dictcomp>
variables = {k: self.encode_variable(v) for k, v in variables.items()}
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/zarr.py#x1B[0m:598: in encode_variable
variable = encode_zarr_variable(variable)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/zarr.py#x1B[0m:314: in encode_zarr_variable
var = conventions.encode_cf_variable(var, name=name)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/conventions.py#x1B[0m:196: in encode_cf_variable
var = coder.encode(var, name=name)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:977: in encode
(data, units, calendar) = encode_cf_datetime(data, units, calendar, dtype)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:726: in encode_cf_datetime
return _eagerly_encode_cf_datetime(dates, units, calendar, dtype)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:738: in _eagerly_encode_cf_datetime
data_units = infer_datetime_units(dates)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:446: in infer_datetime_units
units = _infer_time_units_from_diff(unique_timedeltas)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:400: in _infer_time_units_from_diff
if np.all(unique_timedeltas % unit_timedelta(time_unit) == zero_timedelta):
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:384: in _unit_timedelta_numpy
numpy_units = _netcdf_to_numpy_timeunit(units)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
units = 'days'
def _netcdf_to_numpy_timeunit(units: str) -> NPDatetimeUnitOptions:
units = units.lower()
if not units.endswith("s"):
units = f"{units}s"
return cast(
> NPDatetimeUnitOptions,
{
"nanoseconds": "ns",
"microseconds": "us",
"milliseconds": "ms",
"seconds": "s",
"minutes": "m",
"hours": "h",
"days": "D",
}[units],
)
#x1B[1m#x1B[31mE NameError: name 'NPDatetimeUnitOptions' is not defined#x1B[0m
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:119: NameError
Check warning on line 0 in xarray.tests.test_backends.TestZarrWriteEmpty
github-actions / Test Results
6 out of 9 runs failed: test_roundtrip_consolidated[False] (xarray.tests.test_backends.TestZarrWriteEmpty)
artifacts/Test results for Linux-3.11 all-but-dask/pytest.xml [took 0s]
artifacts/Test results for Linux-3.12/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9 min-all-deps/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9/pytest.xml [took 0s]
artifacts/Test results for macOS-3.12/pytest.xml [took 0s]
artifacts/Test results for macOS-3.9/pytest.xml [took 0s]
Raw output
NameError: name 'NPDatetimeUnitOptions' is not defined
self = <xarray.tests.test_backends.TestZarrWriteEmpty object at 0x7f7ef7497150>
consolidated = False
@pytest.mark.parametrize("consolidated", [False, True, None])
def test_roundtrip_consolidated(self, consolidated) -> None:
if consolidated and self.zarr_version > 2:
pytest.xfail("consolidated metadata is not supported for zarr v3 yet")
expected = create_test_data()
> with self.roundtrip(
expected,
save_kwargs={"consolidated": consolidated},
open_kwargs={"backend_kwargs": {"consolidated": consolidated}},
) as actual:
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/tests/test_backends.py#x1B[0m:2115:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
#x1B[1m#x1B[31m/home/runner/micromamba/envs/xarray-tests/lib/python3.11/contextlib.py#x1B[0m:137: in __enter__
return next(self.gen)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/tests/test_backends.py#x1B[0m:2106: in roundtrip
self.save(data, store_target, **save_kwargs)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/tests/test_backends.py#x1B[0m:2088: in save
return dataset.to_zarr(store=store_target, **kwargs, **self.version_kwargs)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/dataset.py#x1B[0m:2551: in to_zarr
return to_zarr( # type: ignore[call-overload,misc]
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/api.py#x1B[0m:1710: in to_zarr
dump_to_store(dataset, zstore, writer, encoding=encoding)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/api.py#x1B[0m:1397: in dump_to_store
store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/zarr.py#x1B[0m:664: in store
variables_encoded, attributes = self.encode(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/common.py#x1B[0m:302: in encode
variables = {k: self.encode_variable(v) for k, v in variables.items()}
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/common.py#x1B[0m:302: in <dictcomp>
variables = {k: self.encode_variable(v) for k, v in variables.items()}
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/zarr.py#x1B[0m:598: in encode_variable
variable = encode_zarr_variable(variable)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/zarr.py#x1B[0m:314: in encode_zarr_variable
var = conventions.encode_cf_variable(var, name=name)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/conventions.py#x1B[0m:196: in encode_cf_variable
var = coder.encode(var, name=name)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:977: in encode
(data, units, calendar) = encode_cf_datetime(data, units, calendar, dtype)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:726: in encode_cf_datetime
return _eagerly_encode_cf_datetime(dates, units, calendar, dtype)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:738: in _eagerly_encode_cf_datetime
data_units = infer_datetime_units(dates)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:446: in infer_datetime_units
units = _infer_time_units_from_diff(unique_timedeltas)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:400: in _infer_time_units_from_diff
if np.all(unique_timedeltas % unit_timedelta(time_unit) == zero_timedelta):
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:384: in _unit_timedelta_numpy
numpy_units = _netcdf_to_numpy_timeunit(units)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
units = 'days'
def _netcdf_to_numpy_timeunit(units: str) -> NPDatetimeUnitOptions:
units = units.lower()
if not units.endswith("s"):
units = f"{units}s"
return cast(
> NPDatetimeUnitOptions,
{
"nanoseconds": "ns",
"microseconds": "us",
"milliseconds": "ms",
"seconds": "s",
"minutes": "m",
"hours": "h",
"days": "D",
}[units],
)
#x1B[1m#x1B[31mE NameError: name 'NPDatetimeUnitOptions' is not defined#x1B[0m
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:119: NameError
Check warning on line 0 in xarray.tests.test_backends.TestZarrWriteEmpty
github-actions / Test Results
6 out of 9 runs failed: test_roundtrip_consolidated[True] (xarray.tests.test_backends.TestZarrWriteEmpty)
artifacts/Test results for Linux-3.11 all-but-dask/pytest.xml [took 0s]
artifacts/Test results for Linux-3.12/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9 min-all-deps/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9/pytest.xml [took 0s]
artifacts/Test results for macOS-3.12/pytest.xml [took 0s]
artifacts/Test results for macOS-3.9/pytest.xml [took 0s]
Raw output
NameError: name 'NPDatetimeUnitOptions' is not defined
self = <xarray.tests.test_backends.TestZarrWriteEmpty object at 0x7f7ef7495f10>
consolidated = True
@pytest.mark.parametrize("consolidated", [False, True, None])
def test_roundtrip_consolidated(self, consolidated) -> None:
if consolidated and self.zarr_version > 2:
pytest.xfail("consolidated metadata is not supported for zarr v3 yet")
expected = create_test_data()
> with self.roundtrip(
expected,
save_kwargs={"consolidated": consolidated},
open_kwargs={"backend_kwargs": {"consolidated": consolidated}},
) as actual:
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/tests/test_backends.py#x1B[0m:2115:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
#x1B[1m#x1B[31m/home/runner/micromamba/envs/xarray-tests/lib/python3.11/contextlib.py#x1B[0m:137: in __enter__
return next(self.gen)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/tests/test_backends.py#x1B[0m:2106: in roundtrip
self.save(data, store_target, **save_kwargs)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/tests/test_backends.py#x1B[0m:2088: in save
return dataset.to_zarr(store=store_target, **kwargs, **self.version_kwargs)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/dataset.py#x1B[0m:2551: in to_zarr
return to_zarr( # type: ignore[call-overload,misc]
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/api.py#x1B[0m:1710: in to_zarr
dump_to_store(dataset, zstore, writer, encoding=encoding)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/api.py#x1B[0m:1397: in dump_to_store
store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/zarr.py#x1B[0m:664: in store
variables_encoded, attributes = self.encode(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/common.py#x1B[0m:302: in encode
variables = {k: self.encode_variable(v) for k, v in variables.items()}
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/common.py#x1B[0m:302: in <dictcomp>
variables = {k: self.encode_variable(v) for k, v in variables.items()}
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/zarr.py#x1B[0m:598: in encode_variable
variable = encode_zarr_variable(variable)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/zarr.py#x1B[0m:314: in encode_zarr_variable
var = conventions.encode_cf_variable(var, name=name)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/conventions.py#x1B[0m:196: in encode_cf_variable
var = coder.encode(var, name=name)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:977: in encode
(data, units, calendar) = encode_cf_datetime(data, units, calendar, dtype)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:726: in encode_cf_datetime
return _eagerly_encode_cf_datetime(dates, units, calendar, dtype)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:738: in _eagerly_encode_cf_datetime
data_units = infer_datetime_units(dates)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:446: in infer_datetime_units
units = _infer_time_units_from_diff(unique_timedeltas)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:400: in _infer_time_units_from_diff
if np.all(unique_timedeltas % unit_timedelta(time_unit) == zero_timedelta):
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:384: in _unit_timedelta_numpy
numpy_units = _netcdf_to_numpy_timeunit(units)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
units = 'days'
def _netcdf_to_numpy_timeunit(units: str) -> NPDatetimeUnitOptions:
units = units.lower()
if not units.endswith("s"):
units = f"{units}s"
return cast(
> NPDatetimeUnitOptions,
{
"nanoseconds": "ns",
"microseconds": "us",
"milliseconds": "ms",
"seconds": "s",
"minutes": "m",
"hours": "h",
"days": "D",
}[units],
)
#x1B[1m#x1B[31mE NameError: name 'NPDatetimeUnitOptions' is not defined#x1B[0m
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:119: NameError
Check warning on line 0 in xarray.tests.test_backends.TestH5NetCDFFileObject
github-actions / Test Results
8 out of 9 runs failed: test_encoding_kwarg_dates (xarray.tests.test_backends.TestH5NetCDFFileObject)
artifacts/Test results for Linux-3.11 all-but-dask/pytest.xml [took 0s]
artifacts/Test results for Linux-3.12/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9 min-all-deps/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9/pytest.xml [took 0s]
artifacts/Test results for Windows-3.12/pytest.xml [took 0s]
artifacts/Test results for Windows-3.9/pytest.xml [took 0s]
artifacts/Test results for macOS-3.12/pytest.xml [took 0s]
artifacts/Test results for macOS-3.9/pytest.xml [took 0s]
Raw output
NameError: name 'NPDatetimeUnitOptions' is not defined
self = <xarray.tests.test_backends.TestH5NetCDFFileObject object at 0x000002ADE0F22330>
def test_encoding_kwarg_dates(self) -> None:
ds = Dataset({"t": pd.date_range("2000-01-01", periods=3)})
units = "days since 1900-01-01"
kwargs = dict(encoding={"t": {"units": units}})
> with self.roundtrip(ds, save_kwargs=kwargs) as actual:
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\tests\test_backends.py#x1B[0m:1148:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
#x1B[1m#x1B[31mC:\Users\runneradmin\micromamba\envs\xarray-tests\Lib\contextlib.py#x1B[0m:137: in __enter__
return next(self.gen)
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\tests\test_backends.py#x1B[0m:315: in roundtrip
self.save(data, path, **save_kwargs)
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\tests\test_backends.py#x1B[0m:336: in save
return dataset.to_netcdf(
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\core\dataset.py#x1B[0m:2327: in to_netcdf
return to_netcdf( # type: ignore # mypy cannot resolve the overloads:(
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\backends\api.py#x1B[0m:1350: in to_netcdf
dump_to_store(
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\backends\api.py#x1B[0m:1397: in dump_to_store
store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims)
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\backends\common.py#x1B[0m:363: in store
variables, attributes = self.encode(variables, attributes)
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\backends\common.py#x1B[0m:452: in encode
variables, attributes = cf_encoder(variables, attributes)
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\conventions.py#x1B[0m:795: in cf_encoder
new_vars = {k: encode_cf_variable(v, name=k) for k, v in variables.items()}
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\conventions.py#x1B[0m:196: in encode_cf_variable
var = coder.encode(var, name=name)
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\coding\times.py#x1B[0m:977: in encode
(data, units, calendar) = encode_cf_datetime(data, units, calendar, dtype)
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\coding\times.py#x1B[0m:726: in encode_cf_datetime
return _eagerly_encode_cf_datetime(dates, units, calendar, dtype)
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\coding\times.py#x1B[0m:738: in _eagerly_encode_cf_datetime
data_units = infer_datetime_units(dates)
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\coding\times.py#x1B[0m:446: in infer_datetime_units
units = _infer_time_units_from_diff(unique_timedeltas)
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\coding\times.py#x1B[0m:400: in _infer_time_units_from_diff
if np.all(unique_timedeltas % unit_timedelta(time_unit) == zero_timedelta):
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\coding\times.py#x1B[0m:384: in _unit_timedelta_numpy
numpy_units = _netcdf_to_numpy_timeunit(units)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
units = 'days'
def _netcdf_to_numpy_timeunit(units: str) -> NPDatetimeUnitOptions:
units = units.lower()
if not units.endswith("s"):
units = f"{units}s"
return cast(
> NPDatetimeUnitOptions,
{
"nanoseconds": "ns",
"microseconds": "us",
"milliseconds": "ms",
"seconds": "s",
"minutes": "m",
"hours": "h",
"days": "D",
}[units],
)
#x1B[1m#x1B[31mE NameError: name 'NPDatetimeUnitOptions' is not defined#x1B[0m
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\coding\times.py#x1B[0m:119: NameError
Check warning on line 0 in xarray.tests.test_backends.TestZarrWriteEmpty
github-actions / Test Results
6 out of 9 runs failed: test_roundtrip_consolidated[None] (xarray.tests.test_backends.TestZarrWriteEmpty)
artifacts/Test results for Linux-3.11 all-but-dask/pytest.xml [took 0s]
artifacts/Test results for Linux-3.12/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9 min-all-deps/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9/pytest.xml [took 0s]
artifacts/Test results for macOS-3.12/pytest.xml [took 0s]
artifacts/Test results for macOS-3.9/pytest.xml [took 0s]
Raw output
NameError: name 'NPDatetimeUnitOptions' is not defined
self = <xarray.tests.test_backends.TestZarrWriteEmpty object at 0x7f7ef7496d90>
consolidated = None
@pytest.mark.parametrize("consolidated", [False, True, None])
def test_roundtrip_consolidated(self, consolidated) -> None:
if consolidated and self.zarr_version > 2:
pytest.xfail("consolidated metadata is not supported for zarr v3 yet")
expected = create_test_data()
> with self.roundtrip(
expected,
save_kwargs={"consolidated": consolidated},
open_kwargs={"backend_kwargs": {"consolidated": consolidated}},
) as actual:
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/tests/test_backends.py#x1B[0m:2115:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
#x1B[1m#x1B[31m/home/runner/micromamba/envs/xarray-tests/lib/python3.11/contextlib.py#x1B[0m:137: in __enter__
return next(self.gen)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/tests/test_backends.py#x1B[0m:2106: in roundtrip
self.save(data, store_target, **save_kwargs)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/tests/test_backends.py#x1B[0m:2088: in save
return dataset.to_zarr(store=store_target, **kwargs, **self.version_kwargs)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/dataset.py#x1B[0m:2551: in to_zarr
return to_zarr( # type: ignore[call-overload,misc]
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/api.py#x1B[0m:1710: in to_zarr
dump_to_store(dataset, zstore, writer, encoding=encoding)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/api.py#x1B[0m:1397: in dump_to_store
store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/zarr.py#x1B[0m:664: in store
variables_encoded, attributes = self.encode(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/common.py#x1B[0m:302: in encode
variables = {k: self.encode_variable(v) for k, v in variables.items()}
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/common.py#x1B[0m:302: in <dictcomp>
variables = {k: self.encode_variable(v) for k, v in variables.items()}
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/zarr.py#x1B[0m:598: in encode_variable
variable = encode_zarr_variable(variable)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/zarr.py#x1B[0m:314: in encode_zarr_variable
var = conventions.encode_cf_variable(var, name=name)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/conventions.py#x1B[0m:196: in encode_cf_variable
var = coder.encode(var, name=name)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:977: in encode
(data, units, calendar) = encode_cf_datetime(data, units, calendar, dtype)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:726: in encode_cf_datetime
return _eagerly_encode_cf_datetime(dates, units, calendar, dtype)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:738: in _eagerly_encode_cf_datetime
data_units = infer_datetime_units(dates)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:446: in infer_datetime_units
units = _infer_time_units_from_diff(unique_timedeltas)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:400: in _infer_time_units_from_diff
if np.all(unique_timedeltas % unit_timedelta(time_unit) == zero_timedelta):
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:384: in _unit_timedelta_numpy
numpy_units = _netcdf_to_numpy_timeunit(units)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
units = 'days'
def _netcdf_to_numpy_timeunit(units: str) -> NPDatetimeUnitOptions:
units = units.lower()
if not units.endswith("s"):
units = f"{units}s"
return cast(
> NPDatetimeUnitOptions,
{
"nanoseconds": "ns",
"microseconds": "us",
"milliseconds": "ms",
"seconds": "s",
"minutes": "m",
"hours": "h",
"days": "D",
}[units],
)
#x1B[1m#x1B[31mE NameError: name 'NPDatetimeUnitOptions' is not defined#x1B[0m
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:119: NameError
Check warning on line 0 in xarray.tests.test_backends.TestZarrWriteEmpty
github-actions / Test Results
6 out of 9 runs failed: test_read_non_consolidated_warning (xarray.tests.test_backends.TestZarrWriteEmpty)
artifacts/Test results for Linux-3.11 all-but-dask/pytest.xml [took 0s]
artifacts/Test results for Linux-3.12/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9 min-all-deps/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9/pytest.xml [took 0s]
artifacts/Test results for macOS-3.12/pytest.xml [took 0s]
artifacts/Test results for macOS-3.9/pytest.xml [took 0s]
Raw output
NameError: name 'NPDatetimeUnitOptions' is not defined
self = <xarray.tests.test_backends.TestZarrWriteEmpty object at 0x7f7ef751e890>
def test_read_non_consolidated_warning(self) -> None:
if self.zarr_version > 2:
pytest.xfail("consolidated metadata is not supported for zarr v3 yet")
expected = create_test_data()
with self.create_zarr_target() as store:
> expected.to_zarr(store, consolidated=False, **self.version_kwargs)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/tests/test_backends.py#x1B[0m:2129:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/dataset.py#x1B[0m:2551: in to_zarr
return to_zarr( # type: ignore[call-overload,misc]
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/api.py#x1B[0m:1710: in to_zarr
dump_to_store(dataset, zstore, writer, encoding=encoding)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/api.py#x1B[0m:1397: in dump_to_store
store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/zarr.py#x1B[0m:664: in store
variables_encoded, attributes = self.encode(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/common.py#x1B[0m:302: in encode
variables = {k: self.encode_variable(v) for k, v in variables.items()}
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/common.py#x1B[0m:302: in <dictcomp>
variables = {k: self.encode_variable(v) for k, v in variables.items()}
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/zarr.py#x1B[0m:598: in encode_variable
variable = encode_zarr_variable(variable)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/zarr.py#x1B[0m:314: in encode_zarr_variable
var = conventions.encode_cf_variable(var, name=name)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/conventions.py#x1B[0m:196: in encode_cf_variable
var = coder.encode(var, name=name)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:977: in encode
(data, units, calendar) = encode_cf_datetime(data, units, calendar, dtype)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:726: in encode_cf_datetime
return _eagerly_encode_cf_datetime(dates, units, calendar, dtype)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:738: in _eagerly_encode_cf_datetime
data_units = infer_datetime_units(dates)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:446: in infer_datetime_units
units = _infer_time_units_from_diff(unique_timedeltas)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:400: in _infer_time_units_from_diff
if np.all(unique_timedeltas % unit_timedelta(time_unit) == zero_timedelta):
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:384: in _unit_timedelta_numpy
numpy_units = _netcdf_to_numpy_timeunit(units)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
units = 'days'
def _netcdf_to_numpy_timeunit(units: str) -> NPDatetimeUnitOptions:
units = units.lower()
if not units.endswith("s"):
units = f"{units}s"
return cast(
> NPDatetimeUnitOptions,
{
"nanoseconds": "ns",
"microseconds": "us",
"milliseconds": "ms",
"seconds": "s",
"minutes": "m",
"hours": "h",
"days": "D",
}[units],
)
#x1B[1m#x1B[31mE NameError: name 'NPDatetimeUnitOptions' is not defined#x1B[0m
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:119: NameError
Check warning on line 0 in xarray.tests.test_backends.TestZarrWriteEmpty
github-actions / Test Results
6 out of 9 runs failed: test_with_chunkstore (xarray.tests.test_backends.TestZarrWriteEmpty)
artifacts/Test results for Linux-3.11 all-but-dask/pytest.xml [took 0s]
artifacts/Test results for Linux-3.12/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9 min-all-deps/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9/pytest.xml [took 0s]
artifacts/Test results for macOS-3.12/pytest.xml [took 0s]
artifacts/Test results for macOS-3.9/pytest.xml [took 0s]
Raw output
NameError: name 'NPDatetimeUnitOptions' is not defined
self = <xarray.tests.test_backends.TestZarrWriteEmpty object at 0x7f7ef7497750>
def test_with_chunkstore(self) -> None:
expected = create_test_data()
with (
self.create_zarr_target() as store_target,
self.create_zarr_target() as chunk_store,
):
save_kwargs = {"chunk_store": chunk_store}
> self.save(expected, store_target, **save_kwargs)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/tests/test_backends.py#x1B[0m:2148:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/tests/test_backends.py#x1B[0m:2088: in save
return dataset.to_zarr(store=store_target, **kwargs, **self.version_kwargs)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/dataset.py#x1B[0m:2551: in to_zarr
return to_zarr( # type: ignore[call-overload,misc]
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/api.py#x1B[0m:1710: in to_zarr
dump_to_store(dataset, zstore, writer, encoding=encoding)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/api.py#x1B[0m:1397: in dump_to_store
store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/zarr.py#x1B[0m:664: in store
variables_encoded, attributes = self.encode(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/common.py#x1B[0m:302: in encode
variables = {k: self.encode_variable(v) for k, v in variables.items()}
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/common.py#x1B[0m:302: in <dictcomp>
variables = {k: self.encode_variable(v) for k, v in variables.items()}
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/zarr.py#x1B[0m:598: in encode_variable
variable = encode_zarr_variable(variable)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/zarr.py#x1B[0m:314: in encode_zarr_variable
var = conventions.encode_cf_variable(var, name=name)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/conventions.py#x1B[0m:196: in encode_cf_variable
var = coder.encode(var, name=name)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:977: in encode
(data, units, calendar) = encode_cf_datetime(data, units, calendar, dtype)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:726: in encode_cf_datetime
return _eagerly_encode_cf_datetime(dates, units, calendar, dtype)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:738: in _eagerly_encode_cf_datetime
data_units = infer_datetime_units(dates)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:446: in infer_datetime_units
units = _infer_time_units_from_diff(unique_timedeltas)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:400: in _infer_time_units_from_diff
if np.all(unique_timedeltas % unit_timedelta(time_unit) == zero_timedelta):
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:384: in _unit_timedelta_numpy
numpy_units = _netcdf_to_numpy_timeunit(units)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
units = 'days'
def _netcdf_to_numpy_timeunit(units: str) -> NPDatetimeUnitOptions:
units = units.lower()
if not units.endswith("s"):
units = f"{units}s"
return cast(
> NPDatetimeUnitOptions,
{
"nanoseconds": "ns",
"microseconds": "us",
"milliseconds": "ms",
"seconds": "s",
"minutes": "m",
"hours": "h",
"days": "D",
}[units],
)
#x1B[1m#x1B[31mE NameError: name 'NPDatetimeUnitOptions' is not defined#x1B[0m
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:119: NameError
Check warning on line 0 in xarray.tests.test_backends.TestZarrWriteEmpty
github-actions / Test Results
5 out of 9 runs failed: test_auto_chunk (xarray.tests.test_backends.TestZarrWriteEmpty)
artifacts/Test results for Linux-3.12/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9 min-all-deps/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9/pytest.xml [took 0s]
artifacts/Test results for macOS-3.12/pytest.xml [took 0s]
artifacts/Test results for macOS-3.9/pytest.xml [took 0s]
Raw output
NameError: name 'NPDatetimeUnitOptions' is not defined
self = <xarray.tests.test_backends.TestZarrWriteEmpty object at 0x13d630d60>
@requires_dask
def test_auto_chunk(self) -> None:
original = create_test_data().chunk()
> with self.roundtrip(original, open_kwargs={"chunks": None}) as actual:
#x1B[1m#x1B[31m/Users/runner/work/xarray/xarray/xarray/tests/test_backends.py#x1B[0m:2159:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
#x1B[1m#x1B[31m/Users/runner/micromamba/envs/xarray-tests/lib/python3.9/contextlib.py#x1B[0m:119: in __enter__
return next(self.gen)
#x1B[1m#x1B[31m/Users/runner/work/xarray/xarray/xarray/tests/test_backends.py#x1B[0m:2106: in roundtrip
self.save(data, store_target, **save_kwargs)
#x1B[1m#x1B[31m/Users/runner/work/xarray/xarray/xarray/tests/test_backends.py#x1B[0m:2088: in save
return dataset.to_zarr(store=store_target, **kwargs, **self.version_kwargs)
#x1B[1m#x1B[31m/Users/runner/work/xarray/xarray/xarray/core/dataset.py#x1B[0m:2551: in to_zarr
return to_zarr( # type: ignore[call-overload,misc]
#x1B[1m#x1B[31m/Users/runner/work/xarray/xarray/xarray/backends/api.py#x1B[0m:1710: in to_zarr
dump_to_store(dataset, zstore, writer, encoding=encoding)
#x1B[1m#x1B[31m/Users/runner/work/xarray/xarray/xarray/backends/api.py#x1B[0m:1397: in dump_to_store
store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims)
#x1B[1m#x1B[31m/Users/runner/work/xarray/xarray/xarray/backends/zarr.py#x1B[0m:664: in store
variables_encoded, attributes = self.encode(
#x1B[1m#x1B[31m/Users/runner/work/xarray/xarray/xarray/backends/common.py#x1B[0m:302: in encode
variables = {k: self.encode_variable(v) for k, v in variables.items()}
#x1B[1m#x1B[31m/Users/runner/work/xarray/xarray/xarray/backends/common.py#x1B[0m:302: in <dictcomp>
variables = {k: self.encode_variable(v) for k, v in variables.items()}
#x1B[1m#x1B[31m/Users/runner/work/xarray/xarray/xarray/backends/zarr.py#x1B[0m:598: in encode_variable
variable = encode_zarr_variable(variable)
#x1B[1m#x1B[31m/Users/runner/work/xarray/xarray/xarray/backends/zarr.py#x1B[0m:314: in encode_zarr_variable
var = conventions.encode_cf_variable(var, name=name)
#x1B[1m#x1B[31m/Users/runner/work/xarray/xarray/xarray/conventions.py#x1B[0m:196: in encode_cf_variable
var = coder.encode(var, name=name)
#x1B[1m#x1B[31m/Users/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:977: in encode
(data, units, calendar) = encode_cf_datetime(data, units, calendar, dtype)
#x1B[1m#x1B[31m/Users/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:726: in encode_cf_datetime
return _eagerly_encode_cf_datetime(dates, units, calendar, dtype)
#x1B[1m#x1B[31m/Users/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:738: in _eagerly_encode_cf_datetime
data_units = infer_datetime_units(dates)
#x1B[1m#x1B[31m/Users/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:446: in infer_datetime_units
units = _infer_time_units_from_diff(unique_timedeltas)
#x1B[1m#x1B[31m/Users/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:400: in _infer_time_units_from_diff
if np.all(unique_timedeltas % unit_timedelta(time_unit) == zero_timedelta):
#x1B[1m#x1B[31m/Users/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:384: in _unit_timedelta_numpy
numpy_units = _netcdf_to_numpy_timeunit(units)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
units = 'days'
def _netcdf_to_numpy_timeunit(units: str) -> NPDatetimeUnitOptions:
units = units.lower()
if not units.endswith("s"):
units = f"{units}s"
return cast(
> NPDatetimeUnitOptions,
{
"nanoseconds": "ns",
"microseconds": "us",
"milliseconds": "ms",
"seconds": "s",
"minutes": "m",
"hours": "h",
"days": "D",
}[units],
)
#x1B[1m#x1B[31mE NameError: name 'NPDatetimeUnitOptions' is not defined#x1B[0m
#x1B[1m#x1B[31m/Users/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:119: NameError
Check warning on line 0 in xarray.tests.test_backends.TestZarrWriteEmpty
github-actions / Test Results
5 out of 9 runs failed: test_manual_chunk (xarray.tests.test_backends.TestZarrWriteEmpty)
artifacts/Test results for Linux-3.12/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9 min-all-deps/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9/pytest.xml [took 0s]
artifacts/Test results for macOS-3.12/pytest.xml [took 0s]
artifacts/Test results for macOS-3.9/pytest.xml [took 0s]
Raw output
NameError: name 'NPDatetimeUnitOptions' is not defined
self = <xarray.tests.test_backends.TestZarrWriteEmpty object at 0x13d6380d0>
@requires_dask
@pytest.mark.filterwarnings("ignore:The specified chunks separate:UserWarning")
def test_manual_chunk(self) -> None:
original = create_test_data().chunk({"dim1": 3, "dim2": 4, "dim3": 3})
# Using chunks = None should return non-chunked arrays
open_kwargs: dict[str, Any] = {"chunks": None}
> with self.roundtrip(original, open_kwargs=open_kwargs) as actual:
#x1B[1m#x1B[31m/Users/runner/work/xarray/xarray/xarray/tests/test_backends.py#x1B[0m:2180:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
#x1B[1m#x1B[31m/Users/runner/micromamba/envs/xarray-tests/lib/python3.9/contextlib.py#x1B[0m:119: in __enter__
return next(self.gen)
#x1B[1m#x1B[31m/Users/runner/work/xarray/xarray/xarray/tests/test_backends.py#x1B[0m:2106: in roundtrip
self.save(data, store_target, **save_kwargs)
#x1B[1m#x1B[31m/Users/runner/work/xarray/xarray/xarray/tests/test_backends.py#x1B[0m:2088: in save
return dataset.to_zarr(store=store_target, **kwargs, **self.version_kwargs)
#x1B[1m#x1B[31m/Users/runner/work/xarray/xarray/xarray/core/dataset.py#x1B[0m:2551: in to_zarr
return to_zarr( # type: ignore[call-overload,misc]
#x1B[1m#x1B[31m/Users/runner/work/xarray/xarray/xarray/backends/api.py#x1B[0m:1710: in to_zarr
dump_to_store(dataset, zstore, writer, encoding=encoding)
#x1B[1m#x1B[31m/Users/runner/work/xarray/xarray/xarray/backends/api.py#x1B[0m:1397: in dump_to_store
store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims)
#x1B[1m#x1B[31m/Users/runner/work/xarray/xarray/xarray/backends/zarr.py#x1B[0m:664: in store
variables_encoded, attributes = self.encode(
#x1B[1m#x1B[31m/Users/runner/work/xarray/xarray/xarray/backends/common.py#x1B[0m:302: in encode
variables = {k: self.encode_variable(v) for k, v in variables.items()}
#x1B[1m#x1B[31m/Users/runner/work/xarray/xarray/xarray/backends/common.py#x1B[0m:302: in <dictcomp>
variables = {k: self.encode_variable(v) for k, v in variables.items()}
#x1B[1m#x1B[31m/Users/runner/work/xarray/xarray/xarray/backends/zarr.py#x1B[0m:598: in encode_variable
variable = encode_zarr_variable(variable)
#x1B[1m#x1B[31m/Users/runner/work/xarray/xarray/xarray/backends/zarr.py#x1B[0m:314: in encode_zarr_variable
var = conventions.encode_cf_variable(var, name=name)
#x1B[1m#x1B[31m/Users/runner/work/xarray/xarray/xarray/conventions.py#x1B[0m:196: in encode_cf_variable
var = coder.encode(var, name=name)
#x1B[1m#x1B[31m/Users/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:977: in encode
(data, units, calendar) = encode_cf_datetime(data, units, calendar, dtype)
#x1B[1m#x1B[31m/Users/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:726: in encode_cf_datetime
return _eagerly_encode_cf_datetime(dates, units, calendar, dtype)
#x1B[1m#x1B[31m/Users/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:738: in _eagerly_encode_cf_datetime
data_units = infer_datetime_units(dates)
#x1B[1m#x1B[31m/Users/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:446: in infer_datetime_units
units = _infer_time_units_from_diff(unique_timedeltas)
#x1B[1m#x1B[31m/Users/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:400: in _infer_time_units_from_diff
if np.all(unique_timedeltas % unit_timedelta(time_unit) == zero_timedelta):
#x1B[1m#x1B[31m/Users/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:384: in _unit_timedelta_numpy
numpy_units = _netcdf_to_numpy_timeunit(units)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
units = 'days'
def _netcdf_to_numpy_timeunit(units: str) -> NPDatetimeUnitOptions:
units = units.lower()
if not units.endswith("s"):
units = f"{units}s"
return cast(
> NPDatetimeUnitOptions,
{
"nanoseconds": "ns",
"microseconds": "us",
"milliseconds": "ms",
"seconds": "s",
"minutes": "m",
"hours": "h",
"days": "D",
}[units],
)
#x1B[1m#x1B[31mE NameError: name 'NPDatetimeUnitOptions' is not defined#x1B[0m
#x1B[1m#x1B[31m/Users/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:119: NameError
Check warning on line 0 in xarray.tests.test_backends.TestZarrWriteEmpty
github-actions / Test Results
5 out of 9 runs failed: test_warning_on_bad_chunks (xarray.tests.test_backends.TestZarrWriteEmpty)
artifacts/Test results for Linux-3.12/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9 min-all-deps/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9/pytest.xml [took 0s]
artifacts/Test results for macOS-3.12/pytest.xml [took 0s]
artifacts/Test results for macOS-3.9/pytest.xml [took 0s]
Raw output
Failed: DID NOT WARN. No warnings of type (<class 'UserWarning'>,) were emitted.
Emitted warnings: [].
self = <xarray.tests.test_backends.TestZarrWriteEmpty object at 0x13d638280>
@requires_dask
def test_warning_on_bad_chunks(self) -> None:
original = create_test_data().chunk({"dim1": 4, "dim2": 3, "dim3": 3})
bad_chunks = (2, {"dim2": (3, 3, 2, 1)})
for chunks in bad_chunks:
kwargs = {"chunks": chunks}
with pytest.warns(UserWarning):
> with self.roundtrip(original, open_kwargs=kwargs) as actual:
#x1B[1m#x1B[31m/Users/runner/work/xarray/xarray/xarray/tests/test_backends.py#x1B[0m:2225:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
#x1B[1m#x1B[31m/Users/runner/micromamba/envs/xarray-tests/lib/python3.9/contextlib.py#x1B[0m:119: in __enter__
return next(self.gen)
#x1B[1m#x1B[31m/Users/runner/work/xarray/xarray/xarray/tests/test_backends.py#x1B[0m:2106: in roundtrip
self.save(data, store_target, **save_kwargs)
#x1B[1m#x1B[31m/Users/runner/work/xarray/xarray/xarray/tests/test_backends.py#x1B[0m:2088: in save
return dataset.to_zarr(store=store_target, **kwargs, **self.version_kwargs)
#x1B[1m#x1B[31m/Users/runner/work/xarray/xarray/xarray/core/dataset.py#x1B[0m:2551: in to_zarr
return to_zarr( # type: ignore[call-overload,misc]
#x1B[1m#x1B[31m/Users/runner/work/xarray/xarray/xarray/backends/api.py#x1B[0m:1710: in to_zarr
dump_to_store(dataset, zstore, writer, encoding=encoding)
#x1B[1m#x1B[31m/Users/runner/work/xarray/xarray/xarray/backends/api.py#x1B[0m:1397: in dump_to_store
store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims)
#x1B[1m#x1B[31m/Users/runner/work/xarray/xarray/xarray/backends/zarr.py#x1B[0m:664: in store
variables_encoded, attributes = self.encode(
#x1B[1m#x1B[31m/Users/runner/work/xarray/xarray/xarray/backends/common.py#x1B[0m:302: in encode
variables = {k: self.encode_variable(v) for k, v in variables.items()}
#x1B[1m#x1B[31m/Users/runner/work/xarray/xarray/xarray/backends/common.py#x1B[0m:302: in <dictcomp>
variables = {k: self.encode_variable(v) for k, v in variables.items()}
#x1B[1m#x1B[31m/Users/runner/work/xarray/xarray/xarray/backends/zarr.py#x1B[0m:598: in encode_variable
variable = encode_zarr_variable(variable)
#x1B[1m#x1B[31m/Users/runner/work/xarray/xarray/xarray/backends/zarr.py#x1B[0m:314: in encode_zarr_variable
var = conventions.encode_cf_variable(var, name=name)
#x1B[1m#x1B[31m/Users/runner/work/xarray/xarray/xarray/conventions.py#x1B[0m:196: in encode_cf_variable
var = coder.encode(var, name=name)
#x1B[1m#x1B[31m/Users/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:977: in encode
(data, units, calendar) = encode_cf_datetime(data, units, calendar, dtype)
#x1B[1m#x1B[31m/Users/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:726: in encode_cf_datetime
return _eagerly_encode_cf_datetime(dates, units, calendar, dtype)
#x1B[1m#x1B[31m/Users/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:738: in _eagerly_encode_cf_datetime
data_units = infer_datetime_units(dates)
#x1B[1m#x1B[31m/Users/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:446: in infer_datetime_units
units = _infer_time_units_from_diff(unique_timedeltas)
#x1B[1m#x1B[31m/Users/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:400: in _infer_time_units_from_diff
if np.all(unique_timedeltas % unit_timedelta(time_unit) == zero_timedelta):
#x1B[1m#x1B[31m/Users/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:384: in _unit_timedelta_numpy
numpy_units = _netcdf_to_numpy_timeunit(units)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
units = 'days'
def _netcdf_to_numpy_timeunit(units: str) -> NPDatetimeUnitOptions:
units = units.lower()
if not units.endswith("s"):
units = f"{units}s"
return cast(
> NPDatetimeUnitOptions,
{
"nanoseconds": "ns",
"microseconds": "us",
"milliseconds": "ms",
"seconds": "s",
"minutes": "m",
"hours": "h",
"days": "D",
}[units],
)
#x1B[1m#x1B[31mE NameError: name 'NPDatetimeUnitOptions' is not defined#x1B[0m
#x1B[1m#x1B[31m/Users/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:119: NameError
#x1B[33mDuring handling of the above exception, another exception occurred:#x1B[0m
self = <xarray.tests.test_backends.TestZarrWriteEmpty object at 0x13d638280>
@requires_dask
def test_warning_on_bad_chunks(self) -> None:
original = create_test_data().chunk({"dim1": 4, "dim2": 3, "dim3": 3})
bad_chunks = (2, {"dim2": (3, 3, 2, 1)})
for chunks in bad_chunks:
kwargs = {"chunks": chunks}
with pytest.warns(UserWarning):
with self.roundtrip(original, open_kwargs=kwargs) as actual:
for k, v in actual.variables.items():
# only index variables should be in memory
> assert v._in_memory == (k in actual.dims)
#x1B[1m#x1B[31mE Failed: DID NOT WARN. No warnings of type (<class 'UserWarning'>,) were emitted.#x1B[0m
#x1B[1m#x1B[31mE Emitted warnings: [].#x1B[0m
#x1B[1m#x1B[31m/Users/runner/work/xarray/xarray/xarray/tests/test_backends.py#x1B[0m:2228: Failed
Check warning on line 0 in xarray.tests.test_backends.TestZarrWriteEmpty
github-actions / Test Results
5 out of 9 runs failed: test_deprecate_auto_chunk (xarray.tests.test_backends.TestZarrWriteEmpty)
artifacts/Test results for Linux-3.12/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9 min-all-deps/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9/pytest.xml [took 0s]
artifacts/Test results for macOS-3.12/pytest.xml [took 0s]
artifacts/Test results for macOS-3.9/pytest.xml [took 0s]
Raw output
NameError: name 'NPDatetimeUnitOptions' is not defined
self = <xarray.tests.test_backends.TestZarrWriteEmpty object at 0x13d6384f0>
@requires_dask
def test_deprecate_auto_chunk(self) -> None:
original = create_test_data().chunk()
with pytest.raises(TypeError):
> with self.roundtrip(original, open_kwargs={"auto_chunk": True}) as actual:
#x1B[1m#x1B[31m/Users/runner/work/xarray/xarray/xarray/tests/test_backends.py#x1B[0m:2243:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
#x1B[1m#x1B[31m/Users/runner/micromamba/envs/xarray-tests/lib/python3.9/contextlib.py#x1B[0m:119: in __enter__
return next(self.gen)
#x1B[1m#x1B[31m/Users/runner/work/xarray/xarray/xarray/tests/test_backends.py#x1B[0m:2106: in roundtrip
self.save(data, store_target, **save_kwargs)
#x1B[1m#x1B[31m/Users/runner/work/xarray/xarray/xarray/tests/test_backends.py#x1B[0m:2088: in save
return dataset.to_zarr(store=store_target, **kwargs, **self.version_kwargs)
#x1B[1m#x1B[31m/Users/runner/work/xarray/xarray/xarray/core/dataset.py#x1B[0m:2551: in to_zarr
return to_zarr( # type: ignore[call-overload,misc]
#x1B[1m#x1B[31m/Users/runner/work/xarray/xarray/xarray/backends/api.py#x1B[0m:1710: in to_zarr
dump_to_store(dataset, zstore, writer, encoding=encoding)
#x1B[1m#x1B[31m/Users/runner/work/xarray/xarray/xarray/backends/api.py#x1B[0m:1397: in dump_to_store
store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims)
#x1B[1m#x1B[31m/Users/runner/work/xarray/xarray/xarray/backends/zarr.py#x1B[0m:664: in store
variables_encoded, attributes = self.encode(
#x1B[1m#x1B[31m/Users/runner/work/xarray/xarray/xarray/backends/common.py#x1B[0m:302: in encode
variables = {k: self.encode_variable(v) for k, v in variables.items()}
#x1B[1m#x1B[31m/Users/runner/work/xarray/xarray/xarray/backends/common.py#x1B[0m:302: in <dictcomp>
variables = {k: self.encode_variable(v) for k, v in variables.items()}
#x1B[1m#x1B[31m/Users/runner/work/xarray/xarray/xarray/backends/zarr.py#x1B[0m:598: in encode_variable
variable = encode_zarr_variable(variable)
#x1B[1m#x1B[31m/Users/runner/work/xarray/xarray/xarray/backends/zarr.py#x1B[0m:314: in encode_zarr_variable
var = conventions.encode_cf_variable(var, name=name)
#x1B[1m#x1B[31m/Users/runner/work/xarray/xarray/xarray/conventions.py#x1B[0m:196: in encode_cf_variable
var = coder.encode(var, name=name)
#x1B[1m#x1B[31m/Users/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:977: in encode
(data, units, calendar) = encode_cf_datetime(data, units, calendar, dtype)
#x1B[1m#x1B[31m/Users/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:726: in encode_cf_datetime
return _eagerly_encode_cf_datetime(dates, units, calendar, dtype)
#x1B[1m#x1B[31m/Users/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:738: in _eagerly_encode_cf_datetime
data_units = infer_datetime_units(dates)
#x1B[1m#x1B[31m/Users/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:446: in infer_datetime_units
units = _infer_time_units_from_diff(unique_timedeltas)
#x1B[1m#x1B[31m/Users/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:400: in _infer_time_units_from_diff
if np.all(unique_timedeltas % unit_timedelta(time_unit) == zero_timedelta):
#x1B[1m#x1B[31m/Users/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:384: in _unit_timedelta_numpy
numpy_units = _netcdf_to_numpy_timeunit(units)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
units = 'days'
def _netcdf_to_numpy_timeunit(units: str) -> NPDatetimeUnitOptions:
units = units.lower()
if not units.endswith("s"):
units = f"{units}s"
return cast(
> NPDatetimeUnitOptions,
{
"nanoseconds": "ns",
"microseconds": "us",
"milliseconds": "ms",
"seconds": "s",
"minutes": "m",
"hours": "h",
"days": "D",
}[units],
)
#x1B[1m#x1B[31mE NameError: name 'NPDatetimeUnitOptions' is not defined#x1B[0m
#x1B[1m#x1B[31m/Users/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:119: NameError
Check warning on line 0 in xarray.tests.test_backends.TestZarrWriteEmpty
github-actions / Test Results
5 out of 9 runs failed: test_write_uneven_dask_chunks (xarray.tests.test_backends.TestZarrWriteEmpty)
artifacts/Test results for Linux-3.12/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9 min-all-deps/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9/pytest.xml [took 0s]
artifacts/Test results for macOS-3.12/pytest.xml [took 0s]
artifacts/Test results for macOS-3.9/pytest.xml [took 0s]
Raw output
NameError: name 'NPDatetimeUnitOptions' is not defined
self = <xarray.tests.test_backends.TestZarrWriteEmpty object at 0x13d638760>
@requires_dask
def test_write_uneven_dask_chunks(self) -> None:
# regression for GH#2225
original = create_test_data().chunk({"dim1": 3, "dim2": 4, "dim3": 3})
> with self.roundtrip(original, open_kwargs={"chunks": {}}) as actual:
#x1B[1m#x1B[31m/Users/runner/work/xarray/xarray/xarray/tests/test_backends.py#x1B[0m:2262:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
#x1B[1m#x1B[31m/Users/runner/micromamba/envs/xarray-tests/lib/python3.9/contextlib.py#x1B[0m:119: in __enter__
return next(self.gen)
#x1B[1m#x1B[31m/Users/runner/work/xarray/xarray/xarray/tests/test_backends.py#x1B[0m:2106: in roundtrip
self.save(data, store_target, **save_kwargs)
#x1B[1m#x1B[31m/Users/runner/work/xarray/xarray/xarray/tests/test_backends.py#x1B[0m:2088: in save
return dataset.to_zarr(store=store_target, **kwargs, **self.version_kwargs)
#x1B[1m#x1B[31m/Users/runner/work/xarray/xarray/xarray/core/dataset.py#x1B[0m:2551: in to_zarr
return to_zarr( # type: ignore[call-overload,misc]
#x1B[1m#x1B[31m/Users/runner/work/xarray/xarray/xarray/backends/api.py#x1B[0m:1710: in to_zarr
dump_to_store(dataset, zstore, writer, encoding=encoding)
#x1B[1m#x1B[31m/Users/runner/work/xarray/xarray/xarray/backends/api.py#x1B[0m:1397: in dump_to_store
store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims)
#x1B[1m#x1B[31m/Users/runner/work/xarray/xarray/xarray/backends/zarr.py#x1B[0m:664: in store
variables_encoded, attributes = self.encode(
#x1B[1m#x1B[31m/Users/runner/work/xarray/xarray/xarray/backends/common.py#x1B[0m:302: in encode
variables = {k: self.encode_variable(v) for k, v in variables.items()}
#x1B[1m#x1B[31m/Users/runner/work/xarray/xarray/xarray/backends/common.py#x1B[0m:302: in <dictcomp>
variables = {k: self.encode_variable(v) for k, v in variables.items()}
#x1B[1m#x1B[31m/Users/runner/work/xarray/xarray/xarray/backends/zarr.py#x1B[0m:598: in encode_variable
variable = encode_zarr_variable(variable)
#x1B[1m#x1B[31m/Users/runner/work/xarray/xarray/xarray/backends/zarr.py#x1B[0m:314: in encode_zarr_variable
var = conventions.encode_cf_variable(var, name=name)
#x1B[1m#x1B[31m/Users/runner/work/xarray/xarray/xarray/conventions.py#x1B[0m:196: in encode_cf_variable
var = coder.encode(var, name=name)
#x1B[1m#x1B[31m/Users/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:977: in encode
(data, units, calendar) = encode_cf_datetime(data, units, calendar, dtype)
#x1B[1m#x1B[31m/Users/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:726: in encode_cf_datetime
return _eagerly_encode_cf_datetime(dates, units, calendar, dtype)
#x1B[1m#x1B[31m/Users/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:738: in _eagerly_encode_cf_datetime
data_units = infer_datetime_units(dates)
#x1B[1m#x1B[31m/Users/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:446: in infer_datetime_units
units = _infer_time_units_from_diff(unique_timedeltas)
#x1B[1m#x1B[31m/Users/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:400: in _infer_time_units_from_diff
if np.all(unique_timedeltas % unit_timedelta(time_unit) == zero_timedelta):
#x1B[1m#x1B[31m/Users/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:384: in _unit_timedelta_numpy
numpy_units = _netcdf_to_numpy_timeunit(units)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
units = 'days'
def _netcdf_to_numpy_timeunit(units: str) -> NPDatetimeUnitOptions:
units = units.lower()
if not units.endswith("s"):
units = f"{units}s"
return cast(
> NPDatetimeUnitOptions,
{
"nanoseconds": "ns",
"microseconds": "us",
"milliseconds": "ms",
"seconds": "s",
"minutes": "m",
"hours": "h",
"days": "D",
}[units],
)
#x1B[1m#x1B[31mE NameError: name 'NPDatetimeUnitOptions' is not defined#x1B[0m
#x1B[1m#x1B[31m/Users/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:119: NameError
Check warning on line 0 in xarray.tests.test_backends.TestZarrWriteEmpty
github-actions / Test Results
6 out of 9 runs failed: test_chunk_encoding (xarray.tests.test_backends.TestZarrWriteEmpty)
artifacts/Test results for Linux-3.11 all-but-dask/pytest.xml [took 0s]
artifacts/Test results for Linux-3.12/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9 min-all-deps/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9/pytest.xml [took 0s]
artifacts/Test results for macOS-3.12/pytest.xml [took 0s]
artifacts/Test results for macOS-3.9/pytest.xml [took 0s]
Raw output
NameError: name 'NPDatetimeUnitOptions' is not defined
self = <xarray.tests.test_backends.TestZarrWriteEmpty object at 0x7f7ef74aac50>
def test_chunk_encoding(self) -> None:
# These datasets have no dask chunks. All chunking specified in
# encoding
data = create_test_data()
chunks = (5, 5)
data["var2"].encoding.update({"chunks": chunks})
> with self.roundtrip(data) as actual:
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/tests/test_backends.py#x1B[0m:2273:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
#x1B[1m#x1B[31m/home/runner/micromamba/envs/xarray-tests/lib/python3.11/contextlib.py#x1B[0m:137: in __enter__
return next(self.gen)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/tests/test_backends.py#x1B[0m:2106: in roundtrip
self.save(data, store_target, **save_kwargs)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/tests/test_backends.py#x1B[0m:2088: in save
return dataset.to_zarr(store=store_target, **kwargs, **self.version_kwargs)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/dataset.py#x1B[0m:2551: in to_zarr
return to_zarr( # type: ignore[call-overload,misc]
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/api.py#x1B[0m:1710: in to_zarr
dump_to_store(dataset, zstore, writer, encoding=encoding)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/api.py#x1B[0m:1397: in dump_to_store
store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/zarr.py#x1B[0m:664: in store
variables_encoded, attributes = self.encode(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/common.py#x1B[0m:302: in encode
variables = {k: self.encode_variable(v) for k, v in variables.items()}
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/common.py#x1B[0m:302: in <dictcomp>
variables = {k: self.encode_variable(v) for k, v in variables.items()}
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/zarr.py#x1B[0m:598: in encode_variable
variable = encode_zarr_variable(variable)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/zarr.py#x1B[0m:314: in encode_zarr_variable
var = conventions.encode_cf_variable(var, name=name)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/conventions.py#x1B[0m:196: in encode_cf_variable
var = coder.encode(var, name=name)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:977: in encode
(data, units, calendar) = encode_cf_datetime(data, units, calendar, dtype)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:726: in encode_cf_datetime
return _eagerly_encode_cf_datetime(dates, units, calendar, dtype)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:738: in _eagerly_encode_cf_datetime
data_units = infer_datetime_units(dates)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:446: in infer_datetime_units
units = _infer_time_units_from_diff(unique_timedeltas)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:400: in _infer_time_units_from_diff
if np.all(unique_timedeltas % unit_timedelta(time_unit) == zero_timedelta):
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:384: in _unit_timedelta_numpy
numpy_units = _netcdf_to_numpy_timeunit(units)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
units = 'days'
def _netcdf_to_numpy_timeunit(units: str) -> NPDatetimeUnitOptions:
units = units.lower()
if not units.endswith("s"):
units = f"{units}s"
return cast(
> NPDatetimeUnitOptions,
{
"nanoseconds": "ns",
"microseconds": "us",
"milliseconds": "ms",
"seconds": "s",
"minutes": "m",
"hours": "h",
"days": "D",
}[units],
)
#x1B[1m#x1B[31mE NameError: name 'NPDatetimeUnitOptions' is not defined#x1B[0m
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:119: NameError
Check warning on line 0 in xarray.tests.test_backends.TestZarrWriteEmpty
github-actions / Test Results
6 out of 9 runs failed: test_drop_encoding (xarray.tests.test_backends.TestZarrWriteEmpty)
artifacts/Test results for Linux-3.11 all-but-dask/pytest.xml [took 0s]
artifacts/Test results for Linux-3.12/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9 min-all-deps/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9/pytest.xml [took 0s]
artifacts/Test results for macOS-3.12/pytest.xml [took 0s]
artifacts/Test results for macOS-3.9/pytest.xml [took 0s]
Raw output
ValueError: Failed to decode variable 'time': unable to decode time units 'hours since 1996-1-1' with 'the default calendar'. Try opening your dataset with decode_times=False or installing cftime if it is not installed.
data = LazilyIndexedArray(array=<xarray.backends.netCDF4_.NetCDF4ArrayWrapper object at 0x7f7ef2aea480>, key=BasicIndexer((slice(None, None, None),)))
units = 'hours since 1996-1-1', calendar = None, use_cftime = None
def _decode_cf_datetime_dtype(
data, units: str, calendar: str, use_cftime: bool | None
) -> np.dtype:
# Verify that at least the first and last date can be decoded
# successfully. Otherwise, tracebacks end up swallowed by
# Dataset.__repr__ when users try to view their lazily decoded array.
values = indexing.ImplicitToExplicitIndexingAdapter(indexing.as_indexable(data))
example_value = np.concatenate(
[first_n_items(values, 1) or [0], last_item(values) or [0]]
)
try:
> result = decode_cf_datetime(example_value, units, calendar, use_cftime)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:219:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:327: in decode_cf_datetime
dates = _decode_datetime_with_pandas(flat_num_dates, units, calendar)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:259: in _decode_datetime_with_pandas
time_units = _netcdf_to_numpy_timeunit(time_units)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
units = 'hours'
def _netcdf_to_numpy_timeunit(units: str) -> NPDatetimeUnitOptions:
units = units.lower()
if not units.endswith("s"):
units = f"{units}s"
return cast(
> NPDatetimeUnitOptions,
{
"nanoseconds": "ns",
"microseconds": "us",
"milliseconds": "ms",
"seconds": "s",
"minutes": "m",
"hours": "h",
"days": "D",
}[units],
)
#x1B[1m#x1B[31mE NameError: name 'NPDatetimeUnitOptions' is not defined#x1B[0m
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:119: NameError
#x1B[33mDuring handling of the above exception, another exception occurred:#x1B[0m
variables = Frozen({'temp': <xarray.Variable (time: 1, level: 4, lat: 5, lon: 10)> Size: 800B
[200 values with dtype=float32]
Attr...ime': <xarray.Variable (time: 1)> Size: 2B
[1 values with dtype=int16]
Attributes:
units: hours since 1996-1-1})
attributes = Frozen({'source': 'Fictional Model Output'})
concat_characters = True, mask_and_scale = True, decode_times = True
decode_coords = True, drop_variables = set(), use_cftime = None
decode_timedelta = None
def decode_cf_variables(
variables: T_Variables,
attributes: T_Attrs,
concat_characters: bool = True,
mask_and_scale: bool = True,
decode_times: bool = True,
decode_coords: bool | Literal["coordinates", "all"] = True,
drop_variables: T_DropVariables = None,
use_cftime: bool | None = None,
decode_timedelta: bool | None = None,
) -> tuple[T_Variables, T_Attrs, set[Hashable]]:
"""
Decode several CF encoded variables.
See: decode_cf_variable
"""
dimensions_used_by = defaultdict(list)
for v in variables.values():
for d in v.dims:
dimensions_used_by[d].append(v)
def stackable(dim: Hashable) -> bool:
# figure out if a dimension can be concatenated over
if dim in variables:
return False
for v in dimensions_used_by[dim]:
if v.dtype.kind != "S" or dim != v.dims[-1]:
return False
return True
coord_names = set()
if isinstance(drop_variables, str):
drop_variables = [drop_variables]
elif drop_variables is None:
drop_variables = []
drop_variables = set(drop_variables)
# Time bounds coordinates might miss the decoding attributes
if decode_times:
_update_bounds_attributes(variables)
new_vars = {}
for k, v in variables.items():
if k in drop_variables:
continue
stack_char_dim = (
concat_characters
and v.dtype == "S1"
and v.ndim > 0
and stackable(v.dims[-1])
)
try:
> new_vars[k] = decode_cf_variable(
k,
v,
concat_characters=concat_characters,
mask_and_scale=mask_and_scale,
decode_times=decode_times,
stack_char_dim=stack_char_dim,
use_cftime=use_cftime,
decode_timedelta=decode_timedelta,
)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/conventions.py#x1B[0m:440:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/conventions.py#x1B[0m:291: in decode_cf_variable
var = times.CFDatetimeCoder(use_cftime=use_cftime).decode(var, name=name)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:993: in decode
dtype = _decode_cf_datetime_dtype(data, units, calendar, self.use_cftime)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
data = LazilyIndexedArray(array=<xarray.backends.netCDF4_.NetCDF4ArrayWrapper object at 0x7f7ef2aea480>, key=BasicIndexer((slice(None, None, None),)))
units = 'hours since 1996-1-1', calendar = None, use_cftime = None
def _decode_cf_datetime_dtype(
data, units: str, calendar: str, use_cftime: bool | None
) -> np.dtype:
# Verify that at least the first and last date can be decoded
# successfully. Otherwise, tracebacks end up swallowed by
# Dataset.__repr__ when users try to view their lazily decoded array.
values = indexing.ImplicitToExplicitIndexingAdapter(indexing.as_indexable(data))
example_value = np.concatenate(
[first_n_items(values, 1) or [0], last_item(values) or [0]]
)
try:
result = decode_cf_datetime(example_value, units, calendar, use_cftime)
except Exception:
calendar_msg = (
"the default calendar" if calendar is None else f"calendar {calendar!r}"
)
msg = (
f"unable to decode time units {units!r} with {calendar_msg!r}. Try "
"opening your dataset with decode_times=False or installing cftime "
"if it is not installed."
)
> raise ValueError(msg)
#x1B[1m#x1B[31mE ValueError: unable to decode time units 'hours since 1996-1-1' with 'the default calendar'. Try opening your dataset with decode_times=False or installing cftime if it is not installed.#x1B[0m
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:229: ValueError
#x1B[33mThe above exception was the direct cause of the following exception:#x1B[0m
self = <xarray.tests.test_backends.TestZarrWriteEmpty object at 0x7f7ef74a8c90>
def test_drop_encoding(self):
> with open_example_dataset("example_1.nc") as ds:
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/tests/test_backends.py#x1B[0m:2368:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/tests/test_backends.py#x1B[0m:132: in open_example_dataset
return open_dataset(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/api.py#x1B[0m:578: in open_dataset
backend_ds = backend.open_dataset(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/netCDF4_.py#x1B[0m:659: in open_dataset
ds = store_entrypoint.open_dataset(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/store.py#x1B[0m:46: in open_dataset
vars, attrs, coord_names = conventions.decode_cf_variables(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
variables = Frozen({'temp': <xarray.Variable (time: 1, level: 4, lat: 5, lon: 10)> Size: 800B
[200 values with dtype=float32]
Attr...ime': <xarray.Variable (time: 1)> Size: 2B
[1 values with dtype=int16]
Attributes:
units: hours since 1996-1-1})
attributes = Frozen({'source': 'Fictional Model Output'})
concat_characters = True, mask_and_scale = True, decode_times = True
decode_coords = True, drop_variables = set(), use_cftime = None
decode_timedelta = None
def decode_cf_variables(
variables: T_Variables,
attributes: T_Attrs,
concat_characters: bool = True,
mask_and_scale: bool = True,
decode_times: bool = True,
decode_coords: bool | Literal["coordinates", "all"] = True,
drop_variables: T_DropVariables = None,
use_cftime: bool | None = None,
decode_timedelta: bool | None = None,
) -> tuple[T_Variables, T_Attrs, set[Hashable]]:
"""
Decode several CF encoded variables.
See: decode_cf_variable
"""
dimensions_used_by = defaultdict(list)
for v in variables.values():
for d in v.dims:
dimensions_used_by[d].append(v)
def stackable(dim: Hashable) -> bool:
# figure out if a dimension can be concatenated over
if dim in variables:
return False
for v in dimensions_used_by[dim]:
if v.dtype.kind != "S" or dim != v.dims[-1]:
return False
return True
coord_names = set()
if isinstance(drop_variables, str):
drop_variables = [drop_variables]
elif drop_variables is None:
drop_variables = []
drop_variables = set(drop_variables)
# Time bounds coordinates might miss the decoding attributes
if decode_times:
_update_bounds_attributes(variables)
new_vars = {}
for k, v in variables.items():
if k in drop_variables:
continue
stack_char_dim = (
concat_characters
and v.dtype == "S1"
and v.ndim > 0
and stackable(v.dims[-1])
)
try:
new_vars[k] = decode_cf_variable(
k,
v,
concat_characters=concat_characters,
mask_and_scale=mask_and_scale,
decode_times=decode_times,
stack_char_dim=stack_char_dim,
use_cftime=use_cftime,
decode_timedelta=decode_timedelta,
)
except Exception as e:
> raise type(e)(f"Failed to decode variable {k!r}: {e}") from e
#x1B[1m#x1B[31mE ValueError: Failed to decode variable 'time': unable to decode time units 'hours since 1996-1-1' with 'the default calendar'. Try opening your dataset with decode_times=False or installing cftime if it is not installed.#x1B[0m
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/conventions.py#x1B[0m:451: ValueError
Check warning on line 0 in xarray.tests.test_backends.TestZarrWriteEmpty
github-actions / Test Results
6 out of 9 runs failed: test_hidden_zarr_keys (xarray.tests.test_backends.TestZarrWriteEmpty)
artifacts/Test results for Linux-3.11 all-but-dask/pytest.xml [took 0s]
artifacts/Test results for Linux-3.12/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9 min-all-deps/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9/pytest.xml [took 0s]
artifacts/Test results for macOS-3.12/pytest.xml [took 0s]
artifacts/Test results for macOS-3.9/pytest.xml [took 0s]
Raw output
NameError: name 'NPDatetimeUnitOptions' is not defined
self = <xarray.tests.test_backends.TestZarrWriteEmpty object at 0x7f7ef74a9410>
def test_hidden_zarr_keys(self) -> None:
expected = create_test_data()
with self.create_store() as store:
> expected.dump_to_store(store)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/tests/test_backends.py#x1B[0m:2376:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/dataset.py#x1B[0m:2168: in dump_to_store
dump_to_store(self, store, **kwargs)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/api.py#x1B[0m:1397: in dump_to_store
store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/zarr.py#x1B[0m:664: in store
variables_encoded, attributes = self.encode(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/common.py#x1B[0m:302: in encode
variables = {k: self.encode_variable(v) for k, v in variables.items()}
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/common.py#x1B[0m:302: in <dictcomp>
variables = {k: self.encode_variable(v) for k, v in variables.items()}
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/zarr.py#x1B[0m:598: in encode_variable
variable = encode_zarr_variable(variable)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/zarr.py#x1B[0m:314: in encode_zarr_variable
var = conventions.encode_cf_variable(var, name=name)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/conventions.py#x1B[0m:196: in encode_cf_variable
var = coder.encode(var, name=name)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:977: in encode
(data, units, calendar) = encode_cf_datetime(data, units, calendar, dtype)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:726: in encode_cf_datetime
return _eagerly_encode_cf_datetime(dates, units, calendar, dtype)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:738: in _eagerly_encode_cf_datetime
data_units = infer_datetime_units(dates)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:446: in infer_datetime_units
units = _infer_time_units_from_diff(unique_timedeltas)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:400: in _infer_time_units_from_diff
if np.all(unique_timedeltas % unit_timedelta(time_unit) == zero_timedelta):
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:384: in _unit_timedelta_numpy
numpy_units = _netcdf_to_numpy_timeunit(units)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
units = 'days'
def _netcdf_to_numpy_timeunit(units: str) -> NPDatetimeUnitOptions:
units = units.lower()
if not units.endswith("s"):
units = f"{units}s"
return cast(
> NPDatetimeUnitOptions,
{
"nanoseconds": "ns",
"microseconds": "us",
"milliseconds": "ms",
"seconds": "s",
"minutes": "m",
"hours": "h",
"days": "D",
}[units],
)
#x1B[1m#x1B[31mE NameError: name 'NPDatetimeUnitOptions' is not defined#x1B[0m
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:119: NameError
Check warning on line 0 in xarray.tests.test_backends.TestZarrWriteEmpty
github-actions / Test Results
6 out of 9 runs failed: test_write_persistence_modes[None] (xarray.tests.test_backends.TestZarrWriteEmpty)
artifacts/Test results for Linux-3.11 all-but-dask/pytest.xml [took 0s]
artifacts/Test results for Linux-3.12/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9 min-all-deps/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9/pytest.xml [took 0s]
artifacts/Test results for macOS-3.12/pytest.xml [took 0s]
artifacts/Test results for macOS-3.9/pytest.xml [took 0s]
Raw output
NameError: name 'NPDatetimeUnitOptions' is not defined
self = <xarray.tests.test_backends.TestZarrWriteEmpty object at 0x7f7ef74aaa10>
group = None
@pytest.mark.parametrize("group", [None, "group1"])
def test_write_persistence_modes(self, group) -> None:
original = create_test_data()
# overwrite mode
> with self.roundtrip(
original,
save_kwargs={"mode": "w", "group": group},
open_kwargs={"group": group},
) as actual:
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/tests/test_backends.py#x1B[0m:2402:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
#x1B[1m#x1B[31m/home/runner/micromamba/envs/xarray-tests/lib/python3.11/contextlib.py#x1B[0m:137: in __enter__
return next(self.gen)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/tests/test_backends.py#x1B[0m:2106: in roundtrip
self.save(data, store_target, **save_kwargs)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/tests/test_backends.py#x1B[0m:2088: in save
return dataset.to_zarr(store=store_target, **kwargs, **self.version_kwargs)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/dataset.py#x1B[0m:2551: in to_zarr
return to_zarr( # type: ignore[call-overload,misc]
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/api.py#x1B[0m:1710: in to_zarr
dump_to_store(dataset, zstore, writer, encoding=encoding)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/api.py#x1B[0m:1397: in dump_to_store
store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/zarr.py#x1B[0m:664: in store
variables_encoded, attributes = self.encode(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/common.py#x1B[0m:302: in encode
variables = {k: self.encode_variable(v) for k, v in variables.items()}
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/common.py#x1B[0m:302: in <dictcomp>
variables = {k: self.encode_variable(v) for k, v in variables.items()}
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/zarr.py#x1B[0m:598: in encode_variable
variable = encode_zarr_variable(variable)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/zarr.py#x1B[0m:314: in encode_zarr_variable
var = conventions.encode_cf_variable(var, name=name)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/conventions.py#x1B[0m:196: in encode_cf_variable
var = coder.encode(var, name=name)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:977: in encode
(data, units, calendar) = encode_cf_datetime(data, units, calendar, dtype)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:726: in encode_cf_datetime
return _eagerly_encode_cf_datetime(dates, units, calendar, dtype)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:738: in _eagerly_encode_cf_datetime
data_units = infer_datetime_units(dates)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:446: in infer_datetime_units
units = _infer_time_units_from_diff(unique_timedeltas)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:400: in _infer_time_units_from_diff
if np.all(unique_timedeltas % unit_timedelta(time_unit) == zero_timedelta):
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:384: in _unit_timedelta_numpy
numpy_units = _netcdf_to_numpy_timeunit(units)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
units = 'days'
def _netcdf_to_numpy_timeunit(units: str) -> NPDatetimeUnitOptions:
units = units.lower()
if not units.endswith("s"):
units = f"{units}s"
return cast(
> NPDatetimeUnitOptions,
{
"nanoseconds": "ns",
"microseconds": "us",
"milliseconds": "ms",
"seconds": "s",
"minutes": "m",
"hours": "h",
"days": "D",
}[units],
)
#x1B[1m#x1B[31mE NameError: name 'NPDatetimeUnitOptions' is not defined#x1B[0m
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:119: NameError
Check warning on line 0 in xarray.tests.test_backends.TestZarrWriteEmpty
github-actions / Test Results
6 out of 9 runs failed: test_write_persistence_modes[group1] (xarray.tests.test_backends.TestZarrWriteEmpty)
artifacts/Test results for Linux-3.11 all-but-dask/pytest.xml [took 0s]
artifacts/Test results for Linux-3.12/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9 min-all-deps/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9/pytest.xml [took 0s]
artifacts/Test results for macOS-3.12/pytest.xml [took 0s]
artifacts/Test results for macOS-3.9/pytest.xml [took 0s]
Raw output
NameError: name 'NPDatetimeUnitOptions' is not defined
self = <xarray.tests.test_backends.TestZarrWriteEmpty object at 0x7f7ef74aab90>
group = 'group1'
@pytest.mark.parametrize("group", [None, "group1"])
def test_write_persistence_modes(self, group) -> None:
original = create_test_data()
# overwrite mode
> with self.roundtrip(
original,
save_kwargs={"mode": "w", "group": group},
open_kwargs={"group": group},
) as actual:
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/tests/test_backends.py#x1B[0m:2402:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
#x1B[1m#x1B[31m/home/runner/micromamba/envs/xarray-tests/lib/python3.11/contextlib.py#x1B[0m:137: in __enter__
return next(self.gen)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/tests/test_backends.py#x1B[0m:2106: in roundtrip
self.save(data, store_target, **save_kwargs)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/tests/test_backends.py#x1B[0m:2088: in save
return dataset.to_zarr(store=store_target, **kwargs, **self.version_kwargs)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/dataset.py#x1B[0m:2551: in to_zarr
return to_zarr( # type: ignore[call-overload,misc]
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/api.py#x1B[0m:1710: in to_zarr
dump_to_store(dataset, zstore, writer, encoding=encoding)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/api.py#x1B[0m:1397: in dump_to_store
store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/zarr.py#x1B[0m:664: in store
variables_encoded, attributes = self.encode(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/common.py#x1B[0m:302: in encode
variables = {k: self.encode_variable(v) for k, v in variables.items()}
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/common.py#x1B[0m:302: in <dictcomp>
variables = {k: self.encode_variable(v) for k, v in variables.items()}
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/zarr.py#x1B[0m:598: in encode_variable
variable = encode_zarr_variable(variable)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/zarr.py#x1B[0m:314: in encode_zarr_variable
var = conventions.encode_cf_variable(var, name=name)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/conventions.py#x1B[0m:196: in encode_cf_variable
var = coder.encode(var, name=name)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:977: in encode
(data, units, calendar) = encode_cf_datetime(data, units, calendar, dtype)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:726: in encode_cf_datetime
return _eagerly_encode_cf_datetime(dates, units, calendar, dtype)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:738: in _eagerly_encode_cf_datetime
data_units = infer_datetime_units(dates)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:446: in infer_datetime_units
units = _infer_time_units_from_diff(unique_timedeltas)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:400: in _infer_time_units_from_diff
if np.all(unique_timedeltas % unit_timedelta(time_unit) == zero_timedelta):
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:384: in _unit_timedelta_numpy
numpy_units = _netcdf_to_numpy_timeunit(units)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
units = 'days'
def _netcdf_to_numpy_timeunit(units: str) -> NPDatetimeUnitOptions:
units = units.lower()
if not units.endswith("s"):
units = f"{units}s"
return cast(
> NPDatetimeUnitOptions,
{
"nanoseconds": "ns",
"microseconds": "us",
"milliseconds": "ms",
"seconds": "s",
"minutes": "m",
"hours": "h",
"days": "D",
}[units],
)
#x1B[1m#x1B[31mE NameError: name 'NPDatetimeUnitOptions' is not defined#x1B[0m
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:119: NameError
Check warning on line 0 in xarray.tests.test_backends.TestZarrWriteEmpty
github-actions / Test Results
6 out of 9 runs failed: test_compressor_encoding (xarray.tests.test_backends.TestZarrWriteEmpty)
artifacts/Test results for Linux-3.11 all-but-dask/pytest.xml [took 0s]
artifacts/Test results for Linux-3.12/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9 min-all-deps/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9/pytest.xml [took 0s]
artifacts/Test results for macOS-3.12/pytest.xml [took 0s]
artifacts/Test results for macOS-3.9/pytest.xml [took 0s]
Raw output
NameError: name 'NPDatetimeUnitOptions' is not defined
self = <xarray.tests.test_backends.TestZarrWriteEmpty object at 0x7f7ef74ab0d0>
def test_compressor_encoding(self) -> None:
original = create_test_data()
# specify a custom compressor
import zarr
blosc_comp = zarr.Blosc(cname="zstd", clevel=3, shuffle=2)
save_kwargs = dict(encoding={"var1": {"compressor": blosc_comp}})
> with self.roundtrip(original, save_kwargs=save_kwargs) as ds:
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/tests/test_backends.py#x1B[0m:2455:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
#x1B[1m#x1B[31m/home/runner/micromamba/envs/xarray-tests/lib/python3.11/contextlib.py#x1B[0m:137: in __enter__
return next(self.gen)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/tests/test_backends.py#x1B[0m:2106: in roundtrip
self.save(data, store_target, **save_kwargs)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/tests/test_backends.py#x1B[0m:2088: in save
return dataset.to_zarr(store=store_target, **kwargs, **self.version_kwargs)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/dataset.py#x1B[0m:2551: in to_zarr
return to_zarr( # type: ignore[call-overload,misc]
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/api.py#x1B[0m:1710: in to_zarr
dump_to_store(dataset, zstore, writer, encoding=encoding)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/api.py#x1B[0m:1397: in dump_to_store
store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/zarr.py#x1B[0m:664: in store
variables_encoded, attributes = self.encode(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/common.py#x1B[0m:302: in encode
variables = {k: self.encode_variable(v) for k, v in variables.items()}
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/common.py#x1B[0m:302: in <dictcomp>
variables = {k: self.encode_variable(v) for k, v in variables.items()}
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/zarr.py#x1B[0m:598: in encode_variable
variable = encode_zarr_variable(variable)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/zarr.py#x1B[0m:314: in encode_zarr_variable
var = conventions.encode_cf_variable(var, name=name)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/conventions.py#x1B[0m:196: in encode_cf_variable
var = coder.encode(var, name=name)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:977: in encode
(data, units, calendar) = encode_cf_datetime(data, units, calendar, dtype)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:726: in encode_cf_datetime
return _eagerly_encode_cf_datetime(dates, units, calendar, dtype)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:738: in _eagerly_encode_cf_datetime
data_units = infer_datetime_units(dates)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:446: in infer_datetime_units
units = _infer_time_units_from_diff(unique_timedeltas)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:400: in _infer_time_units_from_diff
if np.all(unique_timedeltas % unit_timedelta(time_unit) == zero_timedelta):
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:384: in _unit_timedelta_numpy
numpy_units = _netcdf_to_numpy_timeunit(units)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
units = 'days'
def _netcdf_to_numpy_timeunit(units: str) -> NPDatetimeUnitOptions:
units = units.lower()
if not units.endswith("s"):
units = f"{units}s"
return cast(
> NPDatetimeUnitOptions,
{
"nanoseconds": "ns",
"microseconds": "us",
"milliseconds": "ms",
"seconds": "s",
"minutes": "m",
"hours": "h",
"days": "D",
}[units],
)
#x1B[1m#x1B[31mE NameError: name 'NPDatetimeUnitOptions' is not defined#x1B[0m
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:119: NameError
Check warning on line 0 in xarray.tests.test_backends.TestZarrWriteEmpty
github-actions / Test Results
6 out of 9 runs failed: test_group (xarray.tests.test_backends.TestZarrWriteEmpty)
artifacts/Test results for Linux-3.11 all-but-dask/pytest.xml [took 0s]
artifacts/Test results for Linux-3.12/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9 min-all-deps/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9/pytest.xml [took 0s]
artifacts/Test results for macOS-3.12/pytest.xml [took 0s]
artifacts/Test results for macOS-3.9/pytest.xml [took 0s]
Raw output
NameError: name 'NPDatetimeUnitOptions' is not defined
self = <xarray.tests.test_backends.TestZarrWriteEmpty object at 0x7f7ef74ab5d0>
def test_group(self) -> None:
original = create_test_data()
group = "some/random/path"
> with self.roundtrip(
original, save_kwargs={"group": group}, open_kwargs={"group": group}
) as actual:
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/tests/test_backends.py#x1B[0m:2463:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
#x1B[1m#x1B[31m/home/runner/micromamba/envs/xarray-tests/lib/python3.11/contextlib.py#x1B[0m:137: in __enter__
return next(self.gen)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/tests/test_backends.py#x1B[0m:2106: in roundtrip
self.save(data, store_target, **save_kwargs)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/tests/test_backends.py#x1B[0m:2088: in save
return dataset.to_zarr(store=store_target, **kwargs, **self.version_kwargs)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/dataset.py#x1B[0m:2551: in to_zarr
return to_zarr( # type: ignore[call-overload,misc]
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/api.py#x1B[0m:1710: in to_zarr
dump_to_store(dataset, zstore, writer, encoding=encoding)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/api.py#x1B[0m:1397: in dump_to_store
store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/zarr.py#x1B[0m:664: in store
variables_encoded, attributes = self.encode(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/common.py#x1B[0m:302: in encode
variables = {k: self.encode_variable(v) for k, v in variables.items()}
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/common.py#x1B[0m:302: in <dictcomp>
variables = {k: self.encode_variable(v) for k, v in variables.items()}
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/zarr.py#x1B[0m:598: in encode_variable
variable = encode_zarr_variable(variable)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/zarr.py#x1B[0m:314: in encode_zarr_variable
var = conventions.encode_cf_variable(var, name=name)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/conventions.py#x1B[0m:196: in encode_cf_variable
var = coder.encode(var, name=name)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:977: in encode
(data, units, calendar) = encode_cf_datetime(data, units, calendar, dtype)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:726: in encode_cf_datetime
return _eagerly_encode_cf_datetime(dates, units, calendar, dtype)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:738: in _eagerly_encode_cf_datetime
data_units = infer_datetime_units(dates)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:446: in infer_datetime_units
units = _infer_time_units_from_diff(unique_timedeltas)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:400: in _infer_time_units_from_diff
if np.all(unique_timedeltas % unit_timedelta(time_unit) == zero_timedelta):
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:384: in _unit_timedelta_numpy
numpy_units = _netcdf_to_numpy_timeunit(units)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
units = 'days'
def _netcdf_to_numpy_timeunit(units: str) -> NPDatetimeUnitOptions:
units = units.lower()
if not units.endswith("s"):
units = f"{units}s"
return cast(
> NPDatetimeUnitOptions,
{
"nanoseconds": "ns",
"microseconds": "us",
"milliseconds": "ms",
"seconds": "s",
"minutes": "m",
"hours": "h",
"days": "D",
}[units],
)
#x1B[1m#x1B[31mE NameError: name 'NPDatetimeUnitOptions' is not defined#x1B[0m
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:119: NameError
Check warning on line 0 in xarray.tests.test_backends.TestZarrWriteEmpty
github-actions / Test Results
6 out of 9 runs failed: test_append_write (xarray.tests.test_backends.TestZarrWriteEmpty)
artifacts/Test results for Linux-3.11 all-but-dask/pytest.xml [took 0s]
artifacts/Test results for Linux-3.12/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9 min-all-deps/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9/pytest.xml [took 0s]
artifacts/Test results for macOS-3.12/pytest.xml [took 0s]
artifacts/Test results for macOS-3.9/pytest.xml [took 0s]
Raw output
NameError: name 'NPDatetimeUnitOptions' is not defined
self = <xarray.tests.test_backends.TestZarrWriteEmpty object at 0x7f7ef74b0d50>
def test_append_write(self) -> None:
> super().test_append_write()
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/tests/test_backends.py#x1B[0m:2497:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/tests/test_backends.py#x1B[0m:1222: in test_append_write
with self.roundtrip_append(data) as actual:
#x1B[1m#x1B[31m/home/runner/micromamba/envs/xarray-tests/lib/python3.11/contextlib.py#x1B[0m:137: in __enter__
return next(self.gen)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/tests/test_backends.py#x1B[0m:330: in roundtrip_append
self.save(data[[key]], path, mode=mode, **save_kwargs)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/tests/test_backends.py#x1B[0m:2088: in save
return dataset.to_zarr(store=store_target, **kwargs, **self.version_kwargs)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/dataset.py#x1B[0m:2551: in to_zarr
return to_zarr( # type: ignore[call-overload,misc]
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/api.py#x1B[0m:1710: in to_zarr
dump_to_store(dataset, zstore, writer, encoding=encoding)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/api.py#x1B[0m:1397: in dump_to_store
store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/zarr.py#x1B[0m:664: in store
variables_encoded, attributes = self.encode(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/common.py#x1B[0m:302: in encode
variables = {k: self.encode_variable(v) for k, v in variables.items()}
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/common.py#x1B[0m:302: in <dictcomp>
variables = {k: self.encode_variable(v) for k, v in variables.items()}
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/zarr.py#x1B[0m:598: in encode_variable
variable = encode_zarr_variable(variable)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/zarr.py#x1B[0m:314: in encode_zarr_variable
var = conventions.encode_cf_variable(var, name=name)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/conventions.py#x1B[0m:196: in encode_cf_variable
var = coder.encode(var, name=name)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:977: in encode
(data, units, calendar) = encode_cf_datetime(data, units, calendar, dtype)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:726: in encode_cf_datetime
return _eagerly_encode_cf_datetime(dates, units, calendar, dtype)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:738: in _eagerly_encode_cf_datetime
data_units = infer_datetime_units(dates)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:446: in infer_datetime_units
units = _infer_time_units_from_diff(unique_timedeltas)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:400: in _infer_time_units_from_diff
if np.all(unique_timedeltas % unit_timedelta(time_unit) == zero_timedelta):
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:384: in _unit_timedelta_numpy
numpy_units = _netcdf_to_numpy_timeunit(units)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
units = 'days'
def _netcdf_to_numpy_timeunit(units: str) -> NPDatetimeUnitOptions:
units = units.lower()
if not units.endswith("s"):
units = f"{units}s"
return cast(
> NPDatetimeUnitOptions,
{
"nanoseconds": "ns",
"microseconds": "us",
"milliseconds": "ms",
"seconds": "s",
"minutes": "m",
"hours": "h",
"days": "D",
}[units],
)
#x1B[1m#x1B[31mE NameError: name 'NPDatetimeUnitOptions' is not defined#x1B[0m
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:119: NameError
Check warning on line 0 in xarray.tests.test_backends.TestZarrWriteEmpty
github-actions / Test Results
6 out of 9 runs failed: test_append_with_invalid_dim_raises (xarray.tests.test_backends.TestZarrWriteEmpty)
artifacts/Test results for Linux-3.11 all-but-dask/pytest.xml [took 0s]
artifacts/Test results for Linux-3.12/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9 min-all-deps/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9/pytest.xml [took 0s]
artifacts/Test results for macOS-3.12/pytest.xml [took 0s]
artifacts/Test results for macOS-3.9/pytest.xml [took 0s]
Raw output
NameError: name 'NPDatetimeUnitOptions' is not defined
self = <xarray.tests.test_backends.TestZarrWriteEmpty object at 0x7f7ef74a9bd0>
def test_append_with_invalid_dim_raises(self) -> None:
ds, ds_to_append, _ = create_append_test_data()
with self.create_zarr_target() as store_target:
> ds.to_zarr(store_target, mode="w", **self.version_kwargs)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/tests/test_backends.py#x1B[0m:2521:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/dataset.py#x1B[0m:2551: in to_zarr
return to_zarr( # type: ignore[call-overload,misc]
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/api.py#x1B[0m:1710: in to_zarr
dump_to_store(dataset, zstore, writer, encoding=encoding)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/api.py#x1B[0m:1397: in dump_to_store
store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/zarr.py#x1B[0m:664: in store
variables_encoded, attributes = self.encode(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/common.py#x1B[0m:302: in encode
variables = {k: self.encode_variable(v) for k, v in variables.items()}
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/common.py#x1B[0m:302: in <dictcomp>
variables = {k: self.encode_variable(v) for k, v in variables.items()}
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/zarr.py#x1B[0m:598: in encode_variable
variable = encode_zarr_variable(variable)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/zarr.py#x1B[0m:314: in encode_zarr_variable
var = conventions.encode_cf_variable(var, name=name)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/conventions.py#x1B[0m:196: in encode_cf_variable
var = coder.encode(var, name=name)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:977: in encode
(data, units, calendar) = encode_cf_datetime(data, units, calendar, dtype)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:726: in encode_cf_datetime
return _eagerly_encode_cf_datetime(dates, units, calendar, dtype)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:738: in _eagerly_encode_cf_datetime
data_units = infer_datetime_units(dates)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:446: in infer_datetime_units
units = _infer_time_units_from_diff(unique_timedeltas)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:400: in _infer_time_units_from_diff
if np.all(unique_timedeltas % unit_timedelta(time_unit) == zero_timedelta):
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:384: in _unit_timedelta_numpy
numpy_units = _netcdf_to_numpy_timeunit(units)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
units = 'days'
def _netcdf_to_numpy_timeunit(units: str) -> NPDatetimeUnitOptions:
units = units.lower()
if not units.endswith("s"):
units = f"{units}s"
return cast(
> NPDatetimeUnitOptions,
{
"nanoseconds": "ns",
"microseconds": "us",
"milliseconds": "ms",
"seconds": "s",
"minutes": "m",
"hours": "h",
"days": "D",
}[units],
)
#x1B[1m#x1B[31mE NameError: name 'NPDatetimeUnitOptions' is not defined#x1B[0m
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:119: NameError
Check warning on line 0 in xarray.tests.test_backends.TestZarrWriteEmpty
github-actions / Test Results
6 out of 9 runs failed: test_append_with_append_dim_not_set_raises (xarray.tests.test_backends.TestZarrWriteEmpty)
artifacts/Test results for Linux-3.11 all-but-dask/pytest.xml [took 0s]
artifacts/Test results for Linux-3.12/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9 min-all-deps/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9/pytest.xml [took 0s]
artifacts/Test results for macOS-3.12/pytest.xml [took 0s]
artifacts/Test results for macOS-3.9/pytest.xml [took 0s]
Raw output
NameError: name 'NPDatetimeUnitOptions' is not defined
self = <xarray.tests.test_backends.TestZarrWriteEmpty object at 0x7f7ef74b18d0>
def test_append_with_append_dim_not_set_raises(self) -> None:
ds, ds_to_append, _ = create_append_test_data()
with self.create_zarr_target() as store_target:
> ds.to_zarr(store_target, mode="w", **self.version_kwargs)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/tests/test_backends.py#x1B[0m:2542:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/dataset.py#x1B[0m:2551: in to_zarr
return to_zarr( # type: ignore[call-overload,misc]
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/api.py#x1B[0m:1710: in to_zarr
dump_to_store(dataset, zstore, writer, encoding=encoding)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/api.py#x1B[0m:1397: in dump_to_store
store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/zarr.py#x1B[0m:664: in store
variables_encoded, attributes = self.encode(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/common.py#x1B[0m:302: in encode
variables = {k: self.encode_variable(v) for k, v in variables.items()}
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/common.py#x1B[0m:302: in <dictcomp>
variables = {k: self.encode_variable(v) for k, v in variables.items()}
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/zarr.py#x1B[0m:598: in encode_variable
variable = encode_zarr_variable(variable)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/zarr.py#x1B[0m:314: in encode_zarr_variable
var = conventions.encode_cf_variable(var, name=name)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/conventions.py#x1B[0m:196: in encode_cf_variable
var = coder.encode(var, name=name)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:977: in encode
(data, units, calendar) = encode_cf_datetime(data, units, calendar, dtype)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:726: in encode_cf_datetime
return _eagerly_encode_cf_datetime(dates, units, calendar, dtype)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:738: in _eagerly_encode_cf_datetime
data_units = infer_datetime_units(dates)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:446: in infer_datetime_units
units = _infer_time_units_from_diff(unique_timedeltas)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:400: in _infer_time_units_from_diff
if np.all(unique_timedeltas % unit_timedelta(time_unit) == zero_timedelta):
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:384: in _unit_timedelta_numpy
numpy_units = _netcdf_to_numpy_timeunit(units)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
units = 'days'
def _netcdf_to_numpy_timeunit(units: str) -> NPDatetimeUnitOptions:
units = units.lower()
if not units.endswith("s"):
units = f"{units}s"
return cast(
> NPDatetimeUnitOptions,
{
"nanoseconds": "ns",
"microseconds": "us",
"milliseconds": "ms",
"seconds": "s",
"minutes": "m",
"hours": "h",
"days": "D",
}[units],
)
#x1B[1m#x1B[31mE NameError: name 'NPDatetimeUnitOptions' is not defined#x1B[0m
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:119: NameError
Check warning on line 0 in xarray.tests.test_backends.TestZarrWriteEmpty
github-actions / Test Results
6 out of 9 runs failed: test_append_with_mode_not_a_raises (xarray.tests.test_backends.TestZarrWriteEmpty)
artifacts/Test results for Linux-3.11 all-but-dask/pytest.xml [took 0s]
artifacts/Test results for Linux-3.12/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9 min-all-deps/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9/pytest.xml [took 0s]
artifacts/Test results for macOS-3.12/pytest.xml [took 0s]
artifacts/Test results for macOS-3.9/pytest.xml [took 0s]
Raw output
NameError: name 'NPDatetimeUnitOptions' is not defined
self = <xarray.tests.test_backends.TestZarrWriteEmpty object at 0x7f7ef74b0e50>
def test_append_with_mode_not_a_raises(self) -> None:
ds, ds_to_append, _ = create_append_test_data()
with self.create_zarr_target() as store_target:
> ds.to_zarr(store_target, mode="w", **self.version_kwargs)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/tests/test_backends.py#x1B[0m:2549:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/dataset.py#x1B[0m:2551: in to_zarr
return to_zarr( # type: ignore[call-overload,misc]
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/api.py#x1B[0m:1710: in to_zarr
dump_to_store(dataset, zstore, writer, encoding=encoding)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/api.py#x1B[0m:1397: in dump_to_store
store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/zarr.py#x1B[0m:664: in store
variables_encoded, attributes = self.encode(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/common.py#x1B[0m:302: in encode
variables = {k: self.encode_variable(v) for k, v in variables.items()}
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/common.py#x1B[0m:302: in <dictcomp>
variables = {k: self.encode_variable(v) for k, v in variables.items()}
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/zarr.py#x1B[0m:598: in encode_variable
variable = encode_zarr_variable(variable)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/zarr.py#x1B[0m:314: in encode_zarr_variable
var = conventions.encode_cf_variable(var, name=name)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/conventions.py#x1B[0m:196: in encode_cf_variable
var = coder.encode(var, name=name)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:977: in encode
(data, units, calendar) = encode_cf_datetime(data, units, calendar, dtype)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:726: in encode_cf_datetime
return _eagerly_encode_cf_datetime(dates, units, calendar, dtype)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:738: in _eagerly_encode_cf_datetime
data_units = infer_datetime_units(dates)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:446: in infer_datetime_units
units = _infer_time_units_from_diff(unique_timedeltas)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:400: in _infer_time_units_from_diff
if np.all(unique_timedeltas % unit_timedelta(time_unit) == zero_timedelta):
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:384: in _unit_timedelta_numpy
numpy_units = _netcdf_to_numpy_timeunit(units)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
units = 'days'
def _netcdf_to_numpy_timeunit(units: str) -> NPDatetimeUnitOptions:
units = units.lower()
if not units.endswith("s"):
units = f"{units}s"
return cast(
> NPDatetimeUnitOptions,
{
"nanoseconds": "ns",
"microseconds": "us",
"milliseconds": "ms",
"seconds": "s",
"minutes": "m",
"hours": "h",
"days": "D",
}[units],
)
#x1B[1m#x1B[31mE NameError: name 'NPDatetimeUnitOptions' is not defined#x1B[0m
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:119: NameError
Check warning on line 0 in xarray.tests.test_backends.TestZarrWriteEmpty
github-actions / Test Results
6 out of 9 runs failed: test_append_with_existing_encoding_raises (xarray.tests.test_backends.TestZarrWriteEmpty)
artifacts/Test results for Linux-3.11 all-but-dask/pytest.xml [took 0s]
artifacts/Test results for Linux-3.12/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9 min-all-deps/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9/pytest.xml [took 0s]
artifacts/Test results for macOS-3.12/pytest.xml [took 0s]
artifacts/Test results for macOS-3.9/pytest.xml [took 0s]
Raw output
NameError: name 'NPDatetimeUnitOptions' is not defined
self = <xarray.tests.test_backends.TestZarrWriteEmpty object at 0x7f7ef74b1810>
def test_append_with_existing_encoding_raises(self) -> None:
ds, ds_to_append, _ = create_append_test_data()
with self.create_zarr_target() as store_target:
> ds.to_zarr(store_target, mode="w", **self.version_kwargs)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/tests/test_backends.py#x1B[0m:2558:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/dataset.py#x1B[0m:2551: in to_zarr
return to_zarr( # type: ignore[call-overload,misc]
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/api.py#x1B[0m:1710: in to_zarr
dump_to_store(dataset, zstore, writer, encoding=encoding)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/api.py#x1B[0m:1397: in dump_to_store
store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/zarr.py#x1B[0m:664: in store
variables_encoded, attributes = self.encode(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/common.py#x1B[0m:302: in encode
variables = {k: self.encode_variable(v) for k, v in variables.items()}
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/common.py#x1B[0m:302: in <dictcomp>
variables = {k: self.encode_variable(v) for k, v in variables.items()}
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/zarr.py#x1B[0m:598: in encode_variable
variable = encode_zarr_variable(variable)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/zarr.py#x1B[0m:314: in encode_zarr_variable
var = conventions.encode_cf_variable(var, name=name)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/conventions.py#x1B[0m:196: in encode_cf_variable
var = coder.encode(var, name=name)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:977: in encode
(data, units, calendar) = encode_cf_datetime(data, units, calendar, dtype)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:726: in encode_cf_datetime
return _eagerly_encode_cf_datetime(dates, units, calendar, dtype)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:738: in _eagerly_encode_cf_datetime
data_units = infer_datetime_units(dates)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:446: in infer_datetime_units
units = _infer_time_units_from_diff(unique_timedeltas)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:400: in _infer_time_units_from_diff
if np.all(unique_timedeltas % unit_timedelta(time_unit) == zero_timedelta):
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:384: in _unit_timedelta_numpy
numpy_units = _netcdf_to_numpy_timeunit(units)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
units = 'days'
def _netcdf_to_numpy_timeunit(units: str) -> NPDatetimeUnitOptions:
units = units.lower()
if not units.endswith("s"):
units = f"{units}s"
return cast(
> NPDatetimeUnitOptions,
{
"nanoseconds": "ns",
"microseconds": "us",
"milliseconds": "ms",
"seconds": "s",
"minutes": "m",
"hours": "h",
"days": "D",
}[units],
)
#x1B[1m#x1B[31mE NameError: name 'NPDatetimeUnitOptions' is not defined#x1B[0m
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/coding/times.py#x1B[0m:119: NameError