Trying to map georeferenced data with NaN's [message #45388] |
Thu, 01 September 2005 14:34 |
Chris Konig
Messages: 5 Registered: March 2005
|
Junior Member |
|
|
Hi there
I have 2D arrays that contain values from 0 - 100 (percentages) as well
as plenty of NaN's (NaN is not the same as zero for me) on a regular
lon/lat grid. I.e. I have
GRIDDED FLOAT = Array[1801, 150]
LAT_GRID FLOAT = Array[150]
LON_GRID FLOAT = Array[1801]
The latter two contain the locations.
*** What I would like to do:
I would like to see my data on a map with the NaN's in a different
color. The built-in plotting routine seem to always show NaN's as zeros,
which is not ok for me.
*** What I've tried so far:
; Prepare plotting
loadct, 1, bottom=20, ncolors=101, /silent ; ct for data (see below)
device, decomposed=0, retain = 2
window, 2, xsize=1200, ysize=500
landColor = fsc_color('charcoal',200)
NaNcolor = fsc_color('light gray',10)
map_set, /hires, /continents, con_color=landColor, $
limit=[58, -180, 89, 180], /cylindrical ; Data is Arctic
; Let's treat the data
gr_is_nan = where(finite(gridded,/NAN),count)
if (count lt 0) then gridded[gr_is_nan] = -10
gridded_plot = gridded + 20
; data now going from 10 to 120 (10: NaN, 20-120: values)
; Plot it
contour,gridded_plot, x_grid, y_grid, /cell_fill, $
levels = indgen(11)*10+20, $
/overplot
MAP_CONTINENTS, /hires, /fill_continents, color=landColor
*** Problems I have (in decreasing importance):
- NaN's are not shown in in NaNcolor but with the same color as zeros
(or not at all?), even though that had been working for me at some other
point.
- The data seems to become rescaled, i.e. the rearranged data values
(from 20-120) do not use the color indices from 20-120 but from 0-255.
Can I tell 'contour' *not* to rescale? Should I use another plotting
command instead? Which one? And it works with maps?
- If I try to overplot data from another time (a new 'gridded') it does
not completely overplot earlier data, but only where it is not NaN.
(This might be connected to the first question.)
- I get "Floating underflow" errors each time I call 'contour'. Why? How
can I prevent them?
- I don't know how I can put titles on my plots. It works for the
original 'map_set' call, but I would like to update the title with the
'contour' or 'map_continents' call, but none of them seem to do anything.
Any help is extremely appreciated!
Chris
(Sorry for double-posting, somehow my post got filed away into a thread.)
|
|
|