! bn_tax_tstep.jnl   
!
! Working with the coordinates of this axis loses accuracy because its 
! time origin is so far back from the time it represents

DEFINE AXIS/T="1-JAN-2000:00:00:01":"1-JAN-2000:00:15:00":2/UNITS=seconds tsec
LIST/L=440:451 T[GT=tsec]  ! See the accuracy problem here

LET bsin = SIN(t[GT=tsec]/40000)
SAVE/FILE=a.nc/clobber bsin
CAN VAR/all
USE a.nc

SET LIST/PREC=7
! Reset the date to dec 1999
! Function lets us leave off the leading 0.
LIST/L=1:15  TAX_TSTEP(bsin, "1-dec-1999:00:00:00" )

! argument can be upper or lowercase
! Should list values 1, 3, 5...
LIST/L=1:15  TAX_TSTEP(bsin, "1-JAN-2000:00:00:00" )

! Test  with TAX_DATESTRING to set the date (but argument to 
! TAX_DATESTRING is also limited by precision so use a different
! axis def.)

DEFINE AXIS/T="1-JAN-1902:00:00:00":"1-JAN-1902:00:30:00":5/UNITS=seconds tsec
LIST/L=200:205 T[GT=tsec]  ! accuracy loss in single-precision t

LET tt = t[gt=tsec]
LET reset_date = TAX_DATESTRING(`t[gt=tsec,l=1]`, tt, "sec")
LIST/L=1:15 TAX_TSTEP(tt, "`reset_date`")
