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

Home » Public Forums » archive » Re: xyz triplet array to a "flat" 2D array?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: xyz triplet array to a "flat" 2D array? [message #18658] Fri, 21 January 2000 00:00
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
"Todd Bowers" <tbowers@nrlssc.navy.mil> writes:
> Does anybody have a quickie that'll convert data in xyz triplets
> to "flat" format? e.g.
>
> x y z to 89.5 89.6 89.7 89.8
> 89.7 20.1 00.1 20.1 00.1
> 89.6 20.3 00.2 20.2 00.3
> 89.8 20.2 00.3 20.3 00.4 00.2
> 89.5 20.3 00.4
>
> with x running across the top and y down the first column, blanks
> are NaN's or whatever. Like it's been interpolated, but without
> the interpolation ;).

How about:

dx = (x1-x0)/nx
dy = (y1-y0)/ny
flat = fltarr(nx,ny)
flat((x-x0)/dx, (y-y0)/dy)) = z

where [x0,x1] and [y0,y1] are the X and Y ranges of the data. Error
checking, and one-off questions are left as an exercise for the
reader. Creative uses of HISTOGRAM and REVERSE_INDICES can also be
used, if you are interested in extra credit.

Good luck,

Craig

--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
[Message index]
 
Read Message
Previous Topic: INT_TABULATED Errors
Next Topic: Re: 24 bit color without connecting to X server

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

Current Time: Fri Oct 10 04:35:46 PDT 2025

Total time taken to generate the page: 0.45003 seconds