\ cancel mode verify	
!++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++!
! mp_line.jnl --  Plot data using a particular map projection.  For working
!                  with map projection scripts in Ferret v4.50
!		    		
! Jonathan Callahan
! 5/97
! Description:  Plots data using a predefined map projection. 
! 10/18 *additions for Ribbon plots
! 04/2019 Extend axis references to allow E or F axis
!
! 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:          arg1     arg2  arg3  arg4
!  go mp_line plot_command xpos  ypos [colorvar]
!
! arg 1 - plot command (eg. "SHADE/VS/OVER")
! arg 2 - X position in user units (world longitude)
! arg 3 - Y position in user units (world latitude)
! [arg 4] - If it's a ribbon plot, the color-by variable
!
! Examples:
!	  go mp_line plot/vs/over my_x my_y
!	  go mp_line plot/vs/ribbon/line/thick/over my_x, my_y, my_colr_var
!

query/ignore $1%<Specify all arguments: plot_command xpos ypos%
query/ignore $2%<Specify all arguments: plot_command xpos ypos%
query/ignore $3%<Specify all arguments: plot_command xpos ypos%

! Save the region and grid

define region/default save

let/quiet mp_central_meridian = `mp_central_meridian`
let/quiet mp_standard_parallel = `mp_standard_parallel`

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

can region/x/y

! Check to make sure the xpos and ypos arrays are one dimensional

let/quiet mp_xpos = $2
let/quiet mp_ypos = $3


define symbol mp_shape_x `mp_xpos,RESULT=SHAPE`
define symbol mp_shape_y `mp_ypos,RESULT=SHAPE`

query/ignore ($mp_shape_x%|X|Y|Z|T|E|F|<error: x position array must be 1-dimensional%)
query/ignore ($mp_shape_y%|X|Y|Z|T|E|F|<error: y position array must be 1-dimensional%)
can variable mp_xpos
can variable mp_ypos

! Alter the map projection equations to use xpos and ypos

let/quiet mp_x = $2
let/quiet mp_y = $3

IF ($4%0|*>1%) THEN
  $1 x_page*mp_mask, y_page*mp_mask, $4*mp_mask
ELSE
   $1 x_page*mp_mask, y_page*mp_mask
ENDIF

! Restore the region and map projection equations

set region save

IF ($mp_grid_variable"0|*>1") THEN
   let/quiet mp_x = x[g=($mp_grid_variable)]
   let/quiet mp_y = y[g=($mp_grid_variable)]
ENDIF

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