[Thread Prev][Thread Next][Index]

Re: How does one truncate map-projections plots?


Actually, the solution pretty simple if not obvious.  No additional
scripts are necessary.  The map project scripts convert from lon/lat to
page coordinates.  For accurate representation of the map projection
your aspect ratio should be set so that one horizontal unit of page
coordinates equals one vertical unit of page coordinates.  That's what
the mp_aspect.jnl script does:  it calculates the range of page
coordinates and sets the aspect ratio accordingly.  You can see what's
happening with the following:

yes? use etopo20
yes? set region/x=250:380/y=54:90
yes? go mp_orthographic 315 72    ! centered on the selected region
yes? go mp_grid rose
yes? go mp_aspect print           ! prints the aspect ratio but doesn't
set it
The appropriate aspect ratio is 0.57616

To understand where this comes from do this:

yes? show sym/all
PPL$XLEN = "9.127"
PPL$YLEN = "5.259"
yes? list `($ppl$ylen/($ppl$xlen)`
 !-> list 0.5762

If you go ahead and generate the plot, letting mp_aspect.jnl set the
aspect ratio, you'll have a map more or less centered on Greenland but
with way too much other stuff.  

yes? go mp_aspect                 ! actually set the aspect ratio
yes? let mask_rose = rose * mp_mask
yes? shade/lev=20c/pal=dark_land_sea mask_rose, x_page, y_page

However, because of the page coordinates listed on the axes we know what
area we want.  It looks like horizontal coordinates -.15:1.5 and
vertical coordinates -2.5:2.5 would generate a nice map of Greenland. 
Using the same region, we can set a new aspect ratio ourselves and
truncate the plot appropriately, leaving off the page coordinate axes
for the final plot:

yes? set win/aspect = `.5/.3`
mask_rose, x_page, y_page

This technique should work with any of the map projection scripts,

Good luck,

-- Jonathan Callahan

Steve Hankin wrote:
> Hi Lev,
> The "mp_ scripts all define internally simple translations from "world
> coordinates" (lat/long) into page coordinates (on either a [0,1] or
> [-1,1] coordinate system -- I don't recall)
> I suspect it would be a straightforward matter to create a modified
> script which took as an additional argument a "magnification factor" so
> that it projected into, say, a [-2,2] space instead of [-1,1]. Then the
> clipping of the edges would occur naturally as a result of the plot
> rectangle being defined as [-1,1]
> I have not actually tried this ...
>     - steve
> =======================
> Lev Tarasoff wrote:
> > I would like to use mp_orthographic to plot my Greenland data, but I
> > need to truncate the sides of the plot. (Since plotting regions are
> > always rectangular on a lat-long grid, and on account of the N-S
> > divergence of lines of longitude, the plots end up with a lot of
> > ocean.) I've tried the margins GO routine with negative x limits, but
> > area maps and contour lines shift relative to each other. Any ideas?
> >
> > Thanks
> >
> > Lev
> >
> > Lev Tarasoff -  Dept of Physics, University of Toronto,
> >                 60 St. George St., Toronto, Ontario, CANADA, M5S 1A7
> >                 Tel (416)-946-3019  Fax (416)-978-8905
> >                 email: lev@atmosp.physics.utoronto.ca
> --
>                 |  NOAA/PMEL               |  ph. (206) 526-6080
> Steve Hankin    |  7600 Sand Point Way NE  |  FAX (206) 526-6744
>                 |  Seattle, WA 98115-0070  |  hankin@pmel.noaa.gov

[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP

Contact Us | Privacy Policy | Disclaimer | Accessibility Statement