Re: Particle_Trace question ? [message #59373] |
Thu, 20 March 2008 06:29 |
Michael Galloy
Messages: 1114 Registered: April 2006
|
Senior Member |
|
|
wfzhao@bjmb.gov.cn wrote:
> On 3月19日, 上午7时23分, "mgal...@gmail.com" <mgal...@gmail.com> wrote:
>> On Mar 18, 4:56 pm, millward.geo...@gmail.com wrote:
>>
>>
>>
>>
>>
>>> Hi there,
>>> I am trying to use particle_trace to create streamlines from a vector
>>> field - but I'm having quite alot of trouble
>>> understanding the documentation.
>>> I have a velocity field which is a longitude,latitude array of
>>> Southward and Eastward velocities.
>>> My arrays are 20 longitudes by 91 latitudes. So my 2 arrays are:
>>> V_south(20,91) and V_east(20,91)
>>> I now want to feed these into Particle_trace.
>>> The syntax for Particle_trace requires a single array (which they call
>>> Data) of
>>> size Data[2,dx,dy]
>>> I'm assuming that dx and dy are the indexes for longitude and latitude
>>> and the first dimension (2)
>>> is for the 2 components of the field, so:
>>> data(0,lon,lat) = V_east(lon,lat)
>>> data(1,lon,lat) = 0.0 - V_south(lon,lat)
>>> Nowhere in the documentation does it define the directions - is dx
>>> Eastwards - is dy Northwards? Very confusing !!
>>> And the seed points - are these longitude, latitude points or
>>> something ? Again, no real explanation in the documentation.
>>> ....or have I got it completely wrong ?
>>> Any help with this very much appreciated
>>> Cheers,
>>> George.
>> Here's an example of using PARTICLE_TRACE:
>>
>> ; defines u, v, x, and y
>> restore, filepath('globalwinds.dat', subdir=['examples','data'])
>>
>> data = fltarr(2, 128, 64)
>> data[0, *, *] = u
>> data[1, *, *] = v
>>
>> ; define starting points
>> seeds = [[32, 32], [64, 32], [96, 32]]
>>
>> particle_trace, data, seeds, verts, conn, max_iterations=30
>>
>> ; plot the underlying vector field
>> velovect, u, v, x, y
>>
>> ; overplot the streamlines
>> i = 0
>> sz = size(verts, /structure)
>> while (i lt sz.dimensions[1]) do begin
>> nverts = conn[i]
>> plots, x[verts[0, conn[i+1:i+nverts]]], y[verts[1, conn[i+1:i
>> +nverts]]], $
>> color='0000FF'x, thick=2, linestyle=2
>> i += nverts + 1
>> endwhile
>>
>> Mike
>> --www.michaelgalloy.com
>> Tech-X Corporation
>> Software Developer II- 隐藏被引用文字 -
>>
>> - 显示引用的文字 -
>
> Hi,
> I copy your code and save as a pro fle and run in IDL,but nothing is
> display.
> if I want to display the image created from your code in a temporary
> window, what can I do?
> thanks.
It should display an image. Are there any error messages when you run it?
The easiest way to start might be to just copy and paste the code from
the original message onto the command line. Does that work?
Mike
--
www.michaelgalloy.com
Tech-X Corporation
Software Developer II
|
|
|
Re: Particle_Trace question ? [message #59376 is a reply to message #59373] |
Thu, 20 March 2008 01:40  |
wfzhao
Messages: 11 Registered: March 2008
|
Junior Member |
|
|
On 3月19日, 上午7时23分, "mgal...@gmail.com" <mgal...@gmail.com> wrote:
> On Mar 18, 4:56 pm, millward.geo...@gmail.com wrote:
>
>
>
>
>
>> Hi there,
>
>> I am trying to use particle_trace to create streamlines from a vector
>> field - but I'm having quite alot of trouble
>> understanding the documentation.
>
>> I have a velocity field which is a longitude,latitude array of
>> Southward and Eastward velocities.
>> My arrays are 20 longitudes by 91 latitudes. So my 2 arrays are:
>
>> V_south(20,91) and V_east(20,91)
>
>> I now want to feed these into Particle_trace.
>
>> The syntax for Particle_trace requires a single array (which they call
>> Data) of
>> size Data[2,dx,dy]
>
>> I'm assuming that dx and dy are the indexes for longitude and latitude
>> and the first dimension (2)
>> is for the 2 components of the field, so:
>
>> data(0,lon,lat) = V_east(lon,lat)
>> data(1,lon,lat) = 0.0 - V_south(lon,lat)
>
>> Nowhere in the documentation does it define the directions - is dx
>> Eastwards - is dy Northwards? Very confusing !!
>
>> And the seed points - are these longitude, latitude points or
>> something ? Again, no real explanation in the documentation.
>
>> ....or have I got it completely wrong ?
>
>> Any help with this very much appreciated
>
>> Cheers,
>
>> George.
>
> Here's an example of using PARTICLE_TRACE:
>
> ; defines u, v, x, and y
> restore, filepath('globalwinds.dat', subdir=['examples','data'])
>
> data = fltarr(2, 128, 64)
> data[0, *, *] = u
> data[1, *, *] = v
>
> ; define starting points
> seeds = [[32, 32], [64, 32], [96, 32]]
>
> particle_trace, data, seeds, verts, conn, max_iterations=30
>
> ; plot the underlying vector field
> velovect, u, v, x, y
>
> ; overplot the streamlines
> i = 0
> sz = size(verts, /structure)
> while (i lt sz.dimensions[1]) do begin
> nverts = conn[i]
> plots, x[verts[0, conn[i+1:i+nverts]]], y[verts[1, conn[i+1:i
> +nverts]]], $
> color='0000FF'x, thick=2, linestyle=2
> i += nverts + 1
> endwhile
>
> Mike
> --www.michaelgalloy.com
> Tech-X Corporation
> Software Developer II- 隐藏被引用文字 -
>
> - 显示引用的文字 -
Hi,
I copy your code and save as a pro fle and run in IDL,but nothing is
display.
if I want to display the image created from your code in a temporary
window, what can I do?
thanks.
|
|
|
Re: Particle_Trace question ? [message #59382 is a reply to message #59376] |
Wed, 19 March 2008 16:09  |
Douglas G. Dirks
Messages: 10 Registered: October 2006
|
Junior Member |
|
|
millward.george@gmail.com wrote:
> On Mar 18, 5:23 pm, "mgal...@gmail.com" <mgal...@gmail.com> wrote:
>> On Mar 18, 4:56 pm, millward.geo...@gmail.com wrote:
>>
>>
>>
>>> Hi there,
>>> I am trying to use particle_trace to create streamlines from a vector
>>> field - but I'm having quite alot of trouble
>>> understanding the documentation.
>>> I have a velocity field which is a longitude,latitude array of
>>> Southward and Eastward velocities.
>>> My arrays are 20 longitudes by 91 latitudes. So my 2 arrays are:
>>> V_south(20,91) and V_east(20,91)
>>> I now want to feed these into Particle_trace.
>>> The syntax for Particle_trace requires a single array (which they call
>>> Data) of
>>> size Data[2,dx,dy]
>>> I'm assuming that dx and dy are the indexes for longitude and latitude
>>> and the first dimension (2)
>>> is for the 2 components of the field, so:
>>> data(0,lon,lat) = V_east(lon,lat)
>>> data(1,lon,lat) = 0.0 - V_south(lon,lat)
>>> Nowhere in the documentation does it define the directions - is dx
>>> Eastwards - is dy Northwards? Very confusing !!
>>> And the seed points - are these longitude, latitude points or
>>> something ? Again, no real explanation in the documentation.
>>> ....or have I got it completely wrong ?
>>> Any help with this very much appreciated
>>> Cheers,
>>> George.
>> Here's an example of using PARTICLE_TRACE:
>>
>> ; defines u, v, x, and y
>> restore, filepath('globalwinds.dat', subdir=['examples','data'])
>>
>> data = fltarr(2, 128, 64)
>> data[0, *, *] = u
>> data[1, *, *] = v
>>
>> ; define starting points
>> seeds = [[32, 32], [64, 32], [96, 32]]
>>
>> particle_trace, data, seeds, verts, conn, max_iterations=30
>>
>> ; plot the underlying vector field
>> velovect, u, v, x, y
>>
>> ; overplot the streamlines
>> i = 0
>> sz = size(verts, /structure)
>> while (i lt sz.dimensions[1]) do begin
>> nverts = conn[i]
>> plots, x[verts[0, conn[i+1:i+nverts]]], y[verts[1, conn[i+1:i
>> +nverts]]], $
>> color='0000FF'x, thick=2, linestyle=2
>> i += nverts + 1
>> endwhile
>>
>> Mike
>> --www.michaelgalloy.com
>> Tech-X Corporation
>> Software Developer II
>
> Mike
>
> Aha - so the seeds are just integer positions within the 2D array -
> got it - thanks !!
>
> Does it matter what the directions of U and V are - maybe not - hmm ?
>
> Thanks for the demo code - that example needs to make it into the
> reference guide.
>
> Cheers,
>
> George.
Hi George,
I've made what I hope are some clarifications to the PARTICLE_TRACE
reference documentation. Here's the meat of it:
Data
A three- or four-dimensional array that defines the vector field.
Data can be of dimensions [2, dx, dy] for a two-dimensional vector
field or [3, dx, dy, dz] for a three-dimensional vector field,
where:
- Data[0,*,*] or Data[0,*,*,*] contains the X components of the
two- or three-dimensional vector field (commonly referred to as U).
- Data[1,*,*] or Data[1,*,*,*] contains the Y components of the
two- or three-dimensional vector field (commonly referred to as V).
- Data[2,*,*,*] contains the Z components of the three-dimensional
vector field (commonly referred to as W).
Seeds
An array of two- or three-element vectors ([2, n] or [3, n])
specifying the indices of the n points in the Data array at which
the tracing operation is to begin. The result will be n output
paths.
And, with Mike's kind permission, I am including a (very slightly
modified) version of his example in the docs as well. These changes
will show up in the next release of the IDL help system.
Best wishes,
Doug
----------------
Douglas G. Dirks
IDL Documentation Group * ITT Visual Information Solutions
4990 Pearl East Circle * Boulder, CO 80301
ddirks@ittvis.com
|
|
|
Re: Particle_Trace question ? [message #59408 is a reply to message #59382] |
Tue, 18 March 2008 18:32  |
millward.george
Messages: 2 Registered: March 2008
|
Junior Member |
|
|
On Mar 18, 5:23 pm, "mgal...@gmail.com" <mgal...@gmail.com> wrote:
> On Mar 18, 4:56 pm, millward.geo...@gmail.com wrote:
>
>
>
>> Hi there,
>
>> I am trying to use particle_trace to create streamlines from a vector
>> field - but I'm having quite alot of trouble
>> understanding the documentation.
>
>> I have a velocity field which is a longitude,latitude array of
>> Southward and Eastward velocities.
>> My arrays are 20 longitudes by 91 latitudes. So my 2 arrays are:
>
>> V_south(20,91) and V_east(20,91)
>
>> I now want to feed these into Particle_trace.
>
>> The syntax for Particle_trace requires a single array (which they call
>> Data) of
>> size Data[2,dx,dy]
>
>> I'm assuming that dx and dy are the indexes for longitude and latitude
>> and the first dimension (2)
>> is for the 2 components of the field, so:
>
>> data(0,lon,lat) = V_east(lon,lat)
>> data(1,lon,lat) = 0.0 - V_south(lon,lat)
>
>> Nowhere in the documentation does it define the directions - is dx
>> Eastwards - is dy Northwards? Very confusing !!
>
>> And the seed points - are these longitude, latitude points or
>> something ? Again, no real explanation in the documentation.
>
>> ....or have I got it completely wrong ?
>
>> Any help with this very much appreciated
>
>> Cheers,
>
>> George.
>
> Here's an example of using PARTICLE_TRACE:
>
> ; defines u, v, x, and y
> restore, filepath('globalwinds.dat', subdir=['examples','data'])
>
> data = fltarr(2, 128, 64)
> data[0, *, *] = u
> data[1, *, *] = v
>
> ; define starting points
> seeds = [[32, 32], [64, 32], [96, 32]]
>
> particle_trace, data, seeds, verts, conn, max_iterations=30
>
> ; plot the underlying vector field
> velovect, u, v, x, y
>
> ; overplot the streamlines
> i = 0
> sz = size(verts, /structure)
> while (i lt sz.dimensions[1]) do begin
> nverts = conn[i]
> plots, x[verts[0, conn[i+1:i+nverts]]], y[verts[1, conn[i+1:i
> +nverts]]], $
> color='0000FF'x, thick=2, linestyle=2
> i += nverts + 1
> endwhile
>
> Mike
> --www.michaelgalloy.com
> Tech-X Corporation
> Software Developer II
Mike
Aha - so the seeds are just integer positions within the 2D array -
got it - thanks !!
Does it matter what the directions of U and V are - maybe not - hmm ?
Thanks for the demo code - that example needs to make it into the
reference guide.
Cheers,
George.
|
|
|
Re: Particle_Trace question ? [message #59409 is a reply to message #59408] |
Tue, 18 March 2008 16:23  |
Michael Galloy
Messages: 1114 Registered: April 2006
|
Senior Member |
|
|
On Mar 18, 4:56 pm, millward.geo...@gmail.com wrote:
> Hi there,
>
> I am trying to use particle_trace to create streamlines from a vector
> field - but I'm having quite alot of trouble
> understanding the documentation.
>
> I have a velocity field which is a longitude,latitude array of
> Southward and Eastward velocities.
> My arrays are 20 longitudes by 91 latitudes. So my 2 arrays are:
>
> V_south(20,91) and V_east(20,91)
>
> I now want to feed these into Particle_trace.
>
> The syntax for Particle_trace requires a single array (which they call
> Data) of
> size Data[2,dx,dy]
>
> I'm assuming that dx and dy are the indexes for longitude and latitude
> and the first dimension (2)
> is for the 2 components of the field, so:
>
> data(0,lon,lat) = V_east(lon,lat)
> data(1,lon,lat) = 0.0 - V_south(lon,lat)
>
> Nowhere in the documentation does it define the directions - is dx
> Eastwards - is dy Northwards? Very confusing !!
>
> And the seed points - are these longitude, latitude points or
> something ? Again, no real explanation in the documentation.
>
> ....or have I got it completely wrong ?
>
> Any help with this very much appreciated
>
> Cheers,
>
> George.
Here's an example of using PARTICLE_TRACE:
; defines u, v, x, and y
restore, filepath('globalwinds.dat', subdir=['examples','data'])
data = fltarr(2, 128, 64)
data[0, *, *] = u
data[1, *, *] = v
; define starting points
seeds = [[32, 32], [64, 32], [96, 32]]
particle_trace, data, seeds, verts, conn, max_iterations=30
; plot the underlying vector field
velovect, u, v, x, y
; overplot the streamlines
i = 0
sz = size(verts, /structure)
while (i lt sz.dimensions[1]) do begin
nverts = conn[i]
plots, x[verts[0, conn[i+1:i+nverts]]], y[verts[1, conn[i+1:i
+nverts]]], $
color='0000FF'x, thick=2, linestyle=2
i += nverts + 1
endwhile
Mike
--
www.michaelgalloy.com
Tech-X Corporation
Software Developer II
|
|
|