Skip to content

broken output of find_root_and_group for h5netcdf #3680

Closed
@kmuehlbauer

Description

@kmuehlbauer

MCVE Code Sample

# Your code here
import netCDF4
import h5netcdf
import xarray
from xarray.backends.common import find_root_and_group
root = netCDF4.Dataset("test.nc", "w", format="NETCDF4")
test1 = root.createGroup("test1")
test1.createGroup("test2")
root.close()
h5n = h5netcdf.File('test.nc')
print(find_root_and_group(h5n['test1'])[1])
h5n.close()

This will output:
//test1//test1/test2

Expected Output

/test1/test2

Problem Description

I stumbled over this while working on #3618. Although the function claims to retrieve root and group name of netCDF4/h5netcdf datasets the output for h5netcdf is broken.

Output of xr.show_versions()

INSTALLED VERSIONS

commit: None
python: 3.8.0 | packaged by conda-forge | (default, Nov 22 2019, 05:03:59)
[GCC 7.3.0]
python-bits: 64
OS: Linux
OS-release: 4.12.14-lp151.28.36-default
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: de_DE.UTF-8
LOCALE: de_DE.UTF-8
libhdf5: 1.10.5
libnetcdf: 4.7.3

xarray: 0.14.1+43.g3e9d9046.dirty
pandas: 0.25.3
numpy: 1.17.3
scipy: 1.3.3
netCDF4: 1.5.3
pydap: None
h5netcdf: 0.7.4
h5py: 2.10.0
Nio: None
zarr: None
cftime: 1.0.4.2
nc_time_axis: None
PseudoNetCDF: None
rasterio: None
cfgrib: None
iris: None
bottleneck: None
dask: 2.8.0
distributed: 2.9.0
matplotlib: 3.1.2
cartopy: 0.17.0
seaborn: None
numbagg: None
setuptools: 42.0.2.post20191201
pip: 19.3.1
conda: None
pytest: 5.3.1
IPython: 7.10.2
sphinx: 2.3.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions