-
-
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
CF conventions: time_bnds and time units #2565
Comments
I am actually in favor of 3: also decode |
@fmaussion I have run into this issue before and it is a bit cumbersome. My workaround in the past has been to open the dataset without decoding the times initially, copy the
It would be nice if we could handle this automatically, though one issue that concerns me is how we would automatically determine which variable represents the time bounds in an arbitrary netCDF file (as mentioned above we currently do not have any variable-name-specific logic in xarray, which I think is a good thing). I do notice the time variable in your file has a |
Good points!
Yes, It seems reasonable to assume that the bounds should share the same units as time, therefore I think that the workaround you are using could actually be implemented in xarray, but the actual implementation might be a bit messy... (it would be much simpler if CF would prescribe the units to also be available at the the |
You can find the decoded time units in
But I would also be in favor of decoding time units in bounds variables. |
Problem
Here is the dump of a NetCDF file (download):
When xarray decodes the time coordinates it also deletes the
time:units
attribute (this kind of makes sense, because the unit has no meaning when the time is converted to a CFTime object):The problem is that I have no way to actually decode the
time_bnds
variable from xarray alone now, because thetime_bnds
variable doesn't store the time units. First, I thought that my file was not CF compliant but I've looked into the CF conventions and it looks like they are not prescribing thattime_bnds
should also have aunits
attribute.Solution
I actually don't know what we should do here. I see a couple of ways:
time:units
attribute after decodingtime_bnds
when available, like we do withtime
Thoughts? cc @spencerkclark @jhamman
The text was updated successfully, but these errors were encountered: