Return to Ferret FAQ

Labelling dates along a trackline


Question:

How can I label the dates along a track plot?

Example:


[Output Graphic]

Solution:

Use the LIST command to write a file with the time in it, then spawn commands to Unix commands GREP piped into SED which write a jnl file. Call this to label the plot at desired data points.

Example (Note the use of continuation characters in the last line of the script):


! a dummy track line 
define axis/t=1-jan-1980:1-jan-1985:30/unit=days tax 
let Ypos = 40 *COS(l[gt=tax]/32) 
let xpos = 220 - 50 *sin(l[gt=tax]/22) 

! set the date labelling precision 
set mode cal:days 

! make the basic track plot 
go basemap x=110e:40w y=20s:50n 20 
PLOT/VS/over XPOS,YPOS 

! the labeling will be done by grabbing the "TIME:" line from the 
! standard output listings and generating plot labels from them 

repeat/l=5:60:5 (LIST/CLOBBER/FILE=date.tmp/quiet XPOS; sp rm -f date.jnl; \
sp grep TIME date.tmp | sed 's/TIME     :/label `xpos` `ypos` +1 0 .1 /' >  \
date.jnl;go date ) 

! Clean up
sp rm date.jnl; sp rm date.tmp
  
Here is an alternative way to get the time labels: We can use the time axis and the `RETURN=tstart` syntax:

! Define a dummy track line 

DEFINE AXIS/T=1-JAN-1980:31-JAN-1985:30/UNIT=days tax 
LET ypos = 40 *COS(L[GT=tax]/32) 
LET xpos = 220 - 50 *SIN(L[GT=tax]/22) 

! Make the basic track plot

GO basemap X=110E:40W Y=20S:50N 20 
PLOT/VS/over XPOS,YPOS 

! The labeling will be done using `RETURN=tstart` which gives the
! start of the coordinate region. Note one could use string editing 
! tools to control the formatting of the dates.

REPEAT/L=5:60:5 (LET tlab = "`T[GT=tax],RETURN=tstart`"; LABEL `xpos` `ypos` 1 0 0.1 `tlab`) 

  


Last modified:Jan 11, 2000