comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: ??% TRIGRID: X, Y, or Z array dimensions are incompatible?? what the....
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: ??% TRIGRID: X, Y, or Z array dimensions are incompatible?? what the.... [message #17501] Tue, 19 October 1999 00:00
T Bowers is currently offline  T Bowers
Messages: 56
Registered: May 1998
Member
AHA!
So, if my data is in the form of an x,y grid with
x values across the top and y values down the 1st
column, a la:

10 20 30
0 1.1 NaN 1.5
1 1.8 1.4 1.6
2 1.9 1.5 1.1
3 1.2 1.5 1.6

then I have to something like:

x_orig = read1stCol() ;x_orig now contains [0,1,2,3]
y_orig = read1stRow() ;y_orig now contains [10,20,30]
z_orig = readData() ;z_orig now a fltarr[3,4]

;Now, re-organize x_orig,y_orig,z_orig so IDL's routines
; know what I'm talking about
;A Function to put data into format:
;x0 y0 z[0,0]
;x0 y1 z[0,1]
;x0 y2 z[0,2]
;x0 y3 z[0,3]
;x1 y0 z[1,0]
;x1 y1 z[1,1]
;x1 y2 z[1,2]
;x1 y3 z[1,3]
;x2 y0 z[2,0]
;x2 y1 z[2,1]
;x2 y2 z[2,2]
;x2 y3 z[2,3]
;Does IDL have a routine to do this?? I can't find one.
newData = putInProperFmt(x_orig,y_orig,z_orig)

;Superfluous, but I'll extract the new x,y,z to new arrays
x = newData[0,*] & y = newData[1,*], & z = newData[2,*]

;Grid the data and visualize
minX = min(x, max=maxX, /NaN) & minY = min(y, max=maxY, /NaN)
limits = [minX, minY, maxX, maxY]
gridData = trigrid(x, y, z, angles, [0,0], XGRID=xGrid, YGRID=yGrid)
surface, xGrid, yGrid, gridData

Is this how it all works??

Thanks,
t

Med Bennett <mbennett@indra.com> wrote in message
news:380BF0C1.F164E49@indra.com...
> This gives an error because a,b, and c have to have the same number of
> elements - you have to have one and only one value of c for each [a,b]
> coordinate pair. Try
>
> gridData = trigrid(a, b, c[*,0], ang)
>
> Todd Bowers wrote:
>
>> Why does this give me an error? I'm just trying to
>> test the gridding routines to get a feel for them
>> before I dive in with real data.
>>
>> IDL> a = [0.0,1.0,2.2]
>> IDL> b = [1.1,2.8,3.6]
>> IDL> c = [ [0.0,1.1,2.2], [1.0,2.1,3.2], [2.0,3.1,4.2] ]
>> IDL> triangulate, a, b, ang
>> IDL> gridData = trigrid(a, b, c, ang)
>> % TRIGRID: X, Y, or Z array dimensions are incompatible
>> % Execution halted at: $MAIN$
>>
>> huh?
>
Re: ??% TRIGRID: X, Y, or Z array dimensions are incompatible?? what the.... [message #17510 is a reply to message #17501] Mon, 18 October 1999 00:00 Go to previous message
Med Bennett is currently offline  Med Bennett
Messages: 109
Registered: April 1997
Senior Member
This gives an error because a,b, and c have to have the same number of
elements - you have to have one and only one value of c for each [a,b]
coordinate pair. Try

gridData = trigrid(a, b, c[*,0], ang)

Todd Bowers wrote:

> Why does this give me an error? I'm just trying to
> test the gridding routines to get a feel for them
> before I dive in with real data.
>
> IDL> a = [0.0,1.0,2.2]
> IDL> b = [1.1,2.8,3.6]
> IDL> c = [ [0.0,1.1,2.2], [1.0,2.1,3.2], [2.0,3.1,4.2] ]
> IDL> triangulate, a, b, ang
> IDL> gridData = trigrid(a, b, c, ang)
> % TRIGRID: X, Y, or Z array dimensions are incompatible
> % Execution halted at: $MAIN$
>
> huh?
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: IDL's handling of LOGICAL quantities (WHERE)
Next Topic: Re: saving plots as .eps

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 19:25:37 PDT 2025

Total time taken to generate the page: 0.00480 seconds