Re: Limiting concatenation IDL 5.5 [message #31228] |
Thu, 27 June 2002 22:11 |
Dick Jackson
Messages: 347 Registered: August 1998
|
Senior Member |
|
|
"William Thompson" <thompson@orpheus.nascom.nasa.gov> wrote in message
news:afg4kr$hlu$1@skates.gsfc.nasa.gov...
> Randall Skelton <rhskelto@atm.ox.ac.uk> writes:
>
>> Ok... I have to ask. Is there actually a nice, clean way to
concatenate
>> multidimensional arrays in IDL?
>
>> a = make_array(2,2,2,2)
>> b = make_array(2,2,2,5)
>
>> data1 = [ [[[a]]] , [[[b]]] ]
>
>> Obviously the above fails, but what is the solution? Surely some
>> combination of rebin/reform...
>
> How about
>
> c = make_array(2,2,2,7)
> c(0,0,0,0) = a
> c(0,0,0,2) = b
>
> Of course, you'd want to put this into a routine, with calls to
SIZE(), etc.
[Uh, David, make sure Bill gets a seat on the board of that IDL Experts'
group.]
Nice point, Bill! Your idea takes a bit of hackery, I'll take a swipe at
some of it:
concatSize = Size(a)
concatSize[dim+1] = concatSize[dim+1] + (Size(b))[dim+1]
c=Make_Array(Size=concatSize)
nDims=Size(a,/N_Dimensions)
aDims=Size(a,/Dimensions)
; This needs to be generalized for all
; possible values of nDims from 1 to 8, (4 assumed)
; either by a CASE statement or tricky
; string handling and Execute():
c[0, 0, 0, 0] = a
c[dim eq 0 ? aDims[0] : 0, $
dim eq 1 ? aDims[1] : 0, $
dim eq 2 ? aDims[2] : 0, $
dim eq 3 ? aDims[3] : 0]=b
Cheers,
--
-Dick
Dick Jackson / dick@d-jackson.com
D-Jackson Software Consulting / http://www.d-jackson.com
Calgary, Alberta, Canada / +1-403-242-7398 / Fax: 241-7392
|
|
|
Re: Limiting concatenation IDL 5.5 [message #31234 is a reply to message #31228] |
Thu, 27 June 2002 15:46  |
thompson
Messages: 584 Registered: August 1991
|
Senior Member |
|
|
Randall Skelton <rhskelto@atm.ox.ac.uk> writes:
> Ok... I have to ask. Is there actually a nice, clean way to concatenate
> multidimensional arrays in IDL?
> a = make_array(2,2,2,2)
> b = make_array(2,2,2,5)
> data1 = [ [[[a]]] , [[[b]]] ]
> Obviously the above fails, but what is the solution? Surely some
> combination of rebin/reform...
How about
c = make_array(2,2,2,7)
c(0,0,0,0) = a
c(0,0,0,2) = b
Of course, you'd want to put this into a routine, with calls to SIZE(), etc.
Bill Thompson
|
|
|
Re: Limiting concatenation IDL 5.5 [message #31269 is a reply to message #31234] |
Tue, 25 June 2002 10:06  |
Randall Skelton
Messages: 169 Registered: October 2000
|
Senior Member |
|
|
Ok... I have to ask. Is there actually a nice, clean way to concatenate
multidimensional arrays in IDL?
a = make_array(2,2,2,2)
b = make_array(2,2,2,5)
data1 = [ [[[a]]] , [[[b]]] ]
Obviously the above fails, but what is the solution? Surely some
combination of rebin/reform...
On Tue, 25 Jun 2002, Randall Skelton wrote:
> Date: Tue, 25 Jun 2002 16:49:26 +0100
> From: Randall Skelton <rhskelto@atm.ox.ac.uk>
> Newsgroups: comp.lang.idl-pvwave
> Subject: Limiting concatenation IDL 5.5
>
> Hi all,
>
> Having just re-read the dimensional juggling tutorials posted by JD, I
> noticed that in IDL 5.5 (Linux) the limit to the practical concatenation
> dimension was increased from 3 up to 8 ;) Being one of those people who
> occasionally use more than 3 dimensions, this makes my life a whole lot
> easier.
>
> Of course, don't try and go for 9...
>
> IDL> a = findgen(20)
> IDL> print, [[[[[[[[[a]]]]]]]]]
> Segmentation fault
>
> Does anyone else observe the same?
>
> Cheers,
> Randall
>
>
|
|
|
Re: Limiting concatenation IDL 5.5 [message #31270 is a reply to message #31269] |
Tue, 25 June 2002 09:31  |
Randall Skelton
Messages: 169 Registered: October 2000
|
Senior Member |
|
|
Sorry... it seems I was wrong about the number of levels of concatenation
being increased. The seg. fault still exists.
On Tue, 25 Jun 2002, Randall Skelton wrote:
> Hi all,
>
> Having just re-read the dimensional juggling tutorials posted by JD, I
> noticed that in IDL 5.5 (Linux) the limit to the practical concatenation
> dimension was increased from 3 up to 8 ;) Being one of those people who
> occasionally use more than 3 dimensions, this makes my life a whole lot
> easier.
>
> Of course, don't try and go for 9...
>
> IDL> a = findgen(20)
> IDL> print, [[[[[[[[[a]]]]]]]]]
> Segmentation fault
>
> Does anyone else observe the same?
>
> Cheers,
> Randall
>
>
|
|
|