[Thread Prev][Thread Next][Index]

Re: overlay of sampling locations



Hi Cyndy,
You always want to add or subtract multiples of 360 to
the longitude values to shift them so they will appear in the
region that's on the plot. Adding 180 would put a point on
the other side of the globe; only 360 keeps it at its original
location. The polygon command and mp_polymark script take
care of putting the points at the correct location on the plot, as
long as the longitude of the point is within the range on the
plot.  I've simplified the script to better show what is happening
and use coarser topography data to speed things up.

  use etopo60
  go mp_plate_caree
  set grid rose
  go mp_aspect
  set region/x=100E:100E/y=-90:90
  shade rose, x_page, y_page

  ! Get the trap lon and lat location data
  file/var="trap_lat,trap_lon" trap_locs.dat

  ! Plot polygons at the longitude and latitude points
  go mp_polymark POLY/OVER/NOLAB/NOAXES/NOKEY/PALETTE=red trap_lon, trap_lat, , circle, 0.5
  go mp_polymark POLY/OVER/NOLAB/NOAXES/NOKEY/PALETTE=black trap_lon+360, trap_lat, , circle, 0.5

The second call to mp_polymark ( plotted in black so you
can see which points these are) plots all the points which
do not lie in the region x=-100:460

Commands like SHOW DATA, SHOW REGION,
STAT trap_lon are helpful to see what you are working
with at any given point in a script, as well as LIST on
parts of the data to see what the data and coordinates
you've got.

Interestingly, in rectangular coordinates, the SET REGION
command would result in not ever using some of the trap locations.
The ascii data file is read in on an abstract X axis, and with the
default region set to x=-100:460 then the first 99 points are not
ever looked at in any of the plot commands.  (The SET REGION
happens to work with map projection scripts because those scripts
suspend regions that have been set, as they set their own regions
internally.)

Making the plot in rectangular coordinates:

  cancel region
  use etopo60
  shade/noaxes/palette=dark_land_sea/x=100E:100E/y=-90:90 rose

  file/var="trap_lat,trap_lon" trap_locs.dat
  go polymark POLY/OVER/NOLAB/NOAXES/NOKEY/PALETTE=red trap_lon, trap_lat, , circle, 0.5
  go polymark POLY/OVER/NOLAB/NOAXES/NOKEY/PALETTE=black trap_lon+360, trap_lat, , circle, 0.5



Cyndy Chandler wrote:

> Hello ferreters,
>
> I'm trying to overlay some sampling locations on a map of the world, and
> would appreciate some help ...
>
> I was successful at doing an overlay plot of some sampling locations on
> a map of the world with region /x=-180:180/y=-90:90 but I wanted to make
> the map edge at 100E (because of the distribution of my data), and can't
> figure out how to do an overlay plot on that 100W centric base map
> (/x=100E:100E).  The base map looks fine, but the sampling location data
> is still geing plotted on an x=-180:180 axis.
>
> I've played around with various offsets to the longitudes of my sampling
> locations, but all such attempts were unsuccesful, I think because that
> longitude axis is not modulo.
>
> I've attached the ferret script and sampling location datafile.
>
> Can anyone tell me what I'm missing here?
>
> Thanks much, Cyndy
>
>   ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> ! Make map of world
> ! add lon, lat data points as red dots
> ! (modified from FUG and LAS FAQ scripts)
> ! 031007.clc.
> !
> ! Usage:
> ! ferret  [ -gif after interactive mode messing about ]
> !         [ -gif creates better res gif image ]
> !   go map_sed_trap
> !
> ! Product:
> !  creates map_sed_trap.gif
> !
> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
>
> ! set up environment
> !
> set mem/size=60
> set win/size=.5
>
> ! world topo data source
> ! etopo60  first, then etopo20 for final image
> !
> !use etopo20
> use etopo60
> !show data/all
>
> ! color the whole world beautiful
> !
> palette dark_land_sea
> !set region/x=-180:180/y=-90:90  ... this one works
> ! but next one is better view for trap site distribution
> ! make the world begin in ... Bangkok
> set region/x=100E:100E/y=-90:90
> ! set region/x=100:460/y=-90:90   .. this made the map I wanted, but
> ! how to adjust trap_lon? +280 (0:360 + 100 = 100:460)
>
> ! set up for Plate Caree map of the world
> !
> go mp_plate_caree
> set grid rose
>
> ! Adjust the window aspect ratio
> !
> go mp_aspect
>
> ! Create the underlay map
> !
> shade/nokey/lev=(-10500,-5500,5000)(-5500,0,500)(0,2000,250)(2000,6000,1000)/nolab rose, x_page, y_page
>
> ! Lyme prevention: tics begone
> !
> ppl size ($ppl$xlen),($ppl$ylen)
> ppl axlen ($ppl$xlen),($ppl$ylen)
> ppl origin 0,0
> shade/nokey/lev=(-10500,-5500,5000)(-5500,0,500)(0,2000,250)(2000,6000,1000)/nolab rose, x_page, y_page
>
> ! Get the trap lon and lat location data
> !
> file/var="trap_lat,trap_lon" trap_locs.dat
>
> ! mess with the data as needed
> !
> ! convert longitudes from -180:180 to 0:360 degrees
> !let lon = trap_lon + 180
> ! convert longitudes from -180:180 to 100:460 degrees
> !let lon = trap_lon + 280
> ! convert longitudes to 100W centric world
> !let lon = trap_lon[x=100E:100E]
> !list lon[I=1:137]
> !
> let lat = trap_lat
> let lon = trap_lon
>
> ! Plot the locations
> ! as small red dots (lox pox)
> ! use Map projection version of polymark.jnl
> !     for working with map projection scripts
> !
> go mp_polymark POLY/OVER/NOLAB/NOAXES/NOKEY/PALETTE=red lon, lat, , circle, 0.5
>
> ! save plot to gif file
> !
> frame/file=map_sed_trap.gif
>
>   ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> 78.86   1.37
> 78.90   6.70
> 74.58   -6.73
> 70.00   -1.96
> 69.50   10.00
> 65.52   -0.10
> 75.86   11.47
> 73.00   19.00
> 47.72   -20.87
> 33.82   -21.02
> 32.73   -70.82
> 23.20   -63.98
> 32.08   -64.25
> 13.50   -54.00
> 1.80    -11.13
> -2.18   -9.90
> 70.00   0.00
> 72.50   -8.00
> 68.00   -12.66
> 25.30   -79.50
> 54.58   -21.15
> 47.83   -19.50
> 47.82   -19.75
> 33.15   -21.98
> 31.55   -24.67
> 29.13   -15.43
> 28.00   -21.98
> 24.55   -22.83
> 21.98   -25.23
> 21.15   -20.68
> 20.92   -19.75
> 19.00   -20.17
> 11.48   -21.03
> 31.54   -55.92
> -5.00   -25.00
> -8.00   -28.00
> -20.05  9.16
> -20.00  -10.00
> 16.00   60.00
> 14.00   64.00
> 15.00   68.00
> 17.45   89.60
> 15.23   89.17
> 13.15   84.37
> 4.46    87.30
> 17.69   58.85
> 17.40   58.80
> 17.21   59.59
> 15.10   61.50
> 10.00   65.01
> -76.49  -177.87
> -73.54  176.89
> -74.50  180.00
> -66.16  -168.67
> -63.15  -169.90
> -60.28  -170.06
> -56.90  -170.17
> -53.03  -174.73
> -57.00  -37.00
> -62.26  -57.53
> -62.44  -34.76
> -64.92  -2.50
> -50.67  68.60
> -50.09  5.77
> -54.34  -3.34
> -64.90  -2.56
> -47.00  141.50
> -51.00  141.50
> -61.55  150.45
> -42.00  178.50
> -44.00  178.50
> 58.00   179.00
> 53.00   149.00
> 9.00    -140.00
> 5.00    -140.00
> 2.00    -140.00
> 0.00    -140.00
> -2.00   -140.00
> -5.00   -140.00
> -12.00  -135.00
> 50.00   -145.00
> 49.00   -138.00
> 1.04    138.94
> 11.06   140.14
> 42.19   -127.58
> 41.55   -132.00
> 39.49   -127.69
> 47.97   -128.10
> 42.09   -125.77
> 6.57    -92.77
> 8.83    -103.98
> 15.00   -151.00
> 0.00    175.16
> 7.93    175.01
> 34.42   177.74
> 30.00   175.00
> 37.40   174.95
> 46.12   175.03
> 4.13    136.28
> 1.22    160.57
> 39.67   132.40
> 53.50   -177.00
> 49.00   -174.00
> 5.35    -81.88
> 12.83   -103.90
> 34.17   141.98
> 27.88   -111.66
> 26.03   -110.92
> 34.23   -120.03
> 33.55   -118.50
> 18.47   116.02
> 14.60   115.10
> 5.01    138.83
> 12.01   134.29
> 44.07   155.03
> 15.00   175.02
> 22.75   -158.00
> 51.50   165.00
> 45.00   165.00
> 45.00   -177.00
> 36.73   -122.05
> 40.50   142.48
> 40.46   146.03
> 30.03   174.98
> 13.00   175.00
> 40.00   145.43
> 46.82   162.12
> 27.00   127.00
> 25.00   127.00
> 77.50   -150.00
> 78.00   -132.00
> 79.39   -102.65
> 42.73   8.52
> 42.25   32.62
> 43.18   32.02
> 43.00   34.00
> 42.35   37.57

--
Ansley Manke  Pacific Marine Environmental Laboratory  Seattle WA





[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP

Contact Us | Privacy Policy | Disclaimer | Accessibility Statement