Hi Patrick,
The problem here is the conflict between a regular year axis and the irregular gregorian calendar which only repeats every 400 years.
yes? define axis/t=1998:2009:1/units=years/t0=01-JAN-0000 tyear
yes? sho axis tyear
name axis # pts start end
TYEAR TIME 12 r 31-DEC-1997 12:21 31-DEC-2008 04:22
T0 = 01-JAN-0000
Axis span (to cell edges) = 12
! Show 400 year cycle
yes? define axis/t=1600:2000:1/units=years/t0=01-JAN-0000 tyear
Replacing definition of axis TYEAR
yes? sho axis tyear
name axis # pts start end
TYEAR TIME 401 r 01-JAN-1600 00:00 01-JAN-2000 00:00
T0 = 01-JAN-0000
Axis span (to cell edges) = 401
In your first example there is no calendar implied. In the second a standard/gregorian calendar is assumed. If you had the /CAL=NOLEAP qualifier in your axis definition
all would be good.
yes? say `a,return=calendar`
!-> MESSAGE/CONTINUE GREGORIAN
yes? define axis/t=1998:2009:1/units=years/t0=01-JAN-0000/cal=noleap tyear
Replacing definition of axis TYEAR
yes? sho axis tyear
name axis # pts start end
TYEAR TIME 12 r 01-JAN-1998 00:00 01-JAN-2009 00:00
T0 = 01-JAN-0000
CALENDAR = NOLEAP
Axis span (to cell edges) = 12
Cheers,
Russ
From: owner-ferret_users@xxxxxxxx <owner-ferret_users@xxxxxxxx> on behalf of Patrick Brockmann <patrick.brockmann@xxxxxxxxxxxx>
Sent: Tuesday, 19 January 2021 8:03 AM To: ferret users <ferret_users@xxxxxxxx> Subject: [ferret_users] Extract time excursion Hi ferreters,
I would like to extract at ISO
8601 format
start date and end date of a netcdf file.
Here are simplified lines that illustrate a problem of precision.
yes? define axis/t=1998:2009:1/units=years tyear
yes?
let a=t[gt=tyear]
yes? say `a, return=tstart` !-> MESSAGE/CONTINUE 1998 1998 ---> ok
yes? define axis/t=1998:2009:1/units=years/t0=01-JAN-0000 tyear
yes? let a=t[gt=tyear] yes? say `a, return=tstart` !-> MESSAGE/CONTINUE 1997-12-31 12:21:36 1997-12-31 12:21:36 ---> why this 1997-12-31 ???
Attached a netcdf file where the problem exists.
yes? use toto.nc
yes? let a=t[gt=var]
yes? say `a, return=tstart`
!-> MESSAGE/CONTINUE 31-DEC-1949 21:00:00 31-DEC-1949 21:00:00
PS: tested with last 7.6 release
Regards
Patrick
--
Data Analytics and Visualization Engineer / Project Manager LSCE/IPSL, CEA-CNRS-UVSQ laboratory LSCE - Climate and Environment Sciences Laboratory IPSL - Institut Pierre Simon Laplace -- |