issues: 304314787
This data as json
id | node_id | number | title | user | state | locked | assignee | milestone | comments | created_at | updated_at | closed_at | author_association | active_lock_reason | draft | pull_request | body | reactions | performed_via_github_app | state_reason | repo | type |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
304314787 | MDU6SXNzdWUzMDQzMTQ3ODc= | 1982 | NetCDF coordinates in parent group is not used when reading sub group | 4849151 | open | 0 | 10 | 2018-03-12T10:26:54Z | 2021-12-27T18:19:22Z | NONE | Code Sample, a copy-pastable example if possible```python ncfile_cf = "x07z00017_cf.nc" with xr.open_dataset(ncfile_cf, group="x07") as ds: ds_data_cf = ds.copy(deep=True) print(ds_data_cf) <xarray.Dataset> Dimensions: (time1: 100000, time2: 2) Dimensions without coordinates: time1, time2 Data variables: aps (time1) float64 ... iact (time1) float64 ... vact (time1) float64 ... dps (time1) float64 ... tss (time2) float64 ... ``` Problem descriptionWhen reading a sub group from a netCDF file with dimensions defined in the root group, the dimensions are not read from the root group. This contradicts the netCDF documentation, which states that dimensions are scoped such that they can be seen by all sub groups. The attached netCDF file demonstrates this issue. x07z00017_cf.nc.zip Expected OutputThe dimensions from the root group should be used when reading the sub-group. ```python with xr.open_dataset(ncfile_cf) as ds: for coord in ds.coords: ds_data_cf.coords[coord] = ds[coord] print(ds_data_cf) <xarray.Dataset> Dimensions: (time1: 100000, time2: 2) Coordinates: * time1 (time1) float64 0.0 1e-06 2e-06 3e-06 4e-06 5e-06 6e-06 7e-06 ... * time2 (time2) float64 0.0 0.1 Data variables: aps (time1) float64 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0 1.0 1.0 ... iact (time1) float64 -0.00125 -0.000625 -0.00125 -0.0009375 ... vact (time1) float64 -0.009375 -0.009375 -0.01875 -0.01875 -0.009375 ... dps (time1) float64 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 ... tss (time2) float64 0.0 0.0 ``` Output of
|
{ "url": "https://api.github.com/repos/pydata/xarray/issues/1982/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
13221727 | issue |