-
Notifications
You must be signed in to change notification settings - Fork 2
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
Is your feature request related to a problem? Please describe.
Currently there are few checks on time co-ordinates. For instance, a plain int64 array with attributes of {"units": "marshmallows"} passes all current checks.
Describe the solution you'd like
First we need to decide what time specifications should be allowed and disallowed.
- One obvious restriction is that time specifiers should be timezone-aware; it is hard to come up with a plausible use case for a timezone-naive time co-ordinate, and it tends to cause errors when indexing.
datetime64[ns]is a special case; it's the standard time type used by xarray, it doesn't contain any explicit timezone information, and using it as input to thepandas.Timestampconstructor gives a timezone-naive timestamp. However, a close reading of the NumPy documentation confirms thatdatetime64is defined in terms of the Unix epoch, and therefore has an implicit UTC timezone.- When reading a dataset, xarray will automatically decode CF-compliant time specifiers to
datetime64[ns](if possible) orcftime. Should we also support "raw" time co-ordinates with undecoded CF attributes? - What should we support outside of standard xarray practice and CF conventions? e.g. the compliant dataset in the xrlint example notebook has an
int64time co-ordinate with the annotation{"units": "years"}, which follows neither xarray nor CF conventions.
Describe alternatives you've considered
One alternative would be to decide that time co-ordinates are simply too variable and complex to be checked reliably, and to refrain from writing any rules for them.
Additional context
- GitHub - NCAS-CMS/cfunits: A Python interface to UNIDATA’s UDUNITS-2 library with CF extensions:
- CF conventions for time doesn't support years · Issue #1467 · pydata/xarray · GitHub
- If a variable’s time is a time range, what should be used for its time coordinate?
- Time series data
- NetCDF Climate and Forecast (CF) Metadata Conventions
- cftime — cftime 1.0 documentation
- Unidata | UDUNITS
- Metadata recommendations for encoding NetCDF products based on CF convention - Copernicus Services - ECMWF Confluence Wiki
- 4.4. Time Coordinate
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request