[Thread Prev][Thread Next][Index]

Re: [ferret_users] stippled to an extended area



Hi all,
Paul wrote back asking about the mp_land.jnl and mp_land_detail.jnl scripts. Those scripts didn't have the extra commands added to them to do modulo replications. The corrected versions are attached, and will be part of the next Ferret release.

Ansley

On 3/26/2012 10:25 AM, Ansley Manke wrote:
Hi Paul,
The "go land" and land_detail scripts do use plot/vs, but they add the necessary commands to plot the extra modulo replications that would be needed to overlay on a plot from -180 to 180 (or other typical plots.)

Give it a try: plot whatever range you like, even more than one wrap around the earth:

yes? use etopo20
yes? shade/x=-270:540 rose
yes? go land

Ansley

On 3/23/2012 8:42 AM, Paul Young wrote:
Hi Ansley,

Just to clarify, is your statement also true for adding country outlines? I guess that uses plot/vs, and I seem to remember having problems with getting all the countries included when my map ran 180W:180E....

Thanks,

Paul



On Mar 22, 2012, at 10:24 AM, Ansley Manke wrote:

Hi Kelin
(I am adding a cc to the Users List - you must have forgotten to send your question to the list address as well).

To ask for the PLOT/VS command to go beyond the x-values in the x variable, you need to add or subtract 360 from the x variable, depending on which direction it needs to be extended:

shade field[x=40e:400e]
plot/over/nolab/vs/symbol=dot/color=black stiple_a,stiple_b
plot/over/nolab/vs/symbol=dot/color=black stiple_a+360,stiple_b
plot/over/nolab/vs/symbol=dot/color=black stiple_a-360,stiple_b

The modulo x axis of your variable "field" causes Ferret to automatically do a similar operation when it does the SHADE command, but PLOT/VS doesn't apply a modulo operation to the x values it plots.

Ansley

On 3/21/2012 3:43 PM, Kelin Zhuang wrote:
Dear Ansley and forum,
I have a question to ask: How to extend stippled mark? For example, if I plot in a ferret default sense,
shade field
plot/over/nolab/vs/symbol=dot/color=black stiple_a,stiple_b
then I got a normal stippling in the whole region but if I extend the display to, say, x=40e:400e, then
shade field[x=40e:400e]
plot/over/nolab/vs/hlimits=40e:400e:1/symbol=dot/color=black stiple_a,stiple_b then I couldn't get what I want to get, i.e. no stippling west of 180E in the figure. No stippling in the Indian.
Would you kindly help me? I attached the netcdf and two figures.
Best,
Kelin
\cancel mode verify	
! ... now overlaying coastal outline ...

! Description: Plot outlines of continents, countries, and/or states

!		        arg 1	      arg 2	   arg 3        arg 4
! Usage:   GO mp_land [continent_pen] ["basemap"] [country_pen] [state_pen]

! pens 	may be "0"(background), "1"(foreground), "thick"(same as pen 7),
!	"black", "red", "green", "blue", or 2-18.
! arg 2 may be "basemap", "overlay", "fast" (fast, 20e:20e overlay) or omitted

!	Note 1: A pen color of "black" will actually pen number 1
!		-- normally white if the window background is black
!	Note 2: An "N" for the continent pen means no continents
!		-- use this for the special case of geo-political
!		   overlay without continents.

! Example:
!   GO mp_land red        	  - overlay continents using red pen (2)
!   GO mp_land  10           - overlay continents using pen number 10
!   GO mp_land 1 basemap     - basemap of continents outline in foreground color
!   GO mp_land 1 fast        - overlay continents in region 20e to 380, only
!   GO mp_land 1 " " red     - overlay continents with countries in red
!   GO mp_land thick basemap black black - continents, countries, and states
!   GO mp_land N " " 1 1     - overlay: no continents; yes political boundaries

! Notes:
!  1) If a pen value is given for the country_pen or state_pen then the
!	corresponding geopolitical boundaries will be drawn - else
!	they will be omitted
!  2) use  GO line_samples    to view the first 6 pen numbers
!       Higher pen numbers cycle with thicker lines (max 18)
!  3) For more control over basemaps use "GO basemap"

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

! introduce the outline data set
set data/save
set grid/save

let/quiet mp_x = x
let/quiet mp_xmin = `mp_x[i=@min]`
let/quiet mp_xmax = `mp_x[i=@max]`
let/quiet mp_y = y
let/quiet mp_ymin = `mp_y[j=@min]`
let/quiet mp_ymax = `mp_y[j=@max]`
let/quiet mp_std_parallel_north = mp_ymax
let/quiet mp_std_parallel_south = mp_ymin

!
! This test will keep the central meridians defined by "from space" views
!
let/quiet mp_test = `mp_central_meridian` - `(mp_x[i=@max] + mp_x[i=@min])/2`
if `mp_test eq 0` then
   let/quiet mp_central_meridian = `(mp_x[i=@max] + mp_x[i=@min])/2`
endif
let/quiet mp_test = `mp_standard_parallel` - `(mp_y[j=@max] + mp_y[j=@min])/2`
if `mp_test eq 0` then
   let/quiet mp_standard_parallel = `(mp_y[j=@max] + mp_y[j=@min])/2`
endif
cancel variable mp_test


use geo_borders

! Initialize
let landi_subx = 0
let landi_addx = 0
let landi_datxmin = continent_lon[x=@min]
let landi_datxmax = continent_lon[x=@max]

let landi_basemap = $2"0|basemap>1|*>0"
IF `landi_basemap EQ 0` THEN

   IF `mp_xmin LT landi_datxmin` then let landi_subx = `landi_subx - 360`
   IF `mp_xmax GT landi_datxmax` then let landi_addx = `landi_addx + 360`

ENDIF
 

! always do the continents
set grid CONTINENT_LON
let/quiet mp_lambda = if (CONTINENT_LON ge mp_xmin and CONTINENT_LON le mp_xmax and CONTINENT_LAT ge mp_ymin and CONTINENT_LAT le mp_ymax) then (CONTINENT_LON * deg2rad)
let/quiet mp_phi = if (CONTINENT_LON ge mp_xmin and CONTINENT_LON le mp_xmax and CONTINENT_LAT ge mp_ymin and CONTINENT_LAT le mp_ymax) then (CONTINENT_LAT * deg2rad)
let/quiet masked_x_page = mp_mask * x_page
let/quiet masked_y_page = mp_mask * y_page
$1"plot|N>QUERY/IGNORE stuff |*>plot"/set/vs/nolab/noax/line=1/$2"i=1:22585/overlay|basemap>i=4886:13712|fast>i=4886:13712/overly|*>i=1:22585/overlay" masked_x_page, masked_y_page

