-
Notifications
You must be signed in to change notification settings - Fork 44
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
cdf_to_xarray to_netcdf fails with ValueError #276
Comments
I've tried different versions of cdflib, xarray, and python and it fails the same in all. But for the record, the last test was with
|
Yeah the to_netcdf() command definitely doesn't like the "units" attribute when using np.datetime64 data. There is a couple ways I can see how to fix it:
Another issue it looks like is that the to_netcdf function doesn't like that FILLVAL/VALIDMIN/etc are all datetime64 objects. to_netcdf can convert datetime64 data over just fine, but I guess it cannot convert attribute values? So the best course of action might be to not convert the times to datetime64. Or, if you do keep to_datetime=True, then you manually convert the attributes over to datetime64 objects if you want to keep them. One thing I can do is add a flag to cdf_to_xarray that specifies if we should append "units", "standard_name", etc to the attributes. I have it do that automatically because it immediately allows nice plots of the data directly from xarray. But I'm open to other suggestions as well. |
The following code:
fails with
Is this a problem with the xarray.Dataset produced by cdf_to_xarray or a problem with xarray.Dataset.to_netcdf()?
The text was updated successfully, but these errors were encountered: