! bn_auto_tprec.jnl
! See ticket 2405
! Time labels on plots always just get the precision from MODE CALENDAR
! Instead, use the same logic as is used for text labels, automatically adjust.
! (later make this the default setting??)
! acm* 3/17 check the URL with TEST_OPENDAP befor trying to open it.

set mode calendar:auto
show mode calendar

use levitus_climatology
let ttim = temp + t[gt=tax]

!  Varies in seconds
define axis/t/units="seconds"/t0="1-jan-2001" tax = {1,12,13,14,16,17,18,19,24}

list/k=1/x=60/y=-40 ttim
shade/title="seconds"/l=9/k=1/x=60:70/y=-40:-30 ttim; sh sym  lab($labnum_t)

!  Varies in minutes, fractions of minutes
define axis/t/units="minutes"/t0="1-jan-2001" tax = {1,1.1,12,13,14,16,17,18.5,19,24}
list/k=1/x=60/y=-40 ttim
shade/title="minutes/fractions of minutes"/l=9/k=1/x=60:70/y=-40:-30 ttim; sh sym  lab($labnum_t)

! varies in hours, fractions of hours
define axis/t/units="hour"/t0="1-jan-2001" tax = {1,1.1,12.1,12.2,14,16,17,18.5,19,24}
list/k=1/x=60/y=-40 ttim
shade/title="hours/fractions of hours"/l=3/k=1/x=60:70/y=-40:-30 ttim; sh sym  lab($labnum_t)

! 6-hour even spacing
define axis/t=1-jan-2001:8-jan-2001:6/units="hour"/t0="1-jan-2001" tax 
list/k=1/x=60/y=-40/L=1:6 ttim
shade/title="hours "/l=3/k=1/x=60:70/y=-40:-30 ttim; sh sym  lab($labnum_t)

! Reynolds SST weekly, even 7-day spacing

IF `test_opendap("http://ferret.pmel.noaa.gov/pmel/thredds/dodsC/data/PMEL/reynolds_sst_wk.nc") EQ 0` THEN
   use http://ferret.pmel.noaa.gov/pmel/thredds/dodsC/data/PMEL/reynolds_sst_wk.nc
   list/x=180/y=0/l=20:25 fsst
   shade/title="7-day axis"/l=30/x=60:70/y=-40:-30 fsst; sh sym  lab($labnum_t)
ELSE
   say OPenDAP data not available for testing.. Tests skipped ...
ENDIF

! monthly climatology
use TAO_SST_clim
list/x=180/y=0 sst_clim
shade/title="monthly climatology"/k=1/l=5 sst_clim; sh sym  lab($labnum_t)

! truemonth
use truemonth
list/x=180/y=0/l=20:25 var

let ttim = temp[d=levitus_climatology] + var 
shade/title="true-month axis"/L=32/x=60:70/y=-40:-30 ttim; sh sym  lab($labnum_t)

set mode/last calendar

! Is the default precision of minutes restored?
use truemonth
let ttim = temp[d=levitus_climatology] + var 
shade/title="true-month axis"/L=32/x=60:70/y=-40:-30 ttim; sh sym  lab($labnum_t)