! select line style and plot
ppl pen 1 $1"1|black>1|red>2|green>3|blue>4|thick>7|0>0|1>1|2>2|3>3|4>4|5>5|6>6|7>7|8>8|9>9|10>10|11>11|12>12|13>13|14>14|15>15|16>16|17>17|18>18|N>1|"

! set up axis formatting in case it is a basemap  !!! incorrect for map projection plots!
! ppl xfor (I7,''LONE'')
! ppl yfor (I7,''LAT'')

! draw it - as an overlay or as a basemap
$1"ppl plot|N>QUERY/IGNORE stuff |*>ppl plot"$2"/overlay|basemap> |*>/overlay"


! Draw any lines outside 0 to 360
IF ($1"0|*>1") THEN

IF `landi_addx NE 0` THEN 
  set grid continent_lon
  let/quiet mp_lambda = if ((continent_lon+landi_addx) ge mp_xmin and (continent_lon+landi_addx) le mp_xmax and \
   continent_lat ge mp_ymin and continent_lat le mp_ymax) then ((continent_lon+landi_addx) * deg2rad)
  let/quiet mp_phi = if ((continent_lon+landi_addx) ge mp_xmin and (continent_lon+landi_addx) le mp_xmax and \
   continent_lat ge mp_ymin and continent_lat le mp_ymax) then (continent_lat * deg2rad)
  let/quiet masked_x_page = mp_mask * x_page
  let/quiet masked_y_page = mp_mask * y_page
  $1"plot|N>QUERY/IGNORE stuff |*>plot"/set/vs/nolab/noax/line=1/$2"i=1:200826/overlay|basemap>i=1:200826/overly|*>i=1:200826/overlay" masked_x_page, masked_y_page
  ppl pen 1 $1"1|black>1|red>2|green>3|blue>4|lightblue>5|purple>6|white>19|thick>7|0>0|1>1|2>2|3>3|4>4|5>5|6>6|7>7|8>8|9>9|10>10|11>11|12>12|13>13|14>14|15>15|16>16|17>17|18>18|N>1|"
  $1"ppl plot|N>QUERY/IGNORE stuff |*>ppl plot"$2"/overlay|basemap> |*>/overlay"
ENDIF
IF `landi_subx NE 0` THEN 
  set grid continent_lon
  let/quiet mp_lambda = if ((continent_lon+landi_subx) ge mp_xmin and (continent_lon+landi_subx) le mp_xmax and \
   continent_lat ge mp_ymin and continent_lat le mp_ymax) then ((continent_lon+landi_subx) * deg2rad)
  let/quiet mp_phi = if ((continent_lon+landi_subx) ge mp_xmin and (continent_lon+landi_subx) le mp_xmax and \
   continent_lat ge mp_ymin and continent_lat le mp_ymax) then (continent_lat * deg2rad)
  let/quiet masked_x_page = mp_mask * x_page
  let/quiet masked_y_page = mp_mask * y_page
  $1"plot|N>QUERY/IGNORE stuff |*>plot"/set/vs/nolab/noax/line=1/$2"i=1:200826/overlay|basemap>i=1:200826/overly|*>i=1:200826/overlay" masked_x_page, masked_y_page
  ppl pen 1 $1"1|black>1|red>2|green>3|blue>4|lightblue>5|purple>6|white>19|thick>7|0>0|1>1|2>2|3>3|4>4|5>5|6>6|7>7|8>8|9>9|10>10|11>11|12>12|13>13|14>14|15>15|16>16|17>17|18>18|N>1|"
  $1"ppl plot|N>QUERY/IGNORE stuff |*>ppl plot"$2"/overlay|basemap> |*>/overlay"
ENDIF

ENDIF  ! lines outside 0 to 360

! **** now the optional country borders
set grid COUNTRY_LON
let/quiet mp_lambda = if (COUNTRY_LON ge mp_xmin and COUNTRY_LON le mp_xmax and COUNTRY_LAT ge mp_ymin and COUNTRY_LAT le mp_ymax) then (COUNTRY_LON * deg2rad)
let/quiet mp_phi = if (COUNTRY_LON ge mp_xmin and COUNTRY_LON le mp_xmax and COUNTRY_LAT ge mp_ymin and COUNTRY_LAT le mp_ymax) then (COUNTRY_LAT * deg2rad)
let/quiet masked_x_page = mp_mask * x_page
let/quiet masked_y_page = mp_mask * y_page
$3"query/ignore|*>plot/set/vs/nolab/line=1/x=1:91083/overlay" masked_x_page, masked_y_page

! select line style and plot
ppl pen 1 $3"1|black>1|red>2|green>3|blue>4|thick>7|0>0|1>1|2>2|3>3|4>4|5>5|6>6|7>7|8>8|9>9|10>10|11>11|12>12|13>13|14>14|15>15|16>16|17>17|18>18|"

! draw it - as an overlay or as a basemap
$3"query/ignore|*>ppl plot/overlay"

! Draw any lines outside 0 to 360
IF ($3"0|*>1") THEN

IF `landi_addx NE 0` THEN 
  set grid COUNTRY_LON
  let/quiet mp_lambda = if ((country_lon+landi_addx) ge mp_xmin and (country_lon+landi_addx) le mp_xmax and \
   country_lat ge mp_ymin and country_lat le mp_ymax) then ((country_lon+landi_addx) * deg2rad)
  let/quiet mp_phi = if ((country_lon+landi_addx) ge mp_xmin and (country_lon+landi_addx) le mp_xmax and \
   country_lat ge mp_ymin and country_lat le mp_ymax) then (country_lat * deg2rad)
  let/quiet masked_x_page = mp_mask * x_page
  let/quiet masked_y_page = mp_mask * y_page
  $3"plot|N>QUERY/IGNORE stuff |*>plot"/set/vs/nolab/noax/line=1/$2"i=1:200826/overlay|basemap>i=1:200826/overly|*>i=1:200826/overlay" masked_x_page, masked_y_page
  ppl pen 1 $3"1|black>1|red>2|green>3|blue>4|lightblue>5|purple>6|white>19|thick>7|0>0|1>1|2>2|3>3|4>4|5>5|6>6|7>7|8>8|9>9|10>10|11>11|12>12|13>13|14>14|15>15|16>16|17>17|18>18|N>1|"
  $3"ppl plot|N>QUERY/IGNORE stuff |*>ppl plot"$2"/overlay|basemap> |*>/overlay"
