Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado
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
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
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
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
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
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