NOAA-PMEL / Ferret

The Ferret program from NOAA/PMEL
https://ferret.pmel.noaa.gov/Ferret/
The Unlicense
55 stars 20 forks source link

Time axes with fractional seconds #1856

Closed AnsleyManke closed 6 years ago

AnsleyManke commented 6 years ago

There will be Saildrone data with sampling intervals less than a second. There's a cooked-up test file at /home/data/saildrone/examples/sub_hz_a.nc

yes? use /home/data/saildrone/examples/sub_hz_a.nc

yes? set list/precision=5
yes? set mode calendar:seconds

yes? define axis/t/t0=1-jan-1970/units=seconds tax = time
yes? let temp_on_time = reshape(temp_ctd_mean, t[gt=tax])

! This plot is fine, showing 6 hours data
yes? plot temp_on_time

! And this plot is fine, showing 5 minutes' data
yes? plot/t="2-sep-2017:01:00":"2-sep-2017:01:05" temp_on_time

! Time ranges under a minute plot successfully, but labeling of time axis is inadequate
yes? plot/t="2-sep-2017:01:00":"2-sep-2017:01:01" temp_on_time

Ferret will need a couple of enhancements to be able to work with these:

1) Listings showing date/time do not list the fractional seconds along with the date/time

yes? list/t="2-sep-2017:01:00:00":"2-sep-2017:01:00:03"/prec=5 temp_on_time
             VARIABLE : Seawater temperature (degrees_c)
             FILENAME : sub_hz_a.nc
             FILEPATH : /home/data/saildrone/examples/
             SUBSET   : 16 points (TIME)
 02-SEP-2017 01:00:00 / 18001:  20.243
 02-SEP-2017 01:00:00 / 18002:  20.240
 02-SEP-2017 01:00:00 / 18003:  20.231
 02-SEP-2017 01:00:00 / 18004:  20.228
 02-SEP-2017 01:00:00 / 18005:  20.223
 02-SEP-2017 01:00:01 / 18006:  20.219
 02-SEP-2017 01:00:01 / 18007:  20.221
 02-SEP-2017 01:00:01 / 18008:  20.225
 02-SEP-2017 01:00:01 / 18009:  20.227
 02-SEP-2017 01:00:01 / 18010:  20.223
 02-SEP-2017 01:00:02 / 18011:  20.221
 02-SEP-2017 01:00:02 / 18012:  20.218
 02-SEP-2017 01:00:02 / 18013:  20.209
 02-SEP-2017 01:00:02 / 18014:  20.202
 02-SEP-2017 01:00:02 / 18015:  20.190
 02-SEP-2017 01:00:03 / 18016:  20.191

2) Command syntax for date/time doesn't allow times with fractional seconds

yes? list/t="2-sep-2017:01:00:00.4"/prec=5 temp_on_time
 **ERROR: command syntax: 2-sep-2017:01:00:00.4 is not valid in this calendar

3) Plots of subsets smaller than a minute plot on an axis that's a full minute long, and it's labeled only at the ends.
yes? plot/t="2-sep-2017:01:00:10":"2-sep-2017:01:00:30" temp_on_time

Ferret has a MODE CALENDAR. If you turn it off, it'll make listings and plots using the coordinates, untranslated to calendar units. This can be useful, to just make a plot with a simple axis labeled "days" for instance. This would be an option here - except that the gigantic values of seconds-since-1970 make the code that would label axis tic marks fail.

4) Regridding to other time axes works but inconsistently.

! Define a time axis with intervals of 1 minute
yes?  define axis/t="1-sep-2017:00:00":"4-sep-2017:00:00":1/units=minutes tmin

! Regrid our data to this, results in an error.
yes? plot/t="2-sep-2017:00:00":"2-sep-2017:06:00" temp_on_time[gt=tmin]
 **ERROR: illegal limits: One-point independent axis: Requires a /HLIMIT or /VLIMIT specification

! Internal setup of index ranges related to the requested time range weren't done right by the
! above command, but just repeating the command gives a correct plot.  So there is some bug
! related to the high-resolution coordinates.

yes? plot/t="2-sep-2017:00:00":"2-sep-2017:06:00" temp_on_time[gt=tmin]

@eugeneburger @kevin-obrien @noaaroland

AnsleyManke commented 6 years ago

These are addressed. There's potential for more improvement on plots - I plot only ranges of whole minutes, not subsets of minutes, but we can work on that if needed.

With the dataset and variable temp_on_time defined as above,

! row-headers include fractional seconds.
yes? list/t="2-sep-2017:01:00:02":"2-sep-2017:01:00:03"/prec=5 temp_on_time
             VARIABLE : RESHAPE(TEMP_CTD_MEAN, T[GT=TAX])
             FILENAME : sub_hz_a.nc
             FILEPATH : /home/data/saildrone/examples/
             SUBSET   : 6 points (TIME)
 02-SEP-2017 01:00:02.0 / 18011:  20.221
 02-SEP-2017 01:00:02.2 / 18012:  20.218
 02-SEP-2017 01:00:02.4 / 18013:  20.209
 02-SEP-2017 01:00:02.6 / 18014:  20.202
 02-SEP-2017 01:00:02.8 / 18015:  20.190
 02-SEP-2017 01:00:03.0 / 18016:  20.191

! specify time with fractional seconds and it's translated to the right timestep

yes?  list/t="2-sep-2017:01:00:02.4"/prec=5 temp_on_time
             VARIABLE : RESHAPE(TEMP_CTD_MEAN, T[GT=TAX])
             FILENAME : sub_hz_a.nc
             FILEPATH : /home/data/saildrone/examples/
             TIME     : 02-SEP-2017 01:00:02.4
          20.209

Attached is the plot from the end of the first set of commands above, showing labels on the time axis having enough resolution:

yes? plot/t="2-sep-2017:01:00":"2-sep-2017:01:01" temp_on_time

seconds