ENDIF
IF `landi_subx NE 0` THEN 
  set grid COUNTRY_LON
  let/quiet mp_lambda = if ((country_lon+landi_subx) ge mp_xmin and (country_lon+landi_subx) le mp_xmax and \
   country_lat ge mp_ymin and country_lat le mp_ymax) then ((country_lon+landi_subx) * deg2rad)
  let/quiet mp_phi = if ((country_lon+landi_subx) ge mp_xmin and (country_lon+landi_subx) le mp_xmax and \
   country_lat ge mp_ymin and country_lat le mp_ymax) then (country_lat * deg2rad)
  let/quiet masked_x_page = mp_mask * x_page
  let/quiet masked_y_page = mp_mask * y_page
  $3"plot|N>QUERY/IGNORE stuff |*>plot"/set/vs/nolab/noax/line=1/$2"i=1:200826/overlay|basemap>i=1:200826/overly|*>i=1:200826/overlay" masked_x_page, masked_y_page
  ppl pen 1 $3"1|black>1|red>2|green>3|blue>4|lightblue>5|purple>6|white>19|thick>7|0>0|1>1|2>2|3>3|4>4|5>5|6>6|7>7|8>8|9>9|10>10|11>11|12>12|13>13|14>14|15>15|16>16|17>17|18>18|N>1|"
  $3"ppl plot|N>QUERY/IGNORE stuff |*>ppl plot"$2"/overlay|basemap> |*>/overlay"
ENDIF

ENDIF  ! lines outside 0 to 360

! **** now the optional state borders
set grid STATE_LON
let/quiet mp_lambda = if (STATE_LON ge mp_xmin and STATE_LON le mp_xmax and STATE_LAT ge mp_ymin and STATE_LAT le mp_ymax) then (STATE_LON * deg2rad)
let/quiet mp_phi = if (STATE_LON ge mp_xmin and STATE_LON le mp_xmax and STATE_LAT ge mp_ymin and STATE_LAT le mp_ymax) then (STATE_LAT * deg2rad)
let/quiet masked_x_page = mp_mask * x_page
let/quiet masked_y_page = mp_mask * y_page
$4"query/ignore|*>plot/set/vs/nolab/line=1/x=1:7034/overlay" masked_x_page, masked_y_page

! select line style and plot
ppl pen 1 $4"1|black>1|red>2|green>3|blue>4|thick>7|0>0|1>1|2>2|3>3|4>4|5>5|6>6|7>7|8>8|9>9|10>10|11>11|12>12|13>13|14>14|15>15|16>16|17>17|18>18|"

! draw it - as an overlay or as a basemap
$4"query/ignore|*>ppl plot/overlay"


! Draw any lines outside 0 to 360
IF ($4"0|*>1") THEN

IF `landi_addx NE 0` THEN 
  set grid state_LON
  let/quiet mp_lambda = if ((state_lon+landi_addx) ge mp_xmin and (state_lon+landi_addx) le mp_xmax and \
   state_lat ge mp_ymin and state_lat le mp_ymax) then ((state_lon+landi_addx) * deg2rad)
  let/quiet mp_phi = if ((state_lon+landi_addx) ge mp_xmin and (state_lon+landi_addx) le mp_xmax and \
   state_lat ge mp_ymin and state_lat le mp_ymax) then (state_lat * deg2rad)
  let/quiet masked_x_page = mp_mask * x_page
  let/quiet masked_y_page = mp_mask * y_page
  $4"plot|N>QUERY/IGNORE stuff |*>plot"/set/vs/nolab/noax/line=1/$2"i=1:200826/overlay|basemap>i=1:200826/overly|*>i=1:200826/overlay" masked_x_page, masked_y_page
  ppl pen 1 $4"1|black>1|red>2|green>3|blue>4|lightblue>5|purple>6|white>19|thick>7|0>0|1>1|2>2|3>3|4>4|5>5|6>6|7>7|8>8|9>9|10>10|11>11|12>12|13>13|14>14|15>15|16>16|17>17|18>18|N>1|"
  $4"ppl plot|N>QUERY/IGNORE stuff |*>ppl plot"$2"/overlay|basemap> |*>/overlay"
ENDIF
IF `landi_subx NE 0` THEN 
  set grid state_LON
  let/quiet mp_lambda = if ((state_lon+landi_subx) ge mp_xmin and (state_lon+landi_subx) le mp_xmax and \
   state_lat ge mp_ymin and state_lat le mp_ymax) then ((state_lon+landi_subx) * deg2rad)
  let/quiet mp_phi = if ((state_lon+landi_subx) ge mp_xmin and (state_lon+landi_subx) le mp_xmax and \
   state_lat ge mp_ymin and state_lat le mp_ymax) then (state_lat * deg2rad)
  let/quiet masked_x_page = mp_mask * x_page
  let/quiet masked_y_page = mp_mask * y_page
  $4"plot|N>QUERY/IGNORE stuff |*>plot"/set/vs/nolab/noax/line=1/$2"i=1:200826/overlay|basemap>i=1:200826/overly|*>i=1:200826/overlay" masked_x_page, masked_y_page
  ppl pen 1 $4"1|black>1|red>2|green>3|blue>4|lightblue>5|purple>6|white>19|thick>7|0>0|1>1|2>2|3>3|4>4|5>5|6>6|7>7|8>8|9>9|10>10|11>11|12>12|13>13|14>14|15>15|16>16|17>17|18>18|N>1|"
  $4"ppl plot|N>QUERY/IGNORE stuff |*>ppl plot"$2"/overlay|basemap> |*>/overlay"
ENDIF

ENDIF  ! lines outside 0 to 360

cancel data geo_borders

set grid/restore
set data/restore
let/quiet mp_x = x
let/quiet mp_y = y
let/quiet mp_test = `mp_central_meridian` - `(mp_x[i=@max] + mp_x[i=@min])/2`
if `mp_test eq 0` then
   let/quiet mp_central_meridian = (mp_x[i=@max] + mp_x[i=@min])/2
