\cancel mode verify
! 2/94 - polar_vs.jnl
 

! NOTE: The map projection capabilities beginning with Ferret v5.0
! provide far more flexibility for making plots with curvilinear coordinates.
! Run the script  mp_demo  for an introduction
 

! Description: perform a polar PLOT/VS of 2 variables: lat long

! usage:   GO polar_vs plot_command lats longs

! plot_command:		"PLOT" with its qualifiers (see note below)
!
! lats:			array of latitudes in degrees
!			(must be same number of points as "longs") 
! longs:		array of longitudes in degrees
!			(must be same number of points as "lats") 

!   e.g.   GO polar_vs PLOT/VS/OVERLAY lat long red

! Note on plot command qualifiers:
!  /OVERLAY works fine
!  /SET_UP requires manual setting and resetting of PPL tics and axlabp
!  /X/Y/Z/T/I/J/K/L qualifiers work fine
!  /LINE and /SYMBOL qualifiers work fine

! Note: the rotation parameter is inherited from the other polar routines
! Use    LET polar_rotation="value"   to use this routine apart from the others



! check that parameters are OK to the best we can
query/ignore $1%<Use: GO polar_vs plot_command lats longs [color]%
query/ignore $2%<Use: GO polar_vs plot_command lats longs [color]%
query/ignore $3%<Use: GO polar_vs plot_command lats longs [color]%

let/quiet deg2rad = 3.141592/180
let/quiet polar_cosx = cos($2 * deg2rad)
let/quiet polar_sinx = 0-sin($2 * deg2rad)*signgr
let/quiet polar_cosy = cos($3 * deg2rad)
let/quiet polar_siny = sin($3 * deg2rad)*signgr
let/quiet polar_xpage0 = polar_sinx*polar_cosy/(1+polar_siny)
let/quiet polar_ypage0 = polar_cosx*polar_cosy/(1+polar_siny)

! rotate to arbitrary angle
let/quiet polar_sinrot = sin(polar_rotation*deg2rad)
let/quiet polar_cosrot = cos(polar_rotation*deg2rad)
!let/quiet polar_xpage = polar_sinrot*polar_xpage0 + polar_cosrot*polar_ypage0
!let/quiet polar_ypage = polar_sinrot*polar_ypage0 - polar_cosrot*polar_xpage0
let/quiet polar_xpage = polar_cosrot*polar_xpage0 + signgr*polar_sinrot*polar_ypage0
let/quiet polar_ypage = polar_cosrot*polar_ypage0 - signgr*polar_sinrot*polar_xpage0

GO box_plot $1/vs polar_xpage,polar_ypage

set mode/last verify

message/continue "NOTE: The map projection capabilities beginning with Ferret v5.0"
message/continue "provide far more flexibility for plots with curvilinear coordinates."
message/continue "Run the script  mp_demo  for an introduction"
