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
|
|
|