\cancel mode verify	! ... now overlaying coastal outline ...
! 
! Description: Plot outlines of continents, countries, and/or states
! Chooses the resolution based on the region being plotted:
! calls land.jnl or land_detail.jnl
!
!
!		        arg 1	      arg 2	   arg 3        arg 4        arg 5        arg 6        arg 7
! usage:   GO landz [continent_pen] ["basemap"] [country_pen] [state_pen] [major_rivers] [more_rivers] [marine]
!
!    arg1  continent_pen 
!    arg2 "basemap" "overlay", or omitted for overlay
!    arg3 country_pen	Pen for optional national boundaries 
!    arg4 state_pen	Pen for optional state boundaries (Western hemisphere)
!    arg5 rivers_pen	Pen for largest rivers
!    arg6 more_rivers	Pen for additional rivers 
!    arg7 marine boundaries  Pen for marine boundaries in South Pacific, Bering Strait
!
! Rivers and marine boundaries are only available as part of the higher-resolution dataset.
! Arguments 5, 6, and 7 will be ignored for ranges delta-x over 60 and delta-y over 30 degrees.

!Examples

!   GO landz red           - overlay continents using red pen (2)
!   GO landz  10           - overlay continents using pen number 10
!   GO landz 1 basemap     - basemap of continents outline in foreground color
!   GO landz 1 " " red     - overlay continents with countries in red
!   GO landz thick basemap black black - continents, countries, and states
!   GO landz N " " 1 1     - overlay: no continents; yes political boundaries
!   go landz black " " red green blue lightblue purple - continents, countries, states, 
!                                                 all rivers, and marine boundaries

! test argument before performing any actions
query/ignore $1%1|black|red|green|blue|lightblue|purple|white|thick|0|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|N|<go land_detail [pen or "N"] ["basemap"] [pen] [pen] with pen = 0(back), 1(fore), thick, 2-18 or a color%
query/ignore $2%default|basemap|overlay|<argument 2 can be "basemap", "overlay"%
query/ignore $3%1|black|red|green|blue|lightblue|purple|white|thick|0|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|N|<go land_detail [pen or "N"] ["basemap"] [pen] [pen] with pen = 0(back), 1(fore), thick, 2-18 or a color%
query/ignore $4%1|black|red|green|blue|lightblue|purple|white|thick|0|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|N|<go land_detail [pen or "N"] ["basemap"] [pen] [pen] with pen = 0(back), 1(fore), thick, 2-18 or a color%
query/ignore $5%1|black|red|green|blue|lightblue|purple|white|thick|0|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|N|<go land_detail [pen or "N"] ["basemap"] [pen] [pen] with pen = 0(back), 1(fore), thick, 2-18 or a color%
query/ignore $6%1|black|red|green|blue|lightblue|purple|white|thick|0|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|N|<go land_detail [pen or "N"] ["basemap"] [pen] [pen] with pen = 0(back), 1(fore), thick, 2-18 or a color%
query/ignore $7%1|black|red|green|blue|lightblue|purple|white|thick|0|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|N|<go land_detail [pen or "N"] ["basemap"] [pen] [pen] with pen = 0(back), 1(fore), thick, 2-18 or a color%

! Determine which land-line script to call

LET landi_basemap = $2%0|basemap>1|*>0%

IF `landi_basemap EQ 1` THEN
   GO basemap " " " " " " white
ENDIF

LET landi_mapxmin = ($xaxis_min)
LET landi_mapxmax = ($xaxis_max)
LET landi_mapymin = ($yaxis_min)
LET landi_mapymax = ($yaxis_max)

! Decide which script to use: standard land.jnl or land_detail.jnl
LET region_x_range = ($xaxis_max) - ($xaxis_min)
LET region_y_range = ($yaxis_max) - ($yaxis_min)

LET lz_detailed = 0
IF `( region_x_range LT 80) OR ( region_y_range LT 40)` THEN LET lz_detailed = 1

! Set symbols for arguments to pass to the land script
$1%1|*>DEFINE SYMBOL lz_continent = $1%
$3%query/ignore|*>DEFINE SYMBOL lz_country = $3% 
$4%query/ignore|*>DEFINE SYMBOL lz_state = $4% 
$5%query/ignore|*>DEFINE SYMBOL lz_river1 = $5% 
$6%query/ignore|*>DEFINE SYMBOL lz_river2 = $6% 
$7%query/ignore|*>DEFINE SYMBOL lz_marine = $7% 

! If an argument symbol is not defined, send placeholder " ".

IF `lz_detailed GT 0` THEN
   GO land_detail ($lz_continent) "overlay" ($lz_country%" "%) ($lz_state%" "%) ($lz_river1%" "%) ($lz_river2%" "%) ($lz_marine%" "%)
ELSE
   GO land ($lz_continent) "overlay" ($lz_country%" "%) ($lz_state%" "%) 
ENDIF

! Clean up
cancel symbol lz_continent
cancel symbol lz_country
cancel symbol lz_state
cancel symbol lz_river1
cancel symbol lz_river2
cancel symbol lz_marine


!  ----------------- End of landz.jnl ------------------------------------
