Getting information on netcdf file with unlimited dimensions
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 4.2k
- Forks
- 1.4k
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 14
Description
What is your issue?
When one reads a netCDF file, there is not solution to determine if there is an unlimited dimension, and determine which one.
I really need to be able to handle that. I need to process a variable, and write the result with the exact same informations about dimensions and coordinates, with all attributes and characteristics.
Thanks,
Olivier
import xarray as xr, os
print ( '==== Get an example file' )
file = 'tas_Amon_IPSL-CM6A-LR_piControl_r1i1p1f1_gr_185001-234912.nc'
h_file = f"https://vesg.ipsl.upmc.fr/thredds/fileServer/cmip6/CMIP/IPSL/IPSL-CM6A-LR/piControl/r1i1p1f1/Amon/tas/gr/v20200326/{file}"
print ( '\n ==== Getting file ')
os.system ( f"wget --no-clobber {h_file}")
print ( '\n ==== File header : this file has an unlimited dimension "time"' )
os.system ( f"ncdump -h {file} | head")
dd = xr.open_dataset ( file, decode_times=True, use_cftime=True)
xr.set_options ( display_expand_attrs=True)
print ( '\n ==== General information : no information about the unlimited dimension(s)' )
print (dd)
print ( '\n ==== Dimensions : no information about the unlimited dimension(s)')
print ( dd.dims )
print ( '\n === Attributes : no information about the unlimited dimension(s)' )
for attr in dd.attrs :
print ( f'{attr} : {dd.attrs[attr]}' )
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the xarray.open_dataset entry point and the Dataset dimensions and attributes shown in the example, then trace how netCDF metadata is represented during reading. Determine an interface for exposing unlimited dimensions and add coverage showing which dimension is unlimited while preserving the existing dimensions, coordinates, and attributes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- data
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 45/100