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

Home » Public Forums » archive » problem defining vectors
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: problem defining vectors [message #39560 is a reply to message #39470] Tue, 25 May 2004 00:09 Go to previous message
Chris Lee is currently offline  Chris Lee
Messages: 101
Registered: August 2003
Senior Member
In article <e920fce6.0405241309.637e4067@posting.google.com>, "elias"
<heoa@hotmail.com> wrote:


> Dear experts,
> I have a file with 6 columns and 5,000 records. Each of these records
> contain spatial coordinates (x,y,z) and vector components (vx,vy,vz).
> The coordinates are from a Cubic space, however, not all the points
> inside this cube are in the array. How can I build the arrays so that
> they can have the same size? I thought about inserting zeros in between.
> Cube space
> x=50
> y=50
> z=50
> the program that I wrote looks like this: I think the second line is
> not good!
> thank you and best regards,
> elias
> file=DIALOG_PICKFILE(FILTER=['*.dat'])
> array=fltarr(6,50*50L*50L)
> Openr,1,file
> readF,1,array
> x=array[2,*]
> y=array[1,*]
> z=array[0,*]
> u=array[3,*]
> v=array[4,*]
> w=array[5,*]
> close,1
> end


Aha, reading the newsgroup backward is...interesting.

The second line is not good because your reading in 50*50*50 groups of 6
values, which is 125000, not 5000.

What you probably want is

file=DIALOG_PICKFILE(FILTER=['*.dat'])
array=fltarr(6,5000L)
Openr,1,file
readF,1,array
x=array[2,*]
y=array[1,*]
z=array[0,*]
u=array[3,*]
v=array[4,*]
w=array[5,*]
close,1

amp=sqrt(u^2+v^2+w^2)
amp=reform(amp) ;for luck :)
x=reform(x)
y=reform(y)
z=reform(z)

data_3d=grid3(x,y,z,amp,ngrid=50)
end


now you have a 3d data set. Check the keywords for GRID3 for anything you
need, NGRID=50 makes the 3d dataset 50x50x50, as requested, you might
also want START=[x0,y0,z0] and DELTA=[dx,dy,dz] to determine the ranges
in x,y and z (range is delta*ngrid+start I guess)

Chris.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: color for Flow3
Next Topic: Using ASSOC

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

Current Time: Fri Oct 10 14:00:17 PDT 2025

Total time taken to generate the page: 0.10567 seconds