f



matchup of Map_set & contour

Hello~

I want to overlap contour lines on a map.
However, I think it doesn't match exactly (I checked the gridlines)..
especially, as it goes to the edge.. 
Could someone know how to fix it?
Here is an example...

;-------------------------------
lon = FINDGEN(91)
lat = FINDGEN(115)
x = 17.0 + lon*(1/6.0)
y = 23.0 + lat*(1/6.0)

seed=1L
temp = sin(x)^2 * cos(x)
z = DIST(91,115)

LOADCT, 39

WINDOW,1,TITLE='WORLD MAP',xsize=800,ysize=900

CONTOUR, z, x, y, /Follow, position=[0.1,0.1,0.9,0.9] $
       , NLevels=20, XStyle=1, YStyle=1, /NoErase, /FILL ;$
MAP_SET, /CYLINDRICAL, LIMIT=[23.0,17.0,42.0,32.0], /CONTINENTS $
       , /HIRES, Mlinethick=1., position=[0.1,0.1,0.9,0.9] $
       , /Noerase;, /ISOTROPIC
MAP_CONTINENTS, /HIRES,color=255, /FILL_CONTINENTS, /CYLINDRICAL ; /mercator
MAP_CONTINENTS, /COAST, color=0, /HIRES, /CYLINDRICAL ; /mercator
MAP_GRID, charsize=1.25, color=100 ,latdel=2, londel=2 $
        , /BOX_axes, GLineStyle=2
;-------------------------------

Thank you.
Sincerely.


Son
0
shson (6)
9/3/2003 1:37:58 PM
comp.lang.idl-pvwave 12260 articles. 4 followers. Post Follow

5 Replies
759 Views

Similar Articles

[PageSpeed] 50

"Son" <shson@darkstar.sr.unh.edu> wrote in message
news:62cdb6eb.0309030537.73237301@posting.google.com...
> Hello~
>
> I want to overlap contour lines on a map.
> However, I think it doesn't match exactly (I checked the gridlines)..
> especially, as it goes to the edge..
> Could someone know how to fix it?
> Here is an example...
>
> ;-------------------------------
> lon = FINDGEN(91)
> lat = FINDGEN(115)
> x = 17.0 + lon*(1/6.0)
> y = 23.0 + lat*(1/6.0)
>
> seed=1L
> temp = sin(x)^2 * cos(x)
> z = DIST(91,115)
>
> LOADCT, 39
>
> WINDOW,1,TITLE='WORLD MAP',xsize=800,ysize=900
>
> CONTOUR, z, x, y, /Follow, position=[0.1,0.1,0.9,0.9] $
>        , NLevels=20, XStyle=1, YStyle=1, /NoErase, /FILL ;$
> MAP_SET, /CYLINDRICAL, LIMIT=[23.0,17.0,42.0,32.0], /CONTINENTS $
>        , /HIRES, Mlinethick=1., position=[0.1,0.1,0.9,0.9] $
>        , /Noerase;, /ISOTROPIC
> MAP_CONTINENTS, /HIRES,color=255, /FILL_CONTINENTS, /CYLINDRICAL ;
/mercator
> MAP_CONTINENTS, /COAST, color=0, /HIRES, /CYLINDRICAL ; /mercator
> MAP_GRID, charsize=1.25, color=100 ,latdel=2, londel=2 $
>         , /BOX_axes, GLineStyle=2
> ;-------------------------------

Try calling MAP_SET before CONTOUR.

Cheers,
Liam.
Practical IDL Programming
http://www.gumley.com/


0
9/3/2003 2:20:26 PM
Son writes:

> I want to overlap contour lines on a map.
> However, I think it doesn't match exactly (I checked the gridlines)..
> especially, as it goes to the edge.. 
> Could someone know how to fix it?

Well, I think you want to call CONTOUR *after* you do your
MAP_SET. This will require you to use the OVERPLOT keyword.
And on map projections you MUST use the CELL_FILL keyword
on the CONTOUR command, rather than the FILL keyword. I think
the code should look more like this:

;-------------------------------
lon = FINDGEN(91)
lat = FINDGEN(115)
x = 17.0 + lon*(1/6.0)
y = 23.0 + lat*(1/6.0)

seed=1L
temp = sin(x)^2 * cos(x)
z = DIST(91,115)

LOADCT, 39

WINDOW,1,TITLE='WORLD MAP',xsize=800,ysize=900

MAP_SET, /CYLINDRICAL, LIMIT=[23.0,17.0,42.0,32.0], /CONTINENTS $
       , /HIRES, Mlinethick=1., position=[0.1,0.1,0.9,0.9] $
       , /Noerase;, /ISOTROPIC
CONTOUR, z, x, y, /Follow, NLevels=20, XStyle=1, $
    YStyle=1, /NoErase, /CELL_FILL, /OVERPLOT 
MAP_CONTINENTS, /HIRES,color=255, /FILL_CONTINENTS, /CYLINDRICAL
MAP_CONTINENTS, /COAST, color=0, /HIRES, /CYLINDRICAL 
MAP_GRID, charsize=1.25, color=100 ,latdel=2, londel=2, $
        /BOX_axes, GLineStyle=2


That seems to look correct (more or less) to me. :-)

Cheers,

David
-- 
David W. Fanning, Ph.D.
Fanning Software Consulting, Inc.
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
0
david3553 (839)
9/3/2003 2:43:38 PM
Thanks a lot!
Now, it works very well.

When you have a time, please explain why 'contour' line should be
after 'map_set' when you have a time?


Son
0
shson (6)
9/3/2003 6:11:59 PM
Son writes:

> When you have a time, please explain why 'contour' line should be
> after 'map_set' when you have a time?

This is primarily because the "IDL way" is to
fit data to map projections, not to fit map
projections to data. In any case, it is the
MAP_SET call that sets up all the data to device
coordinate conversion factors, etc. that are needed
for overplotting data on the map. This is similar
to what happens when you issue a PLOT command.

Cheers,

David

-- 
David W. Fanning, Ph.D.
Fanning Software Consulting, Inc.
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
0
david3553 (839)
9/3/2003 10:01:04 PM
In article <62cdb6eb.0309031011.6e9ce978@posting.google.com>, "Son"
<shson@darkstar.sr.unh.edu> wrote:


> Thanks a lot!
> Now, it works very well.
> When you have a time, please explain why 'contour' line should be after
> 'map_set' when you have a time?   Son

Try setting the map projection to anything other than mercator (try
/goodes) and remove the limit. Plotting the contour before using map_set
causes a map to be drawn over the unprojected contour.

Contur (ing) after the map_set (with the /over keyword) tells IDL to use
the graphics projection that you have already set up.
0
Chris
9/4/2003 3:23:55 PM
Reply: