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

Home » Public Forums » archive » Re: Array Concatenation?
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: Array Concatenation? [message #80743] Fri, 29 June 2012 11:16 Go to next message
Heinz Stege is currently offline  Heinz Stege
Messages: 189
Registered: January 2003
Senior Member
On Fri, 29 Jun 2012 04:02:28 -0700 (PDT), rjp23@le.ac.uk wrote:

> Hi
>
> I have two 4 dimensional arrays like so:
>
> Array[480, 241, 60, 124]
>
> The 4th dimension (124 elements) is time. I want to concatenate the 1st timestep for the second array to the first array, something like this:
>
>
> new=[array1, array2[*, *, *, 0]]
>
> But I can't get the syntax correct to do the concatenation on the 4th dimension.
>
> Any ideas what I'm doing wrong? I've tried various levels of []'s but can't get it working.
>
> Cheers

David Fanning has written an article about this:
http://www.idlcoyote.com/tips/array_concatenation.html

HTH, Heinz
Re: Array Concatenation? [message #80747 is a reply to message #80743] Fri, 29 June 2012 07:46 Go to previous messageGo to next message
lecacheux.alain is currently offline  lecacheux.alain
Messages: 325
Registered: January 2008
Senior Member
On 29 juin, 13:02, rj...@le.ac.uk wrote:
> Hi
>
> I have two 4 dimensional arrays like so:
>
> Array[480, 241, 60, 124]
>
> The 4th dimension (124 elements) is time. I want to concatenate the 1st timestep for the second array to the first array, something like this:
>
> new=[array1, array2[*, *, *, 0]]
>
> But I can't get the syntax correct to do the concatenation on the 4th dimension.
>
> Any ideas what I'm doing wrong? I've tried various levels of []'s but can't get it working.
>
> Cheers
>
>

IDL concatenates arrays over the first dimension by using [array1,
array2] construct.
To achieve concatenation in your case, you might transpose your arrays
first, then transpose the result back, as follows:

new = transpose([transpose(array1), (transpose(array2))[0,*,*,*])

The second array must be transposed before you select last column
elements to avoid implicit elimination by IDL of the last dimension in
array2[*,*,*,0].

alain.
Re: Array Concatenation? [message #80777 is a reply to message #80743] Wed, 11 July 2012 02:10 Go to previous message
rjp23 is currently offline  rjp23
Messages: 97
Registered: June 2010
Member
On Friday, June 29, 2012 7:16:33 PM UTC+1, Heinz Stege wrote:
> On Fri, 29 Jun 2012 04:02:28 -0700 (PDT), rjp23@le.ac.uk wrote:
>
> >Hi
> >
> >I have two 4 dimensional arrays like so:
> >
> >Array[480, 241, 60, 124]
> >
> >The 4th dimension (124 elements) is time. I want to concatenate the 1st timestep for the second array to the first array, something like this:
> >
> >
> >new=[array1, array2[*, *, *, 0]]
> >
> >But I can't get the syntax correct to do the concatenation on the 4th dimension.
> >
> >Any ideas what I'm doing wrong? I've tried various levels of []'s but can't get it working.
> >
> >Cheers
>
> David Fanning has written an article about this:
> http://www.idlcoyote.com/tips/array_concatenation.html
>
> HTH, Heinz

Unfortunately I believe the caveat to that article applies here:

"One caveat: a bug in IDL (as I see it) limits the practical concatenation dimension to 3, even though up to 8 dimensions are supported (i.e. only two pairs of extra brackets are allowed per entry... sorry no [[[[[[[a]]]]]]] permitted). You'll need higher magic if you use 8 dimensional datasets anyway. "

I guess what I was really asking was what this "higher magic" was.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Passing variables between procedures
Next Topic: Array Concatenation?

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

Current Time: Wed Oct 08 11:40:31 PDT 2025

Total time taken to generate the page: 0.00493 seconds