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.")
|