endif
let/quiet mp_test = `mp_standard_parallel` - `(mp_y[j=@max] + mp_y[j=@min])/2`
if `mp_test eq 0` then
   let/quiet mp_standard_parallel = (mp_y[j=@max] + mp_y[j=@min])/2
endif
cancel variable mp_test
let/quiet mp_std_parallel_north = mp_y[j=@max]
let/quiet mp_std_parallel_south = mp_y[j=@min]
let/quiet mp_lambda = mp_x * deg2rad
let/quiet mp_phi = mp_y * deg2rad

set mode/last verify
\cancel mode verify	
! overlaying coastal outline using detailed geo_borders_intermed data.

! Description: Plot outlines of continents, countries, and/or states

! usage:   go mp_land_detail arg1 [arg2] [arg3] [arg4] [arg5] [arg6] [arg7]
!
!    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
!
! pens 	may be "0"(background), "1"(foreground), "thick"(same as pen 7),
!	"black", "red", "green", "blue", or 2-18.
! arg 2 may be "basemap", "overlay", "fast" (fast, 20e:20e overlay) or omitted

!	Note 1: A pen color of "black" will actually pen number 1
!		-- normally white if the window background is black
!	Note 2: An "N" for the continent pen means no continents
!		-- use this for the special case of geo-political
!		   overlay without continents.
! Example calls:
!   GO mp_land_detail red	     - overlay continents using red pen (2)
!   GO mp_land_detail  10           - overlay continents using pen number 10
!   GO mp_land_detail 1 basemap     - basemap of continents outline in foreground color
!   GO mp_land_detail 1 " " red     - overlay continents with countries in red
!   GO mp_land_detail thick basemap black black - continents, countries, and states
!   GO mp_land_detail thick " " red green blue lightblue purple - continents, countries, states, 
!                                                 all rivers, and marine boundaries
!   GO mp_land_detail N " " 1 1     - overlay: no continents; yes political boundaries
! 
! Example:
!   USE coads_climatology
!   SET REGION/X=0:360/Y=-90:90/L=1
!   GO mp_orthographic 210 45
!   SET GRID sst
!   GO mp_aspect
!   LET masked_sst = sst * mp_mask
!   FILL/TITLE="View From Space"/NOAXES masked_sst, x_page, y_page
!   GO mp_fland
!   GO mp_land_detail thick overlay red green blue lightblue purple
!
! Notes:
!  1) This script is SLOW! It computes the map projection for all the 
!       boundary data, even when a small subset is being plotted.
!  2) If a pen value is given for the country_pen or state_pen then the
!	corresponding geopolitical boundaries will be drawn - else
!	they will be omitted
!  3) use  GO line_samples    to view the first 6 pen numbers
!       Higher pen numbers cycle with thicker lines (max 18)
!  3) For more control over basemaps use "GO basemap"

! 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%

! introduce the outline data set
set data/save
set grid/save

let/quiet mp_x = x
let/quiet mp_xmin = `mp_x[i=@min]`
let/quiet mp_xmax = `mp_x[i=@max]`
let/quiet mp_y = y
let/quiet mp_ymin = `mp_y[j=@min]`
let/quiet mp_ymax = `mp_y[j=@max]`
let/quiet mp_std_parallel_north = mp_ymax
let/quiet mp_std_parallel_south = mp_ymin

! This test will keep the central meridians defined by "from space" views
!
let/quiet mp_test = `mp_central_meridian` - `(mp_x[i=@max] + mp_x[i=@min])/2`
if `mp_test eq 0` then
   let/quiet mp_central_meridian = `(mp_x[i=@max] + mp_x[i=@min])/2`
endif
let/quiet mp_test = `mp_standard_parallel` - `(mp_y[j=@max] + mp_y[j=@min])/2`
if `mp_test eq 0` then
   let/quiet mp_standard_parallel = `(mp_y[j=@max] + mp_y[j=@min])/2`
endif
cancel variable mp_test

define region/default save
cancel region

use geo_borders_intermed


! Initialize
let landi_subx = 0
let landi_addx = 0
let landi_datxmin = continent_lon[x=@min]
let landi_datxmax = continent_lon[x=@max]

let landi_basemap = $2"0|basemap>1|*>0"
IF `landi_basemap EQ 0` THEN

   IF `mp_xmin LT landi_datxmin` then let landi_subx = `landi_subx - 360`
   IF `mp_xmax GT landi_datxmax` then let landi_addx = `landi_addx + 360`

ENDIF


! always do the continents
set grid continent_lon
let/quiet mp_lambda = if (continent_lon ge mp_xmin and continent_lon le mp_xmax and continent_lat ge mp_ymin and continent_lat le mp_ymax) then (continent_lon * deg2rad)
let/quiet mp_phi = if (continent_lon ge mp_xmin and continent_lon le mp_xmax and continent_lat ge mp_ymin and continent_lat le mp_ymax) then (continent_lat * deg2rad)
let/quiet masked_x_page = mp_mask * x_page
let/quiet masked_y_page = mp_mask * y_page

$1"plot|N>QUERY/IGNORE stuff |*>plot"/set/vs/nolab/noax/line=1/$2"i=1:200826/overlay|basemap>i=1:200826/overly|*>i=1:200826/overlay" masked_x_page, masked_y_page

! select line style and plot
ppl pen 1 $1"1|black>1|red>2|green>3|blue>4|lightblue>5|purple>6|white>19|thick>7|0>0|1>1|2>2|3>3|4>4|5>5|6>6|7>7|8>8|9>9|10>10|11>11|12>12|13>13|14>14|15>15|16>16|17>17|18>18|N>1|"

! draw it - as an overlay or as a basemap

$1"ppl plot|N>QUERY/IGNORE stuff |*>ppl plot"$2"/overlay|basemap> |*>/overlay"


! Draw any lines outside 0 to 360
IF ($1"0|*>1") THEN

