! Plot z axis plot with log(p) as vertical coordinate. Need to run one of
! gridded variable. Use in conjunction with lnp_labels to get the z axis
! $1 Command to use to plot (e.g. fill/lev=(-10,10,1) )
! $3 zmin (e.g. 1000 hPa) - for plot range
! $4 zmax (e.g. 10 hPa) - for plot range
! coordinates.
! yes? go p2lnp temperature !Get log P z axis; creates x_lnp variable
! Suppress large and small tics on y axis. Leave x as default
---------------------------
! lnp_labels.jnl
!
! Description: Label z axis for log P plot
!
! DETAILS:
! Control labelling for z axis on log P type plot. Use in conjunction
! with plot_lnp.jnl.
!
! ARGUMENTS:
! $1 zmin (e.g. 1000 hPa)
! $2 zmax (e.g. 10 hPa)
! $3 size for z axis labels (e.g. 0.11)
!
let/quiet zmin = $1
let/quiet zmax = $2
let/quiet size = $3
! Do the major tic marks on the z axis (log)
! First set the grid for the plot so we can use proper 'users' coords
! in the repeat command.
let/quiet logmin = `log(zmin)`
let/quiet logmax = `log(zmax)`
define axis/x=`logmax`:`logmin`:1 xx
define grid/x=xx gg
set grid gg
! Do the tic for the powers of 10 first
repeat/x=`logmax`:`logmin`:1 ppl aline 1,($ppl$xmin),`ln(10^x)`,-92,`ln(10^x)`
! Do the tics for the values '2', '3', '5' and '7' inbetween the major powers of 10
! We don't do all the tics as it'll get too crowded.
let zxmin = logmin-1
! The zmin value may not be an exact power of ten in which case we might need to
! do a 2*10^x value. Should really test to see if this exceeds the $ppl$ymin
! before plotting
!
!(a) Left hand axis
if `int(logmin) ne logmin AND ln(2*10^int(logmin)) le ($ppl$ymax)` then
repeat/x=`logmax`:`int(logmin)`:1 ppl aline 1,($ppl$xmin),`ln(2*10^x)`,-92,`ln(2*10^x)`
else
repeat/x=`logmax`:`int(logmin)-1`:1 ppl aline 1,($ppl$xmin),`ln(2*10^x)`,-92,`ln(2*10^x)`
endif
if `int(logmin) ne logmin AND ln(3*10^int(logmin)) le ($ppl$ymax)` then
repeat/x=`logmax`:`int(logmin)`:1 ppl aline 1,($ppl$xmin),`ln(3*10^x)`,-92,`ln(3*10^x)`
else
repeat/x=`logmax`:`int(logmin)-1`:1 ppl aline 1,($ppl$xmin),`ln(3*10^x)`,-92,`ln(3*10^x)`
endif
if `int(logmin) ne logmin AND ln(3*10^int(logmin)) le ($ppl$ymax)` then
repeat/x=`logmax`:`int(logmin)`:1 ppl aline 1,($ppl$xmin),`ln(5*10^x)`,-92,`ln(5*10^x)`
else
repeat/x=`logmax`:`int(logmin)-1`:1 ppl aline 1,($ppl$xmin),`ln(5*10^x)`,-92,`ln(5*10^x)`
endif
if `int(logmin) ne logmin AND ln(5*10^int(logmin)) le ($ppl$ymax)` then
repeat/x=`logmax`:`int(logmin)`:1 ppl aline 1,($ppl$xmin),`ln(7*10^x)`,-92,`ln(7*10^x)`
else
repeat/x=`logmax`:`int(logmin)-1`:1 ppl aline 1,($ppl$xmin),`ln(7*10^x)`,-92,`ln(7*10^x)`
endif
!(b) Right hand axis - just tics
if `int(logmin) ne logmin AND ln(2*10^int(logmin)) le ($ppl$ymax)` then
repeat/x=`logmax`:`int(logmin)`:1 ppl aline 1,($ppl$xmax),`ln(2*10^x)`,92,`ln(2*10^x)`
else
repeat/x=`logmax`:`int(logmin)-1`:1 ppl aline 1,($ppl$xmax),`ln(2*10^x)`,92,`ln(2*10^x)`
endif
if `int(logmin) ne logmin AND ln(3*10^int(logmin)) le ($ppl$ymax)` then
repeat/x=`logmax`:`int(logmin)`:1 ppl aline 1,($ppl$xmax),`ln(3*10^x)`,92,`ln(3*10^x)`
else
repeat/x=`logmax`:`int(logmin)-1`:1 ppl aline 1,($ppl$xmax),`ln(3*10^x)`,92,`ln(3*10^x)`
endif
if `int(logmin) ne logmin AND ln(3*10^int(logmin)) le ($ppl$ymax)` then
repeat/x=`logmax`:`int(logmin)`:1 ppl aline 1,($ppl$xmax),`ln(5*10^x)`,92,`ln(5*10^x)`
else
repeat/x=`logmax`:`int(logmin)-1`:1 ppl aline 1,($ppl$xmax),`ln(5*10^x)`,92,`ln(5*10^x)`
endif
if `int(logmin) ne logmin AND ln(5*10^int(logmin)) le ($ppl$ymax)` then
repeat/x=`logmax`:`int(logmin)`:1 ppl aline 1,($ppl$xmax),`ln(7*10^x)`,92,`ln(7*10^x)`
else
repeat/x=`logmax`:`int(logmin)-1`:1 ppl aline 1,($ppl$xmax),`ln(7*10^x)`,92,`ln(7*10^x)`
endif
! Do the labelling
let/quiet rightjust = 1
! powers of 10 first
repeat/x=`logmax`:`logmin`:1 label -93, `ln(10^x)`, `rightjust`, 0, `size`, "`10^x`"
if `int(logmin) ne logmin AND ln(2*10^int(logmin)) le ($ppl$ymax)` then
repeat/x=`logmax`:`int(logmin)`:1 label -93,`ln(2*10^x)`,`rightjust`,0,`size`, "`2*10^x`"
else
repeat/x=`logmax`:`int(logmin)-1`:1 label -93,`ln(2*10^x)`,`rightjust`,0,`size`, "`2*10^x`"
endif
if `int(logmin) ne logmin AND ln(3*10^int(logmin)) le ($ppl$ymax)` then
repeat/x=`logmax`:`int(logmin)`:1 label -93,`ln(3*10^x)`,`rightjust`,0,`size`, "`3*10^x`"
else
repeat/x=`logmax`:`int(logmin)-1`:1 label -93,`ln(3*10^x)`,`rightjust`,0,`size`, "`3*10^x`"
endif
if `int(logmin) ne logmin AND ln(3*10^int(logmin)) le ($ppl$ymax)` then
repeat/x=`logmax`:`int(logmin)`:1 label -93,`ln(5*10^x)`,`rightjust`,0,`size`, "`5*10^x`"
else
repeat/x=`logmax`:`int(logmin)-1`:1 label -93,`ln(5*10^x)`,`rightjust`,0,`size`, "`5*10^x`"
endif
if `int(logmin) ne logmin AND ln(5*10^int(logmin)) le ($ppl$ymax)` then
repeat/x=`logmax`:`int(logmin)`:1 label -93,`ln(7*10^x)`,`rightjust`,0,`size`, "`7*10^x`"
else
repeat/x=`logmax`:`int(logmin)-1`:1 label -93,`ln(7*10^x)`,`rightjust`,0,`size`, "`7*10^x`"
endif
! Label y axis (not sure why ferret doesn't do this?)
let/quiet posy = (ln(zmin) + ln(zmax)) / 2
let/quiet centre = 0
let/quiet angle = 90
!label -108,`posy`,`centre`, `angle`, `size*2`, "@ASPressure (hPa)" !Sometimes too big- PY
label -108,`posy`,`centre`, `angle`, `size*1.3`, "@ASPressure (hPa)" !Better