\ cancel mode verify	
!++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++!
! mp_trackplot.jnl --  Map projection version of trackplot.jnl.  For
!                    working with map projection scripts in Ferret v4.50
!		    		
! Jonathan Callahan
! 4/99

! Description:  Plot a trackplot using a predefined map projection. 
!
! This script presumes that following are predefined a projection script
! run previous to this script:
!
!	x_page	field describing transformation from lat/lon to X page coordinates
!	x_page	field describing transformation from lat/lon to Y page coordinates
!	mp_mask  mask for orthographic map projections
!
! Usage:                    $1        $2     $3     $4     $5        $6        $7
! yes?  GO mp_trackplot plot_command xtrack ytrack values [scale] [baseline] [smooth]
! $1 - the plot command with qualifiers (eg PLOT/VS/OVER/LINE=2)
! $2 - X coordinates of track to be plotted
! $3 - Y coordinates of track to be plotted
! $4 - variable whose values will be plotted along the track (eg SST)
! $5 - scale the values by this factor (optional, default 1)
! $6 - baseline (a.k.a. offset) -- what data value is associated with zero
!      displacement from the trackline ans the "horizontal axis" of the trackplot
!      Default = 0
! $7 - smooth the track to be plotted with SBX:$6 (optional, default 3)
!      The "smooth" parameter is given in units of the number of points over
!      which a running mean filter will be applied to the normal vectors. It 
!      is effective only in special cases. For "rough" paths, best results are
!      obtained by smoothing the position data that is passed to this script. 

! Example:
!     set win/size=.4
!     use coads_climatology
!     set region/x=130:250/y=20:64/l=1
!     go mp_hammer
!     set grid sst
!     shade/noaxis sst, x_page, y_page
!     
!     use polydata
!     go mp_trackplot plot/vs/over/noaxis/line=2 lon lat sst values

! argument check
QUERY/IGNORE $1"<usage: yes? GO trackplot plot_command xtrack ytrack values [scale] [baseline] [smooth]"
QUERY/IGNORE $2"<usage: yes? GO trackplot plot_command xtrack ytrack values [scale] [baseline] [smooth]"
QUERY/IGNORE $3"<usage: yes? GO trackplot plot_command xtrack ytrack values [scale] [baseline] [smooth]"

!
! Save the region and grid
!
define region/default save
set grid/save

! Cancel the region because the I index info is used to restrict
! the points to be plotted as a line.
!
can region/x/y

!
! Alter the map projection equations to use xpos and ypos
!
let/quiet mp_x = $2
let/quiet mp_y = $3

go trackplot $1 x_page*mp_mask y_page*mp_mask $4"0" $5"1" $6"0" $7"3"

!
! Restore the region, grid and map projection equations
!
set region save
set grid/restore

let/quiet mp_x = x
let/quiet mp_y = y

!++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++!
set mode/last verify
