-
-
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
update to_netcdf
docstring to list support for explicit CDF5 writes
#8985
Comments
Thanks for opening your first issue here at xarray! Be sure to follow the issue template! |
Looks like we allow customizing the Looking at https://unidata.github.io/netcdf4-python/#creatingopeningclosing-a-netcdf-file, what you want is confusingly named import numpy as np
import xarray as xr
ds = xr.Dataset({'a': np.arange(10)})
ds.to_netcdf("foo.nc", format="NETCDF3_64BIT_DATA") Then I'll keep this issue open to update the docstring.
It's rewriting the data in the |
to_netcdf
docstring to list support for explicit CDF5 writes
Thanks Deepak, I had actually been using
in my script earlier. The engine='scipy' is there because without it the write hangs. I put it there based on a suggestion from somebody at CISL. This was a good solution for creating initial condition files in the 11GB range. Upon doubling resolution the IC files go to ~44GB and this no longer works. Hence my questions about 'cdf5'. I have just tried writing my 44GB IC file in 2 ways:
Unfortunately, (1) hangs during write, and (2) returns this error:
I might blame memory issues for the failure of (1) except that a straight default write to netCDF-4:
works just fine. |
Is your feature request related to a problem?
I cannot get to_netcdf() to write files in CDF5 format as identifed by the 'ncdump -k' command.
Describe the solution you'd like
When I write a netcdf file using:
D.to_netcdf( filename )
then ask ncdump to tell me the kind of file I have,
ncdump -k filename
it returns 'netCDF-4'. Unfortunately, this file won't work in the Community Atmpshere Model (CAM), as an initial condition for example. CAM will bomb when it tries to read it. After converting the file with this command:
nccopy -k cdf5 filename cdf5_filename
the file now works in CAM. Also, the command
ncdump -k cdf5_filename
returns 'cdf5'.
I confess I don't know what the nccopy command is doing, but it seems to be needed for the file to be readable by CAM. I am looking for an option in the to_netcdf method that will explicitly write 'cdf5' files without needing to resort to the nccopy command.
Describe alternatives you've considered
Writing netcdf-4 files from xarray and converting via
nccopy -k cdf5 filename cdf5_filename
Additional context
No response
The text was updated successfully, but these errors were encountered: