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

Home » Public Forums » archive » Re: what is the best way to do a surface (or 2D) interpolation?
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: what is the best way to do a surface (or 2D) interpolation? [message #62704 is a reply to message #62702] Tue, 23 September 2008 12:46 Go to previous messageGo to previous message
Vince Hradil is currently offline  Vince Hradil
Messages: 574
Registered: December 1999
Senior Member
On Sep 23, 12:25 pm, Brian Larsen <balar...@gmail.com> wrote:
>> Here's a way to get verts:
>
>> sz = size(array)
>> nx = sz[0]
>> ny = sz[1]
>> nz = sz[2]
>> ns = sz[sz[0]+2]
>> verts = findgen(ns)
>> verts = transpose([ [verts mod nx], [verts/nx mod ny], [verts/nx/
>> ny] ])
>
>> BTW, I'd like to find a faster way, if there is one.
>
> This looks like the right thing but doesn't seem to give the right
> answer (or am I using it wrong?)
>
> ;; this is my data
> array=findgen(15,3)
> ;; and get the verts
> sz = size(array)
> nx = sz[0]
> ny = sz[1]
> nz = sz[2]
> ns = sz[sz[0]+2]
> verts = findgen(ns)
> verts = transpose([ [verts mod nx], [verts/nx mod ny], [verts/nx/
> ny] ])
>
> IDL> print, verts
>       0.00000      0.00000      0.00000
>       1.00000     0.500000    0.0333333
>       0.00000      1.00000    0.0666667
>       1.00000      1.50000     0.100000
>       0.00000      2.00000     0.133333
>       1.00000      2.50000     0.166667
>
> The z values that are here are not in my original array...
>
> Sorry to hijack your post Paula,
>
> Brian
>
> ------------------------------------------------------------ --------------
> Brian Larsen
> Boston University
> Center for Space Physicshttp://people.bu.edu/balarsen/Home/IDL

My example is for 3d arrays only! For 2d arrays, just use:
nx = sz[1]
ny = sz[2]
verts = lindgen(nx*ny)
verts = transpose( [ [verts mod nx], [verts/nx] ] )

There was a typo in the original, too. nx=sz[1] not sz[0], and so on.

Yes, it should be lindgen...
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Getting array indices
Next Topic: giving input to fortran program using spawn in IDL

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

Current Time: Thu Oct 09 17:23:00 PDT 2025

Total time taken to generate the page: 0.63643 seconds