gridding XYZ to surface: how to blank no data? [message #87563] |
Sat, 15 February 2014 07:05  |
paulartcoelho
Messages: 30 Registered: March 2007
|
Member |
|
|
hello there,
i've been using the excellent post by David at https://www.idlcoyote.com/tips/grid_surface.html to show a bunch of XYZ data as contour plots.
there is a detail i didn't manage to solve though. there are combinations of XY in the original table where there are no data (at all, i don't mean Z=0), which is at the end plotted in the contour as if Z=0 (understandably).
but i would like to show these regions in the contour plot as non-existent, to differentiate from "true Z=0" regions.
in other words, in my final contour plot, i'd like to show true Z=0 values as a certain color, the minimum of the color table i adopt, but non-existant XY values as blank white.
any advice?
many thanks,
Paula
|
|
|
|
Re: gridding XYZ to surface: how to blank no data? [message #87569 is a reply to message #87563] |
Sat, 15 February 2014 07:52   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Paula writes:
> i've been using the excellent post by David at https://www.idlcoyote.com/tips/grid_surface.html to show a bunch of XYZ data as contour plots.
>
> there is a detail i didn't manage to solve though. there are combinations of XY in the original table where there are no data (at all, i don't mean Z=0), which is at the end plotted in the contour as if Z=0 (understandably).
>
> but i would like to show these regions in the contour plot as non-existent, to differentiate from "true Z=0" regions.
>
> in other words, in my final contour plot, i'd like to show true Z=0 values as a certain color, the minimum of the color table i adopt, but non-existant XY values as blank white.
>
> any advice?
This really shouldn't take any effort at all. Set the missing data
points to !Values.F_NAN. (Make sure your array is floating type before
you do this.) Use the CELL_FILL keyword on your contour command NOT the
FILL keyword. The rest should happen automatically:
data = cgDemoData(2)
cgLoadCT, 33
cgDisplay, WID=0
cgContour, data, /FILL, /OUTLINE
missing = RandomU(-3L, 10) * 41 * 41L
data[missing] = !Values.F_NaN
cgDisplay, WID=1
cgContour, data, /CELL_FILL, /OUTLINE
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
|
|
|
|