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

! Description:  Plot a colored tube 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
! yes?  GO mp_polytube polygon_command xpts ypts values [scale] [smooth]
! $1 - the plot command with qualifiers (eg POLYGON/OVER/KEY)
! $2 - X coordinates of track
! $3 - Y coordinates of track
! $4 - variable whose values will be plotted along the track (eg SST)
! $5 - scale the values by this factor (optional, default 1)
! $6 - 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_polytube poly/over/noaxis/key lon lat sst star 0.5

! argument check
QUERY/IGNORE $1"<usage: yes? GO polytube polygon_command xpts ypts values [scale] [smooth]"
QUERY/IGNORE $2"<usage: yes? GO polytube polygon_command xpts ypts values [scale] [smooth]"
QUERY/IGNORE $3"<usage: yes? GO polytube polygon_command xpts ypts values [scale] [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 polytube $1 x_page*mp_mask y_page*mp_mask $4"0" $5"1" $6"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
