comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Map spanning Dateline?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Map spanning Dateline? [message #14193] Tue, 02 February 1999 00:00 Go to next message
John Kwiatkowski is currently offline  John Kwiatkowski
Messages: 4
Registered: May 1998
Junior Member
I can't figure out how to draw a map that spans the International
Dateline, i.e., the meridion where longitude is 180 (or -180).

If I go right up to the dateline but not over it, I get a nice map
including Japan:
map_set,/grid, /continent,limit = [0,100,50,180]

However, if I cross the dateline I get some gridlines but no Japan:
map_set,/grid, /continent,limit = [0,100,50,-160]

If I use the limit keyword with 8 elements, either
map_set,/grid, /continent,limit = [50,100,50,-160,0,-160,0,100] or
map_set,/grid, /continent,limit = [0,100,50,100,50,-160,0,-160]
I get a blank window.


Also, I can't seem to get the limit (4 element) keyword to behave.
For example , if I want a map of Florida limit =[20,-88,30,-80]
map_set,limit=[20,-88,30,-80],/cont,/label

I get a map from 20 to 26 lat and -88 to -82 lon. How can I force it
to listen to my limits?

Thanks for any help,
John Kwiatkowski
Re: Map spanning Dateline? [message #14258 is a reply to message #14193] Thu, 04 February 1999 00:00 Go to previous message
Martin Schultz is currently offline  Martin Schultz
Messages: 515
Registered: August 1997
Senior Member
Charlotte DeMott wrote:
>
> How about this example:
>
> map_set, 0, 180, limit=[-20,0,20,360]
>
> so far so good, but how do i get latitude labels to appear to the LEFT of
> the map? Setting latlab=-20, causes the labels to appear at 340 degrees
> (IN the map, near the rhs).
>
> charlotte
>

yes, that *is* cumbersome. I attach a little routine that will take care
of your
labelling issues. The basic idea is to use XYOUTS. Once you are there,
you can
then really spruce your maps up quite a bit. As an example, I add a
degree symbol...

Hope this helps,
Martin.


--
------------------------------------------------------------ -------
Dr. Martin Schultz
Department for Engineering&Applied Sciences, Harvard University
109 Pierce Hall, 29 Oxford St., Cambridge, MA-02138, USA

phone: (617)-496-8318
fax : (617)-495-4551

e-mail: mgs@io.harvard.edu
Internet-homepage: http://www-as.harvard.edu/people/staff/mgs/
------------------------------------------------------------ -------

function get_gridspacing,range,delta=delta,n=n

; return 5, 10, 15, 30 depending on range

dist = range[1]-range[0]
if (dist gt 120.) then delta = 30. $
else if (dist gt 80.) then delta = 15. $
else if (dist gt 45.) then delta = 10. $
else delta = 5.

; set up mega grid and truncate to actual range
; range shouldn't exceed -180 or +720 in any case
; therefore we start with a grid of 900/5 = 150 entries
grid = findgen(150)*delta - 180.

keep = where(grid ge range[0] AND grid le range[1])
if (keep[0] eq -1) then message,'Invalid parameters for grid!'

grid = grid[keep]
n = n_elements(keep)

return,grid
end


pro map_labels,lonrange=lonrange,latrange=latrange

if (n_elements(latrange) ne 2) then latrange = [ -90., 90. ]
if (n_elements(lonrange) ne 2) then lonrange = [ -180., 180. ]

center = [ total(latrange)/2., total(lonrange)/2. ]

map_set,center[0],center[1], $
limit=[latrange[0],lonrange[0],latrange[1],lonrange[1]], $
color=1,position=[0.2,0.3,0.9,0.8],/continents


; degree symbol
deg = '!Uo!N'

; compute grid lines
lats = get_gridspacing(latrange,n=nlat)
lons = get_gridspacing(lonrange,n=nlon)

map_grid,color=1,lats=lats,lons=lons

; convert to normal coordinates for labeling
; norm... will be 3 dimensional arrays. 1st coordinate is
; longitude, 2nd is latitude. For lats, the longitude is at
; the left of the plot, for lons, the latitude is on the bottom
; Thus, it's easy to use this information for xyouts

dumlat = fltarr(nlon) + latrange[0]
dumlon = fltarr(nlat) + lonrange[0]
normlats = convert_coord(dumlon,lats,/DATA,/TO_NORMAL)
normlons = convert_coord(lons,dumlat,/DATA,/TO_NORMAL)

charheight=0.005 ; estimated

xyouts,normlats[0,*]-0.018,normlats[1,*]-charheight, $
strtrim(string(lats,format='(I5)'),2)+deg,/NORM, $
align=1.,color=1

xyouts,normlons[0,*],normlons[1,*]-0.025, $
strtrim(string(lons,format='(I5)'),2)+deg,/NORM, $
align=0.5,color=1

return
end
Re: Map spanning Dateline? [message #14274 is a reply to message #14193] Wed, 03 February 1999 00:00 Go to previous message
Charlotte DeMott is currently offline  Charlotte DeMott
Messages: 7
Registered: January 1998
Junior Member
How about this example:

map_set, 0, 180, limit=[-20,0,20,360]

so far so good, but how do i get latitude labels to appear to the LEFT of
the map? Setting latlab=-20, causes the labels to appear at 340 degrees
(IN the map, near the rhs).

charlotte

Martin Schultz wrote:

> You'll need to set the map origin somewhere within your LIMITs and make
> sure that limit is monotonically increasing. Example:
>
> map_set,0,175,limit=[-50,140,50,210]
>
> that should work.
>
> BTW: If you are planning to overlay contours on your map: make sure your
> data is sorted correctly and within your map range. This has caused so
> much trouble already ...
>
> Martin.
>
Re: Map spanning Dateline? [message #14276 is a reply to message #14193] Wed, 03 February 1999 00:00 Go to previous message
Martin Schultz is currently offline  Martin Schultz
Messages: 515
Registered: August 1997
Senior Member
John Kwiatkowski wrote:
>
> I can't figure out how to draw a map that spans the International
> Dateline, i.e., the meridion where longitude is 180 (or -180).
>
> If I go right up to the dateline but not over it, I get a nice map
> including Japan:
> map_set,/grid, /continent,limit = [0,100,50,180]
>
> However, if I cross the dateline I get some gridlines but no Japan:
> map_set,/grid, /continent,limit = [0,100,50,-160]
>
> If I use the limit keyword with 8 elements, either
> map_set,/grid, /continent,limit = [50,100,50,-160,0,-160,0,100] or
> map_set,/grid, /continent,limit = [0,100,50,100,50,-160,0,-160]
> I get a blank window.
>
> Also, I can't seem to get the limit (4 element) keyword to behave.
> For example , if I want a map of Florida limit =[20,-88,30,-80]
> map_set,limit=[20,-88,30,-80],/cont,/label
>
> I get a map from 20 to 26 lat and -88 to -82 lon. How can I force it
> to listen to my limits?
>
> Thanks for any help,
> John Kwiatkowski

Oh yeah! My fun subject ;-)

You'll need to set the map origin somewhere within your LIMITs and make
sure that limit is monotonically increasing. Example:

map_set,0,175,limit=[-50,140,50,210]

that should work.

BTW: If you are planning to overlay contours on your map: make sure your
data is sorted correctly and within your map range. This has caused so
much trouble already ...

Martin.


--
------------------------------------------------------------ -------
Dr. Martin Schultz
Department for Engineering&Applied Sciences, Harvard University
109 Pierce Hall, 29 Oxford St., Cambridge, MA-02138, USA

phone: (617)-496-8318
fax : (617)-495-4551

e-mail: mgs@io.harvard.edu
Internet-homepage: http://www-as.harvard.edu/people/staff/mgs/
------------------------------------------------------------ -------
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: N_ELEMENTS and WHERE: Scalar or Array ?
Next Topic: Re: TIFF compression

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 17:41:37 PDT 2025

Total time taken to generate the page: 0.00621 seconds