IF `landi_addx NE 0` THEN 
  set grid continent_lon
  let/quiet mp_lambda = if ((continent_lon+landi_addx) ge mp_xmin and (continent_lon+landi_addx) le mp_xmax and \
   continent_lat ge mp_ymin and continent_lat le mp_ymax) then ((continent_lon+landi_addx) * deg2rad)
  let/quiet mp_phi = if ((continent_lon+landi_addx) ge mp_xmin and (continent_lon+landi_addx) le mp_xmax and \
   continent_lat ge mp_ymin and continent_lat le mp_ymax) then (continent_lat * deg2rad)
  let/quiet masked_x_page = mp_mask * x_page
  let/quiet masked_y_page = mp_mask * y_page
  $1"plot|N>QUERY/IGNORE stuff |*>plot"/set/vs/nolab/noax/line=1/$2"i=1:200826/overlay|basemap>i=1:200826/overly|*>i=1:200826/overlay" masked_x_page, masked_y_page
  ppl pen 1 $1"1|black>1|red>2|green>3|blue>4|lightblue>5|purple>6|white>19|thick>7|0>0|1>1|2>2|3>3|4>4|5>5|6>6|7>7|8>8|9>9|10>10|11>11|12>12|13>13|14>14|15>15|16>16|17>17|18>18|N>1|"
  $1"ppl plot|N>QUERY/IGNORE stuff |*>ppl plot"$2"/overlay|basemap> |*>/overlay"
ENDIF
IF `landi_subx NE 0` THEN 
  set grid continent_lon
  let/quiet mp_lambda = if ((continent_lon+landi_subx) ge mp_xmin and (continent_lon+landi_subx) le mp_xmax and \
   continent_lat ge mp_ymin and continent_lat le mp_ymax) then ((continent_lon+landi_subx) * deg2rad)
  let/quiet mp_phi = if ((continent_lon+landi_subx) ge mp_xmin and (continent_lon+landi_subx) le mp_xmax and \
   continent_lat ge mp_ymin and continent_lat le mp_ymax) then (continent_lat * deg2rad)
  let/quiet masked_x_page = mp_mask * x_page
  let/quiet masked_y_page = mp_mask * y_page
  $1"plot|N>QUERY/IGNORE stuff |*>plot"/set/vs/nolab/noax/line=1/$2"i=1:200826/overlay|basemap>i=1:200826/overly|*>i=1:200826/overlay" masked_x_page, masked_y_page
  ppl pen 1 $1"1|black>1|red>2|green>3|blue>4|lightblue>5|purple>6|white>19|thick>7|0>0|1>1|2>2|3>3|4>4|5>5|6>6|7>7|8>8|9>9|10>10|11>11|12>12|13>13|14>14|15>15|16>16|17>17|18>18|N>1|"
  $1"ppl plot|N>QUERY/IGNORE stuff |*>ppl plot"$2"/overlay|basemap> |*>/overlay"
ENDIF

ENDIF  ! lines outside 0 to 360


! **** now the optional country borders
set grid COUNTRY_LON
let/quiet mp_lambda = if (COUNTRY_LON ge mp_xmin and COUNTRY_LON le mp_xmax and COUNTRY_LAT ge mp_ymin and COUNTRY_LAT le mp_ymax) then (COUNTRY_LON * deg2rad)
let/quiet mp_phi = if (COUNTRY_LON ge mp_xmin and COUNTRY_LON le mp_xmax and COUNTRY_LAT ge mp_ymin and COUNTRY_LAT le mp_ymax) then (COUNTRY_LAT * deg2rad)
let/quiet masked_x_page = mp_mask * x_page
let/quiet masked_y_page = mp_mask * y_page
$3"query/ignore|*>plot/set/vs/nolab/line=1/overlay" masked_x_page, masked_y_page

! select line style and plot
ppl pen 1 $3"1|black>1|red>2|green>3|blue>4|lightblue>5|purple>6|white>19|thick>7|0>0|1>1|2>2|3>3|4>4|5>5|6>6|7>7|8>8|9>9|10>10|11>11|12>12|13>13|14>14|15>15|16>16|17>17|18>18|"

! draw it - as an overlay or as a basemap
$3"query/ignore|*>ppl plot/overlay"


! Draw any lines outside 0 to 360
IF ($3"0|*>1") THEN

IF `landi_addx NE 0` THEN 
  set grid COUNTRY_LON
  let/quiet mp_lambda = if ((country_lon+landi_addx) ge mp_xmin and (country_lon+landi_addx) le mp_xmax and \
   country_lat ge mp_ymin and country_lat le mp_ymax) then ((country_lon+landi_addx) * deg2rad)
  let/quiet mp_phi = if ((country_lon+landi_addx) ge mp_xmin and (country_lon+landi_addx) le mp_xmax and \
   country_lat ge mp_ymin and country_lat le mp_ymax) then (country_lat * deg2rad)
  let/quiet masked_x_page = mp_mask * x_page
  let/quiet masked_y_page = mp_mask * y_page
  $3"plot|N>QUERY/IGNORE stuff |*>plot"/set/vs/nolab/noax/line=1/$2"i=1:200826/overlay|basemap>i=1:200826/overly|*>i=1:200826/overlay" masked_x_page, masked_y_page
  ppl pen 1 $3"1|black>1|red>2|green>3|blue>4|lightblue>5|purple>6|white>19|thick>7|0>0|1>1|2>2|3>3|4>4|5>5|6>6|7>7|8>8|9>9|10>10|11>11|12>12|13>13|14>14|15>15|16>16|17>17|18>18|N>1|"
  $3"ppl plot|N>QUERY/IGNORE stuff |*>ppl plot"$2"/overlay|basemap> |*>/overlay"
ENDIF
IF `landi_subx NE 0` THEN 
  set grid COUNTRY_LON
  let/quiet mp_lambda = if ((country_lon+landi_subx) ge mp_xmin and (country_lon+landi_subx) le mp_xmax and \
   country_lat ge mp_ymin and country_lat le mp_ymax) then ((country_lon+landi_subx) * deg2rad)
  let/quiet mp_phi = if ((country_lon+landi_subx) ge mp_xmin and (country_lon+landi_subx) le mp_xmax and \
   country_lat ge mp_ymin and country_lat le mp_ymax) then (country_lat * deg2rad)
  let/quiet masked_x_page = mp_mask * x_page
  let/quiet masked_y_page = mp_mask * y_page
  $3"plot|N>QUERY/IGNORE stuff |*>plot"/set/vs/nolab/noax/line=1/$2"i=1:200826/overlay|basemap>i=1:200826/overly|*>i=1:200826/overlay" masked_x_page, masked_y_page
  ppl pen 1 $3"1|black>1|red>2|green>3|blue>4|lightblue>5|purple>6|white>19|thick>7|0>0|1>1|2>2|3>3|4>4|5>5|6>6|7>7|8>8|9>9|10>10|11>11|12>12|13>13|14>14|15>15|16>16|17>17|18>18|N>1|"
  $3"ppl plot|N>QUERY/IGNORE stuff |*>ppl plot"$2"/overlay|basemap> |*>/overlay"
