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

Home » Public Forums » archive » Re: Function Graphics Map Projection Woes
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Function Graphics Map Projection Woes [message #77664 is a reply to message #77663] Mon, 19 September 2011 13:06 Go to previous messageGo to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Mark Piper writes:

> By happy coincidence, I'm giving a webinar on using map projections in
> IDL, scheduled for October 20. Check back here:
>
> http://www.ittvis.com/language/en-US/EventsTraining/LiveWebS eminars.aspx
>
> a little later today for the announcement. I just finished making my
> example programs last week; after I IDLdoc them, I'll post them to
> bit.ly/IDL-webinar-files if you'd like to inspect them before the webinar.

OK, so I have some real world map projected gridded data
that I want to see on a map projection. The gridded data
has missing data values. The client wants to see the rest
of the data displayed in 10 separate colors. I've put the
data and the longitude and latitude vectors that go
along with the data here:

http://www.idlcoyote.com/misc/mapdata.sav

Restoring the data file, you will see this:

IDL> help, tnmin, lon, lat
TNMIN FLOAT = Array[96, 73]
LON DOUBLE = Array[96]
LAT DOUBLE = Array[73]

I can display this data correctly in function graphics with
this code:

; This data must be reversed in IDL's Y dimension.
tnmin = Reverse(tnmin, 2)

; Missing data is -999.99.
missing = Where(tnmin EQ -999.99, count)
IF count GT 0 THEN BEGIN
tnmin[missing] = !Values.F_NAN
ENDIF

; Scale the data for display
minvalue = Floor(Min(tnmin, /NAN))
maxvalue = Ceil(Max(tnmin, /NAN))
scaledData = BytScl(tnmin, /NAN, TOP=9, $
MIN=minvalue, MAX=maxvalue)
IF count GT 0 THEN scaledData[missing] = 255

; Display the data.
LoadCT, 33, NCOLORS=10
TVLCT, 255, 255, 255, 255 ; Missing values are white.
TVLCT, rgb, /Get

w = Window(Dimension=[775, 425])
imgObj = Image(scaledData, lon, Reverse(lat), $
limit=[-90,0,90, 356.25], grid_units=2, $
map_projection='Equirectangular', $
Position=[0.05,0.05,0.95, 0.80], $
RGB_TABLE=rgb, /Current)
c = mapContinents()
g = Mapgrid(Color='gray')

What I cannot do, however, is display a colorbar with
just the data colors. This despite having just written
the definitive documentation for how to use the Colorbar
function with images. :-(

The problem is the white missing value color. It is
*always* gettting in the way. I even tried making a
"fake" image, as I did last week with the Contour plot,
but for some reason I cannot even fathom, this changes
the colors on my image plot, even when I "hide" the fake
image. :-(

Always interested in new ideas!

Cheers,

David


--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: IDL 8.1 Graphics Window Rearrange Content
Next Topic: Good IDL 8 guide?

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

Current Time: Fri Oct 10 06:26:30 PDT 2025

Total time taken to generate the page: 0.39691 seconds