home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 1382625582

This data as json

html_url issue_url id node_id user created_at updated_at author_association body reactions performed_via_github_app issue
https://github.com/pydata/xarray/issues/6854#issuecomment-1382625582 https://api.github.com/repos/pydata/xarray/issues/6854 1382625582 IC_kwDOAMm_X85SaTEu 302469 2023-01-14T01:33:08Z 2023-01-14T01:33:08Z CONTRIBUTOR

Building against netcdf with the patch backported by @opoplawski, I now get a single failure: ``` ____ TestNCZarr.testopen_nczarr ______ [gw3] linux -- Python 3.11.1 /usr/bin/python3 zarr_obj = <zarr.core.Array '/dim2' (9,) float64 read-only> dimension_key = '_ARRAY_DIMENSIONS', try_nczarr = True def _get_zarr_dims_and_attrs(zarr_obj, dimension_key, try_nczarr): # Zarr arrays do not have dimensions. To get around this problem, we add # an attribute that specifies the dimension. We have to hide this attribute # when we send the attributes to the user. # zarr_obj can be either a zarr group or zarr array try: # Xarray-Zarr

      dimensions = zarr_obj.attrs[dimension_key]

/builddir/build/BUILDROOT/python-xarray-2022.12.0-1.fc38.x86_64/usr/lib/python3.11/site-packages/xarray/backends/zarr.py:183:


self = <zarr.attrs.Attributes object at 0x7f697d934ad0> item = '_ARRAY_DIMENSIONS' def getitem(self, item):

  return self.asdict()[item]

E KeyError: '_ARRAY_DIMENSIONS' /usr/lib/python3.11/site-packages/zarr/attrs.py:74: KeyError During handling of the above exception, another exception occurred: zarr_obj = <zarr.core.Array '/dim2' (9,) float64 read-only> dimension_key = '_ARRAY_DIMENSIONS', try_nczarr = True def _get_zarr_dims_and_attrs(zarr_obj, dimension_key, try_nczarr): # Zarr arrays do not have dimensions. To get around this problem, we add # an attribute that specifies the dimension. We have to hide this attribute # when we send the attributes to the user. # zarr_obj can be either a zarr group or zarr array try: # Xarray-Zarr dimensions = zarr_obj.attrs[dimension_key] except KeyError as e: if not try_nczarr: raise KeyError( f"Zarr object is missing the attribute {dimension_key}, which is " "required for xarray to determine variable dimensions." ) from e

        # NCZarr defines dimensions through metadata in .zarray
        zarray_path = os.path.join(zarr_obj.path, ".zarray")
        zarray = json.loads(zarr_obj.store[zarray_path])
        try:
            # NCZarr uses Fully Qualified Names
            dimensions = [
              os.path.basename(dim) for dim in zarray["_NCZARR_ARRAY"]["dimrefs"]
            ]

E KeyError: '_NCZARR_ARRAY' /builddir/build/BUILDROOT/python-xarray-2022.12.0-1.fc38.x86_64/usr/lib/python3.11/site-packages/xarray/backends/zarr.py:197: KeyError The above exception was the direct cause of the following exception: self = <xarray.tests.test_backends.TestNCZarr object at 0x7f697ed62f10> def test_open_nczarr(self) -> None: with create_tmp_file(suffix=".zarr") as tmp: expected = self._create_nczarr(tmp) actual = xr.open_zarr(tmp, consolidated=False) /builddir/build/BUILDROOT/python-xarray-2022.12.0-1.fc38.x86_64/usr/lib/python3.11/site-packages/xarray/tests/test_backends.py:5741:


/builddir/build/BUILDROOT/python-xarray-2022.12.0-1.fc38.x86_64/usr/lib/python3.11/site-packages/xarray/backends/zarr.py:819: in open_zarr ds = open_dataset( /builddir/build/BUILDROOT/python-xarray-2022.12.0-1.fc38.x86_64/usr/lib/python3.11/site-packages/xarray/backends/api.py:540: in open_dataset backend_ds = backend.open_dataset( /builddir/build/BUILDROOT/python-xarray-2022.12.0-1.fc38.x86_64/usr/lib/python3.11/site-packages/xarray/backends/zarr.py:897: in open_dataset ds = store_entrypoint.open_dataset( /builddir/build/BUILDROOT/python-xarray-2022.12.0-1.fc38.x86_64/usr/lib/python3.11/site-packages/xarray/backends/store.py:28: in open_dataset vars, attrs = store.load() /builddir/build/BUILDROOT/python-xarray-2022.12.0-1.fc38.x86_64/usr/lib/python3.11/site-packages/xarray/backends/common.py:128: in load (_decode_variable_name(k), v) for k, v in self.get_variables().items() /builddir/build/BUILDROOT/python-xarray-2022.12.0-1.fc38.x86_64/usr/lib/python3.11/site-packages/xarray/backends/zarr.py:480: in get_variables return FrozenDict( /builddir/build/BUILDROOT/python-xarray-2022.12.0-1.fc38.x86_64/usr/lib/python3.11/site-packages/xarray/core/utils.py:469: in FrozenDict return Frozen(dict(args, *kwargs)) /builddir/build/BUILDROOT/python-xarray-2022.12.0-1.fc38.x86_64/usr/lib/python3.11/site-packages/xarray/backends/zarr.py:481: in <genexpr> (k, self.open_store_variable(k, v)) for k, v in self.zarr_group.arrays() /builddir/build/BUILDROOT/python-xarray-2022.12.0-1.fc38.x86_64/usr/lib/python3.11/site-packages/xarray/backends/zarr.py:457: in open_store_variable dimensions, attributes = _get_zarr_dims_and_attrs(


zarr_obj = <zarr.core.Array '/dim2' (9,) float64 read-only> dimension_key = '_ARRAY_DIMENSIONS', try_nczarr = True def _get_zarr_dims_and_attrs(zarr_obj, dimension_key, try_nczarr): # Zarr arrays do not have dimensions. To get around this problem, we add # an attribute that specifies the dimension. We have to hide this attribute # when we send the attributes to the user. # zarr_obj can be either a zarr group or zarr array try: # Xarray-Zarr dimensions = zarr_obj.attrs[dimension_key] except KeyError as e: if not try_nczarr: raise KeyError( f"Zarr object is missing the attribute {dimension_key}, which is " "required for xarray to determine variable dimensions." ) from e

        # NCZarr defines dimensions through metadata in .zarray
        zarray_path = os.path.join(zarr_obj.path, ".zarray")
        zarray = json.loads(zarr_obj.store[zarray_path])
        try:
            # NCZarr uses Fully Qualified Names
            dimensions = [
                os.path.basename(dim) for dim in zarray["_NCZARR_ARRAY"]["dimrefs"]
            ]
        except KeyError as e:
          raise KeyError(
                f"Zarr object is missing the attribute `{dimension_key}` and the NCZarr metadata, "
                "which are required for xarray to determine variable dimensions."
            ) from e

E KeyError: 'Zarr object is missing the attribute _ARRAY_DIMENSIONS and the NCZarr metadata, which are required for xarray to determine variable dimensions.' /builddir/build/BUILDROOT/python-xarray-2022.12.0-1.fc38.x86_64/usr/lib/python3.11/site-packages/xarray/backends/zarr.py:200: KeyError ```

Does that look like a problem in netcdf or a problem in xarray here?

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  1323734180
Powered by Datasette · Queries took 0.92ms · About: xarray-datasette