ENDIF

ENDIF  ! lines outside 0 to 360



! **** now the optional state borders
set grid STATE_LON
let/quiet mp_lambda = if (STATE_LON ge mp_xmin and STATE_LON le mp_xmax and STATE_LAT ge mp_ymin and STATE_LAT le mp_ymax) then (STATE_LON * deg2rad)
let/quiet mp_phi = if (STATE_LON ge mp_xmin and STATE_LON le mp_xmax and STATE_LAT ge mp_ymin and STATE_LAT le mp_ymax) then (STATE_LAT * deg2rad)
let/quiet masked_x_page = mp_mask * x_page
let/quiet masked_y_page = mp_mask * y_page
$4"query/ignore|*>plot/set/vs/nolab/line=1/overlay" masked_x_page, masked_y_page

! select line style and plot
ppl pen 1 $4"1|black>1|red>2|green>3|blue>4|lightblue>5|purple>6|white>19|thick>7|0>0|1>1|2>2|3>3|4>4|5>5|6>6|7>7|8>8|9>9|10>10|11>11|12>12|13>13|14>14|15>15|16>16|17>17|18>18|"

! draw it - as an overlay
$4"query/ignore|*>ppl plot/overlay"


! Draw any lines outside 0 to 360
IF ($4"0|*>1") THEN

IF `landi_addx NE 0` THEN 
  set grid state_LON
  let/quiet mp_lambda = if ((state_lon+landi_addx) ge mp_xmin and (state_lon+landi_addx) le mp_xmax and \
   state_lat ge mp_ymin and state_lat le mp_ymax) then ((state_lon+landi_addx) * deg2rad)
  let/quiet mp_phi = if ((state_lon+landi_addx) ge mp_xmin and (state_lon+landi_addx) le mp_xmax and \
   state_lat ge mp_ymin and state_lat le mp_ymax) then (state_lat * deg2rad)
  let/quiet masked_x_page = mp_mask * x_page
  let/quiet masked_y_page = mp_mask * y_page
  $4"plot|N>QUERY/IGNORE stuff |*>plot"/set/vs/nolab/noax/line=1/$2"i=1:200826/overlay|basemap>i=1:200826/overly|*>i=1:200826/overlay" masked_x_page, masked_y_page
  ppl pen 1 $4"1|black>1|red>2|green>3|blue>4|lightblue>5|purple>6|white>19|thick>7|0>0|1>1|2>2|3>3|4>4|5>5|6>6|7>7|8>8|9>9|10>10|11>11|12>12|13>13|14>14|15>15|16>16|17>17|18>18|N>1|"
  $4"ppl plot|N>QUERY/IGNORE stuff |*>ppl plot"$2"/overlay|basemap> |*>/overlay"
ENDIF
IF `landi_subx NE 0` THEN 
  set grid state_LON
  let/quiet mp_lambda = if ((state_lon+landi_subx) ge mp_xmin and (state_lon+landi_subx) le mp_xmax and \
   state_lat ge mp_ymin and state_lat le mp_ymax) then ((state_lon+landi_subx) * deg2rad)
  let/quiet mp_phi = if ((state_lon+landi_subx) ge mp_xmin and (state_lon+landi_subx) le mp_xmax and \
   state_lat ge mp_ymin and state_lat le mp_ymax) then (state_lat * deg2rad)
  let/quiet masked_x_page = mp_mask * x_page
  let/quiet masked_y_page = mp_mask * y_page
  $4"plot|N>QUERY/IGNORE stuff |*>plot"/set/vs/nolab/noax/line=1/$2"i=1:200826/overlay|basemap>i=1:200826/overly|*>i=1:200826/overlay" masked_x_page, masked_y_page
  ppl pen 1 $4"1|black>1|red>2|green>3|blue>4|lightblue>5|purple>6|white>19|thick>7|0>0|1>1|2>2|3>3|4>4|5>5|6>6|7>7|8>8|9>9|10>10|11>11|12>12|13>13|14>14|15>15|16>16|17>17|18>18|N>1|"
  $4"ppl plot|N>QUERY/IGNORE stuff |*>ppl plot"$2"/overlay|basemap> |*>/overlay"
ENDIF

ENDIF  ! lines outside 0 to 360

! **** now the optional rivers (secondary ones first)
set grid RIVER1_2_LON
let/quiet mp_lambda = if (RIVER1_2_LON ge mp_xmin and RIVER1_2_LON le mp_xmax and RIVER1_2_LAT ge mp_ymin and RIVER1_2_LAT le mp_ymax) then (RIVER1_2_LON * deg2rad)
let/quiet mp_phi = if (RIVER1_2_LON ge mp_xmin and RIVER1_2_LON le mp_xmax and RIVER1_2_LAT ge mp_ymin and RIVER1_2_LAT le mp_ymax) then (RIVER1_2_LAT * deg2rad)
let/quiet masked_x_page = mp_mask * x_page
let/quiet masked_y_page = mp_mask * y_page
$6"query/ignore|*>plot/set/vs/nolab/line=1/overlay" masked_x_page, masked_y_page

! select line style and plot
ppl pen 1 $6"1|black>1|red>2|green>3|blue>4|lightblue>5|purple>6|white>19|thick>7|0>0|1>1|2>2|3>3|4>4|5>5|6>6|7>7|8>8|9>9|10>10|11>11|12>12|13>13|14>14|15>15|16>16|17>17|18>18|"

! draw it - as an overlay or as a basemap
$6"query/ignore|*>ppl plot/overlay"


! Draw any lines outside 0 to 360
IF ($6"0|*>1") THEN

