-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
xr.open_dataset no groups info #2916
Comments
I'm in favour of printing out a nice warning message when the netcdf file has groups. Listing them would be even better. Also it looks like the docs need to be updated to mention netCDF groups: https://xarray.pydata.org/en/stable/io.html#netcdf |
It might make sense to print a warning if a group was not explicitly selected, the root group is empty and there is another non-empty group. Though I'm a little reluctant to do this since empty groups are perfectly valid, and it's a little annoying to get warnings for things that may not be programmer errors. |
@shoyer |
see #1092 for discussion about Dataset groups in xarray's data model |
@shoyer What about adding groups to just the repr? That way the user knows there are group names they can pass to <xarray.Dataset>
Dimensions: ()
Groups: Audio
Data variables:
*empty* |
I work with netCDF groups regularly and am interested in this issue. I agree with @dcherian that having groups added to the Dataset repr when a netCDF file with groups is loaded would be helpful (regardless of if the root group is empty or not) and pretty unobtrusive. |
Actually I don't think that is a good idea any more. A Dataset represents a single group so it's weird to print group info under a dataset repr |
Now that DataTree has landed this shouldn't be an issue any more. https://docs.xarray.dev/en/stable/user-guide/data-structures.html#datatree |
Code Sample, a copy-pastable example if possible
I have to write some data to disk using xr.to_netcdf() method. The data must be structured in groups so i use the group key word. Reading the .nc file from disk leads to empty data variables if group not supplied. Here some samples
Problem description
Actually this is not a real problem, if you keep in mind what data groups are strored in a .nc file.
At the moment, i work arround with netCDF4 to get infos about possible groups within a .nc file.
Expected Output
Well, at least something like this i would appreciate:
Output of
xr.show_versions()
xarray: 0.12.1
pandas: 0.24.2
numpy: 1.16.2
scipy: 1.2.1
netCDF4: 1.5.0.1
pydap: None
h5netcdf: None
h5py: None
Nio: None
zarr: None
cftime: 1.0.3.4
nc_time_axis: None
PseudonetCDF: None
rasterio: None
cfgrib: None
iris: None
bottleneck: 1.2.1
dask: 1.2.0
distributed: 1.27.0
matplotlib: 3.0.3
cartopy: None
seaborn: None
setuptools: 41.0.0
pip: 19.0.3
conda: None
pytest: None
IPython: 7.4.0
sphinx: 2.0.1
The text was updated successfully, but these errors were encountered: