cchdo / hydro

The big ol CCHDO netCDF-CF project
https://hydro.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
1 stars 2 forks source link

How to handle datetimes with varying precision #2

Closed DocOtak closed 4 years ago

DocOtak commented 5 years ago

Historically, time, as separate from the date, isn't a required parameter in WHP Exchange files. It was required in WOCE SUM files.

This had led to the situation where only the date with day accuracy is known for a given profile. While this may be adequate for use cases which look at decadal timescales, it is significantly less useful for looking at processes on the day timescale (e.g. internal tides). As such, how well the date/time of a profile is known should be represented somehow.

I see two options, both assume integer representation of datetime:

  1. use the units attribute to indicate how precisely a time is known, some examples:
    1. If date a time are both known to the minute (case for WOCE files): minutes since 1970-01-01T00:00Z
    2. If a date is present, but time is missing (case for a few WHP Exchange files): days since 1970-01-01
  2. Use some currently unspecified additional attribute to indicate how well known the datetime value is. For example date_precision = "day" or date_precision = "minute" when coupled with units which look like minutes since 1970-01-01T00:00Z.

Option 1 feels "cleaner" to me in that its built into the units and conforms to the current wording in the CF document and both udunits and cftime have no issues with the mixed representation. However, people would need to use a library to interpret the values at all times and could not rely on the actual numeric values in the data variable to be comparable across files.

Option 2 involves users needing to look at another attribute to understand the data. It also allows the units to be consistent across files especially if a floating point datatype is used to represent the time.

DocOtak commented 4 years ago

In conversation with Sarah Purkey we have decided the following to use the argo JULD conventions: