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

Home » Public Forums » archive » Re: contouring into continents only
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
Re: contouring into continents only [message #31790] Tue, 20 August 2002 07:39
R.Bauer is currently offline  R.Bauer
Messages: 1424
Registered: November 1998
Senior Member
David wrote:

> Thank you both!
>
> I finally achieved the graph I needed. Both methods work fine!
>
> But I will sugesst to the IDL development team a new keyword like
>
> contour,z,x,y,please_just_the_land=1 ; just_the_land=-1 should display
> just the oceans :-)
>
> or something
>
> regards
> david

I aggree to this but not with this value because keyword_set(-1) is TRUE!

Reimar


--
Forschungszentrum Juelich
email: R.Bauer@fz-juelich.de
http://www.fz-juelich.de/icg/icg-i/
============================================================ ======
a IDL library at ForschungsZentrum Juelich
http://www.fz-juelich.de/icg/icg-i/idl_icglib/idl_lib_intro. html
Re: contouring into continents only [message #31797 is a reply to message #31790] Tue, 20 August 2002 03:07 Go to previous message
David is currently offline  David
Messages: 24
Registered: April 1997
Junior Member
Thank you both!

I finally achieved the graph I needed. Both methods work fine!

But I will sugesst to the IDL development team a new keyword like

contour,z,x,y,please_just_the_land=1 ; just_the_land=-1 should display just
the oceans :-)

or something

regards
david
Re: contouring into continents only [message #31803 is a reply to message #31797] Mon, 19 August 2002 13:33 Go to previous message
air_jlin is currently offline  air_jlin
Messages: 22
Registered: July 2001
Junior Member
hi David,

i sometimes have to do the opposite (contours only over ocean areas)
and find that setting the land points in the grid to !VALUES.F_NAN
seems to do the trick...IDL counts those points as "missing data" and
just doesn't draw any contours over those areas.

best,
-Johnny


"David" <losiento@peromefrienaspam.com> wrote in message
news:<ajq3k4$2q9$1@crispin.sim.ucm.es>...
> Hi all.
>
> I'm desperately trying to draw contour lines inside continental boundaries
> only (I have irregularly gridded precipitation data). I have test several
> 'brute force' methods (as creating a mask of 1 over land and 0 over seas)
> but none seems to work properly.
>
> Is there any easy (as any esoteric keyword unknown to me) method to do that?
>
> thank you!
> David
Re: contouring into continents only [message #31807 is a reply to message #31803] Mon, 19 August 2002 09:09 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
David Fanning (david@dfanning.com) writes:

> But here is a modified example from my web page that uses
> a mask to only draw the portion of the contours that are
> over land:

There were a couple of little things about my example
program this morning that continued to annoy me, so I
put a little more elaborate example of a solution for
only drawing the contours that appear over land on my
web page. You can find it here, if you are interested:

http://www.dfanning.com/tip_examples/map_on_land.pro

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
Re: contouring into continents only [message #31810 is a reply to message #31807] Mon, 19 August 2002 07:34 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
David Fanning (david@dfanning.com) writes:

> But here is a modified example from my web page that uses
> a mask to only draw the portion of the contours that are
> over land:

Uh, that program needs a DEVICE, DECOMPOSED=0 in it
if you want to see colors. :-(

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
Re: contouring into continents only [message #31811 is a reply to message #31810] Mon, 19 August 2002 07:27 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
David (losiento@peromefrienaspam.com) writes:

> I'm desperately trying to draw contour lines inside continental boundaries
> only (I have irregularly gridded precipitation data). I have test several
> 'brute force' methods (as creating a mask of 1 over land and 0 over seas)
> but none seems to work properly.
>
> Is there any easy (as any esoteric keyword unknown to me) method to do that?

No esoteric keywords, unfortunately. :-(

But here is a modified example from my web page that uses
a mask to only draw the portion of the contours that are
over land:

************************************************************ ***
PRO EXAMPLE

; Pick a seed, so you see what I see. Create data.

seed = -1L
lat = RANDOMU(seed, 40) * (24./1.0) + 24
lon = RANDOMU(seed, 40) * 40.0/1.0 - 112
data = RANDOMU(seed, 40) * 1000

; Colors for plot.

LOADCT, 0
TVLCT, [255, 0], [255, 255], [0,0], 1

thisDevice = !D.Name
Set_Plot, 'Z'
Device, Set_Resolution=[800, 600]

; Set up the map projection of the Eastern US.

MAP_SET, 15, -87, 0, LIMIT=[24,-115,49,-67], $
/CONTINENTS, /USA, /MERCATOR, Position=[0.1,0.1,.9,.9]

; Plot the random data locations.

PLOTS, lon, lat, PSYM=4, COLOR=2

; Grid the irregularly spaced data.

gridData= SPH_SCAT(lon, lat, data, $
BOUNDS=[-115., 24., -67., 49.], GS=[0.5,0.5], BOUT=bout)

; Calculate xlon and ylat vectors corresponding to gridded data.

s = SIZE(gridData)
xlon = FINDGEN(s(1))*((bout(2) - bout(0))/(s(1)-1)) + bout(0)
ylat = FINDGEN(s(2))*((bout(3) - bout(1))/(s(2)-1)) + bout(1)

; Put the contours on the map.

CONTOUR, gridData, xlon, ylat, /OVERPLOT, NLEVELS=20, C_COLOR=1
map = TVRD()

; Now draw the mask.

ERASE
MAP_SET, 15, -87, 0, LIMIT=[24,-115,49,-67], $
/MERCATOR, Position=[0.1,0.1,.9,.9]
Map_Continents, /FILL, /USA, /HIRES, /CONTINENTS
mask = TVRD()

; Display both the upclipped and clipped contours.

Set_Plot, thisDevice
Window, XSize=800, YSize=600, Title='Unclipped contours'
TV, map
Window, 1, XSize=800, YSize=600, Title='Clipped contours'
screen = Where(mask EQ 0)
map[screen] = 0
TV, map
END
************************************************************ *******

It seems to do a reasonably good job.

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
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Read/format mixed int/flt/strng ascii files
Next Topic: Weighting Function

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

Current Time: Fri Oct 10 15:51:16 PDT 2025

Total time taken to generate the page: 1.11776 seconds