Irregular data... IDLgrContour vs. contour [message #43100] |
Wed, 16 March 2005 07:31  |
jamiesmyth_uni@yahoo.
Messages: 6 Registered: July 2004
|
Junior Member |
|
|
Hi all,
I'm a little stuck using IDLgrContour with irregular data. In direct
graphics I would simply type:
contour, zdata, xdata, ydata, /irregular, yrange=[0,60], nlevels=8
where:
XDATA FLOAT = Array[113]
YDATA DOUBLE = Array[113]
ZDATA DOUBLE = Array[113]
Of course, IDLgrContour doesn't accept the /irregular keyword... must I
grid the data myself? If so, can anyone point me to a good gridding
routine? I notice that icontour brings up a 'gridding wizzard'...
Thanks,
Jamie
|
|
|
Re: Irregular data... IDLgrContour vs. contour [message #43192 is a reply to message #43100] |
Wed, 16 March 2005 13:57  |
Paul Selby
Messages: 5 Registered: August 2003
|
Junior Member |
|
|
jamiesmyth_uni@yahoo.ca wrote:
> Hi all,
>
> I'm a little stuck using IDLgrContour with irregular data. In direct
> graphics I would simply type:
>
> contour, zdata, xdata, ydata, /irregular, yrange=[0,60], nlevels=8
>
> where:
>
> XDATA FLOAT = Array[113]
> YDATA DOUBLE = Array[113]
> ZDATA DOUBLE = Array[113]
>
> Of course, IDLgrContour doesn't accept the /irregular keyword... must I
> grid the data myself? If so, can anyone point me to a good gridding
> routine? I notice that icontour brings up a 'gridding wizzard'...
>
> Thanks,
> Jamie
I needed to do something similar at work.
I used TRIANGULATE to get triangles which I then converted to a connectivity
for IDLgrContour. I don't have the code with me here but the following
seems to do the trick
; get some irregular data
; irreg_grid1.txt comes with IDL 6.1 not sure about other versions
filename = filepath("irreg_grid1.txt", subdirectory = ['examples', 'data'])
data = fltarr(3, 105)
openr, lun, filename, /get_lun
readf, lun, data
free_lun, lun
x = reform(data[0, *])
y = reform(data[1, *])
z = reform(data[2, *])
; construct polygon list
triangulate, x, y, tri
dims = size(tri, /dimensions)
poly = lonarr(4, dims[1])
poly[0, *] = 3
poly[1:3, *] = tri
poly = reform(poly, n_elements(poly), /overwrite)
; display contours in Object and Direct graphics
cont = obj_new('IDLgrContour', z, geomx = x, geomy = y, polygons = poly)
xobjview, cont
contour, z, x, y, /irregular
Hope this helps
Paul
|
|
|
Re: Irregular data... IDLgrContour vs. contour [message #43193 is a reply to message #43100] |
Wed, 16 March 2005 12:46  |
Mark Hadfield
Messages: 783 Registered: May 1995
|
Senior Member |
|
|
jamiesmyth_uni@yahoo.ca wrote:
> Hi all,
>
> I'm a little stuck using IDLgrContour with irregular data. In direct
> graphics I would simply type:
>
> contour, zdata, xdata, ydata, /irregular, yrange=[0,60], nlevels=8
>
> where:
>
> XDATA FLOAT = Array[113]
> YDATA DOUBLE = Array[113]
> ZDATA DOUBLE = Array[113]
>
> Of course, IDLgrContour doesn't accept the /irregular keyword... must I
> grid the data myself?
Have you tried passing the irregular data to IDLgrContour without the
keyword? I expect this should work (but don't recall ever trying it
myself) because the IDLgrContour documentation states that it accepts
1-D vectors for DATA_VALUES, GEOMX and GEOMY.
> If so, can anyone point me to a good gridding
> routine?
GRIDDATA
--
Mark Hadfield "Ka puwaha te tai nei, Hoea tatou"
m.hadfield@niwa.co.nz
National Institute for Water and Atmospheric Research (NIWA)
|
|
|