IF `landi_addx NE 0` THEN 
  set grid RIVER1_2_LON
  let/quiet mp_lambda = if ((RIVER1_2_lon+landi_addx) ge mp_xmin and (RIVER1_2_lon+landi_addx) le mp_xmax and \
   RIVER1_2_lat ge mp_ymin and RIVER1_2_lat le mp_ymax) then ((RIVER1_2_lon+landi_addx) * deg2rad)
  let/quiet mp_phi = if ((RIVER1_2_lon+landi_addx) ge mp_xmin and (RIVER1_2_lon+landi_addx) le mp_xmax and \
   RIVER1_2_lat ge mp_ymin and RIVER1_2_lat le mp_ymax) then (RIVER1_2_lat * deg2rad)
  let/quiet masked_x_page = mp_mask * x_page
  let/quiet masked_y_page = mp_mask * y_page
  $6"plot|N>QUERY/IGNORE stuff |*>plot"/set/vs/nolab/noax/line=1/$2"i=1:200826/overlay|basemap>i=1:200826/overly|*>i=1:200826/overlay" masked_x_page, masked_y_page
  ppl pen 1 $6"1|black>1|red>2|green>3|blue>4|lightblue>5|purple>6|white>19|thick>7|0>0|1>1|2>2|3>3|4>4|5>5|6>6|7>7|8>8|9>9|10>10|11>11|12>12|13>13|14>14|15>15|16>16|17>17|18>18|N>1|"
  $6"ppl plot|N>QUERY/IGNORE stuff |*>ppl plot"$2"/overlay|basemap> |*>/overlay"
ENDIF
IF `landi_subx NE 0` THEN 
  set grid RIVER1_2_LON
  let/quiet mp_lambda = if ((RIVER1_2_lon+landi_subx) ge mp_xmin and (RIVER1_2_lon+landi_subx) le mp_xmax and \
   RIVER1_2_lat ge mp_ymin and RIVER1_2_lat le mp_ymax) then ((RIVER1_2_lon+landi_subx) * deg2rad)
  let/quiet mp_phi = if ((RIVER1_2_lon+landi_subx) ge mp_xmin and (RIVER1_2_lon+landi_subx) le mp_xmax and \
   RIVER1_2_lat ge mp_ymin and RIVER1_2_lat le mp_ymax) then (RIVER1_2_lat * deg2rad)
  let/quiet masked_x_page = mp_mask * x_page
  let/quiet masked_y_page = mp_mask * y_page
  $6"plot|N>QUERY/IGNORE stuff |*>plot"/set/vs/nolab/noax/line=1/$2"i=1:200826/overlay|basemap>i=1:200826/overly|*>i=1:200826/overlay" masked_x_page, masked_y_page
  ppl pen 1 $6"1|black>1|red>2|green>3|blue>4|lightblue>5|purple>6|white>19|thick>7|0>0|1>1|2>2|3>3|4>4|5>5|6>6|7>7|8>8|9>9|10>10|11>11|12>12|13>13|14>14|15>15|16>16|17>17|18>18|N>1|"
  $6"ppl plot|N>QUERY/IGNORE stuff |*>ppl plot"$2"/overlay|basemap> |*>/overlay"
ENDIF

ENDIF  ! lines outside 0 to 360

! **** now the optional rivers (primary ones second)
set grid RIVER1_LON
let/quiet mp_lambda = if (RIVER1_LON ge mp_xmin and RIVER1_LON le mp_xmax and RIVER1_LAT ge mp_ymin and RIVER1_LAT le mp_ymax) then (RIVER1_LON * deg2rad)
let/quiet mp_phi = if (RIVER1_LON ge mp_xmin and RIVER1_LON le mp_xmax and RIVER1_LAT ge mp_ymin and RIVER1_LAT le mp_ymax) then (RIVER1_LAT * deg2rad)
let/quiet masked_x_page = mp_mask * x_page
let/quiet masked_y_page = mp_mask * y_page
$5"query/ignore|*>plot/set/vs/nolab/line=1/overlay" masked_x_page, masked_y_page

! select line style and plot
ppl pen 1 $5"1|black>1|red>2|green>3|blue>4|lightblue>5|purple>6|white>19|thick>7|0>0|1>1|2>2|3>3|4>4|5>5|6>6|7>7|8>8|9>9|10>10|11>11|12>12|13>13|14>14|15>15|16>16|17>17|18>18|"

! draw it - as an overlay or as a basemap
$5"query/ignore|*>ppl plot/overlay"



! Draw any lines outside 0 to 360
IF ($5"0|*>1") THEN

IF `landi_addx NE 0` THEN 
  set grid RIVER1_LON
  let/quiet mp_lambda = if ((RIVER1_lon+landi_addx) ge mp_xmin and (RIVER1_lon+landi_addx) le mp_xmax and \
   RIVER1_lat ge mp_ymin and RIVER1_lat le mp_ymax) then ((RIVER1_lon+landi_addx) * deg2rad)
  let/quiet mp_phi = if ((RIVER1_lon+landi_addx) ge mp_xmin and (RIVER1_lon+landi_addx) le mp_xmax and \
   RIVER1_lat ge mp_ymin and RIVER1_lat le mp_ymax) then (RIVER1_lat * deg2rad)
  let/quiet masked_x_page = mp_mask * x_page
  let/quiet masked_y_page = mp_mask * y_page
  $5"plot|N>QUERY/IGNORE stuff |*>plot"/set/vs/nolab/noax/line=1/$2"i=1:200826/overlay|basemap>i=1:200826/overly|*>i=1:200826/overlay" masked_x_page, masked_y_page
  ppl pen 1 $5"1|black>1|red>2|green>3|blue>4|lightblue>5|purple>6|white>19|thick>7|0>0|1>1|2>2|3>3|4>4|5>5|6>6|7>7|8>8|9>9|10>10|11>11|12>12|13>13|14>14|15>15|16>16|17>17|18>18|N>1|"
  $5"ppl plot|N>QUERY/IGNORE stuff |*>ppl plot"$2"/overlay|basemap> |*>/overlay"
