DATES
DATE(Timesteps, Precision)
Returns a string array of dates derived from data on a time axis, which may be axis timesteps or a function of the timesteps.
Arguments: |
Timesteps |
Variable on a time axis representing coordinates on the axis, or offsets or other variations of the coordinates. The units of the values are the units of the time axis, e.g. seconds since the time origin, or days since the time origin. |
Precision | String: Desired precision of result date/time strings: "full", "sec", "min", "hour", "day", "month", "year". The "full" output includes fractions of seconds. An empty string "" gives the same result as "full". | |
Result Axes: |
X |
NORMAL (no axis) |
Y |
NORMAL (no axis) |
|
Z |
NORMAL (no axis) |
|
T |
Inherited from argument 1 |
|
E |
NORMAL (no axis) |
|
F | NORMAL (no axis) |
Note: Prior to Ferret v7.6 the function did not have the precision argument.
Note: SET MODE DATE:iso changes the output to iso-8601 date strings.
Examples:
yes? use monthy_navy_winds yes? let times = _t[gt=uwnd,L=40:50] yes? list DATES (times, "month") VARIABLE : DATES(TIMES, "month") FILENAME : monthly_navy_winds.cdf FILEPATH : /home/users/tmap/ferret/linux/fer_dsets/data/ SUBSET : 11 points (TIME) 17-APR-1985 / 40:"JUL-1990" 18-MAY-1985 / 41:"SEP-1990" 17-JUN-1985 / 42:"NOV-1990" 18-JUL-1985 / 43:"JAN-1991" 17-AUG-1985 / 44:"MAR-1991" 17-SEP-1985 / 45:"MAY-1991" 17-OCT-1985 / 46:"JUL-1991" 16-NOV-1985 / 47:"SEP-1991" 17-DEC-1985 / 48:"NOV-1991" 16-JAN-1986 / 49:"JAN-1992" 16-FEB-1986 / 50:"MAR-1992"
Define an equally-spaced axis with 12 points.
yes? define axis /t="1-JAN-2020":"1-JAN-2021":`86400.0*366.0/12.0` /t0="1-JAN-2020" /edges /unit=seconds dates_taxis yes? list dates(t[gt=dates_taxis], "full") VARIABLE : DATES(T[GT=DATES_TAXIS], "full") SUBSET : 12 points (TIME) 16-JAN-2020 / 1:"31-JAN-2020 12:00:00.0" 15-FEB-2020 / 2:"01-APR-2020 12:00:00.0" 17-MAR-2020 / 3:"01-JUN-2020 12:00:00.0" 16-APR-2020 / 4:"01-AUG-2020 12:00:00.0" 17-MAY-2020 / 5:"01-OCT-2020 12:00:00.0" 16-JUN-2020 / 6:"01-DEC-2020 12:00:00.0" 17-JUL-2020 / 7:"31-JAN-2021 12:00:00.0" 16-AUG-2020 / 8:"02-APR-2021 12:00:00.0" 16-SEP-2020 / 9:"02-JUN-2021 12:00:00.0" 16-OCT-2020 / 10:"02-AUG-2021 12:00:00.0" 16-NOV-2020 / 11:"02-OCT-2021 12:00:00.0" 16-DEC-2020 / 12:"02-DEC-2021 12:00:00.0"
Define a variable based on the time coordinates but with offsets that introduce fractions of seconds.
yes? let offsets = _t[gt=dates_taxis] - 1.1*L[gt=dates_taxis] yes? list dates(offsets, "full") VARIABLE : DATES(OFFSETS, "full") SUBSET : 12 points (TIME) 16-JAN-2020 / 1:"31-JAN-2020 11:59:58.9" 15-FEB-2020 / 2:"01-APR-2020 11:59:57.8" 17-MAR-2020 / 3:"01-JUN-2020 11:59:56.7" 16-APR-2020 / 4:"01-AUG-2020 11:59:55.6" 17-MAY-2020 / 5:"01-OCT-2020 11:59:54.5" 16-JUN-2020 / 6:"01-DEC-2020 11:59:53.4" 17-JUL-2020 / 7:"31-JAN-2021 11:59:52.3" 16-AUG-2020 / 8:"02-APR-2021 11:59:51.2" 16-SEP-2020 / 9:"02-JUN-2021 11:59:50.1" 16-OCT-2020 / 10:"02-AUG-2021 11:59:49.0" 16-NOV-2020 / 11:"02-OCT-2021 11:59:47.9" 16-DEC-2020 / 12:"02-DEC-2021 11:59:46.8"