ENDIF
IF `landi_subx NE 0` THEN 
  set grid RIVER1_LON
  let/quiet mp_lambda = if ((RIVER1_lon+landi_subx) ge mp_xmin and (RIVER1_lon+landi_subx) le mp_xmax and \
   RIVER1_lat ge mp_ymin and RIVER1_lat le mp_ymax) then ((RIVER1_lon+landi_subx) * deg2rad)
  let/quiet mp_phi = if ((RIVER1_lon+landi_subx) ge mp_xmin and (RIVER1_lon+landi_subx) le mp_xmax and \
   RIVER1_lat ge mp_ymin and RIVER1_lat le mp_ymax) then (RIVER1_lat * deg2rad)
  let/quiet masked_x_page = mp_mask * x_page
  let/quiet masked_y_page = mp_mask * y_page
  $5"plot|N>QUERY/IGNORE stuff |*>plot"/set/vs/nolab/noax/line=1/$2"i=1:200826/overlay|basemap>i=1:200826/overly|*>i=1:200826/overlay" masked_x_page, masked_y_page
  ppl pen 1 $5"1|black>1|red>2|green>3|blue>4|lightblue>5|purple>6|white>19|thick>7|0>0|1>1|2>2|3>3|4>4|5>5|6>6|7>7|8>8|9>9|10>10|11>11|12>12|13>13|14>14|15>15|16>16|17>17|18>18|N>1|"
  $5"ppl plot|N>QUERY/IGNORE stuff |*>ppl plot"$2"/overlay|basemap> |*>/overlay"
ENDIF

ENDIF  ! lines outside 0 to 360

! **** now the optional marine boundaries
set grid MARINE_LON
let/quiet mp_lambda = if (MARINE_LON ge mp_xmin and MARINE_LON le mp_xmax and MARINE_LAT ge mp_ymin and MARINE_LAT le mp_ymax) then (MARINE_LON * deg2rad)
let/quiet mp_phi = if (MARINE_LON ge mp_xmin and MARINE_LON le mp_xmax and MARINE_LAT ge mp_ymin and MARINE_LAT le mp_ymax) then (MARINE_LAT * deg2rad)
let/quiet masked_x_page = mp_mask * x_page
let/quiet masked_y_page = mp_mask * y_page
$7"query/ignore|*>plot/set/vs/nolab/line=1/overlay" masked_x_page, masked_y_page

! select line style and plot
ppl pen 1 $7"1|black>1|red>2|green>3|blue>4|lightblue>5|purple>6|white>19|thick>7|0>0|1>1|2>2|3>3|4>4|5>5|6>6|7>7|8>8|9>9|10>10|11>11|12>12|13>13|14>14|15>15|16>16|17>17|18>18|"

! draw it - as an overlay or as a basemap
$7"query/ignore|*>ppl plot/overlay"


! Draw any lines outside 0 to 360
IF ($7"0|*>1") THEN

IF `landi_addx NE 0` THEN 
  set grid MARINE_LON
  let/quiet mp_lambda = if ((MARINE_lon+landi_addx) ge mp_xmin and (MARINE_lon+landi_addx) le mp_xmax and \
   MARINE_lat ge mp_ymin and MARINE_lat le mp_ymax) then ((MARINE_lon+landi_addx) * deg2rad)
  let/quiet mp_phi = if ((MARINE_lon+landi_addx) ge mp_xmin and (MARINE_lon+landi_addx) le mp_xmax and \
   MARINE_lat ge mp_ymin and MARINE_lat le mp_ymax) then (MARINE_lat * deg2rad)
  let/quiet masked_x_page = mp_mask * x_page
  let/quiet masked_y_page = mp_mask * y_page
  $7"plot|N>QUERY/IGNORE stuff |*>plot"/set/vs/nolab/noax/line=1/$2"i=1:200826/overlay|basemap>i=1:200826/overly|*>i=1:200826/overlay" masked_x_page, masked_y_page
  ppl pen 1 $7"1|black>1|red>2|green>3|blue>4|lightblue>5|purple>6|white>19|thick>7|0>0|1>1|2>2|3>3|4>4|5>5|6>6|7>7|8>8|9>9|10>10|11>11|12>12|13>13|14>14|15>15|16>16|17>17|18>18|N>1|"
  $7"ppl plot|N>QUERY/IGNORE stuff |*>ppl plot"$2"/overlay|basemap> |*>/overlay"
ENDIF
IF `landi_subx NE 0` THEN 
  set grid MARINE_LON
  let/quiet mp_lambda = if ((MARINE_lon+landi_subx) ge mp_xmin and (MARINE_lon+landi_subx) le mp_xmax and \
   MARINE_lat ge mp_ymin and MARINE_lat le mp_ymax) then ((MARINE_lon+landi_subx) * deg2rad)
  let/quiet mp_phi = if ((MARINE_lon+landi_subx) ge mp_xmin and (MARINE_lon+landi_subx) le mp_xmax and \
   MARINE_lat ge mp_ymin and MARINE_lat le mp_ymax) then (MARINE_lat * deg2rad)
  let/quiet masked_x_page = mp_mask * x_page
  let/quiet masked_y_page = mp_mask * y_page
  $7"plot|N>QUERY/IGNORE stuff |*>plot"/set/vs/nolab/noax/line=1/$2"i=1:200826/overlay|basemap>i=1:200826/overly|*>i=1:200826/overlay" masked_x_page, masked_y_page
  ppl pen 1 $7"1|black>1|red>2|green>3|blue>4|lightblue>5|purple>6|white>19|thick>7|0>0|1>1|2>2|3>3|4>4|5>5|6>6|7>7|8>8|9>9|10>10|11>11|12>12|13>13|14>14|15>15|16>16|17>17|18>18|N>1|"
  $7"ppl plot|N>QUERY/IGNORE stuff |*>ppl plot"$2"/overlay|basemap> |*>/overlay"
ENDIF

ENDIF  ! lines outside 0 to 360

cancel data geo_borders_intermed


set grid/restore
set data/restore
let/quiet mp_x = x
let/quiet mp_y = y
let/quiet mp_test = `mp_central_meridian` - `(mp_x[i=@max] + mp_x[i=@min])/2`
if `mp_test eq 0` then
   let/quiet mp_central_meridian = (mp_x[i=@max] + mp_x[i=@min])/2
endif
let/quiet mp_test = `mp_standard_parallel` - `(mp_y[j=@max] + mp_y[j=@min])/2`
if `mp_test eq 0` then
   let/quiet mp_standard_parallel = (mp_y[j=@max] + mp_y[j=@min])/2
endif
cancel variable mp_test
let/quiet mp_std_parallel_north = mp_y[j=@max]
let/quiet mp_std_parallel_south = mp_y[j=@min]
let/quiet mp_lambda = mp_x * deg2rad
let/quiet mp_phi = mp_y * deg2rad

set region save
set mode/last verify


[Thread Prev][Thread Next][Index]
Contact Us
Dept of Commerce / NOAA / OAR / PMEL / Ferret

Privacy Policy | Disclaimer | Accessibility Statement