How to reform a 3-D array? [message #90603] |
Fri, 13 March 2015 09:20  |
atmospheric physics
Messages: 121 Registered: June 2010
|
Senior Member |
|
|
Hello,
I have a data array in 3-dimensions i.e., X -> BYTE = [3,360,2167]. I want to transform the data array retaining the same dimensions as X' -> BYTE = [3,2167,360]. Is there a simple function in IDL which can automatically rearrange the data to the new dimensions?
Any suggestions would be of great help.
Thanking you in advance,
Regards,
Madhavan
|
|
|
Re: How to reform a 3-D array? [message #90604 is a reply to message #90603] |
Fri, 13 March 2015 09:24   |
Helder Marchetto
Messages: 520 Registered: November 2011
|
Senior Member |
|
|
On Friday, March 13, 2015 at 5:20:29 PM UTC+1, Madhavan Bomidi wrote:
> Hello,
>
> I have a data array in 3-dimensions i.e., X -> BYTE = [3,360,2167]. I want to transform the data array retaining the same dimensions as X' -> BYTE = [3,2167,360]. Is there a simple function in IDL which can automatically rearrange the data to the new dimensions?
>
> Any suggestions would be of great help.
>
> Thanking you in advance,
> Regards,
> Madhavan
Would this do:
IDL> a = bytarr(3,50,100)
IDL> help, transpose(a,[0,2,1])
<Expression> BYTE = Array[3, 100, 50]
Cheers,
Helder
|
|
|
Re: How to reform a 3-D array? [message #90605 is a reply to message #90604] |
Fri, 13 March 2015 09:27  |
Helder Marchetto
Messages: 520 Registered: November 2011
|
Senior Member |
|
|
On Friday, March 13, 2015 at 5:24:58 PM UTC+1, Helder wrote:
> On Friday, March 13, 2015 at 5:20:29 PM UTC+1, Madhavan Bomidi wrote:
>> Hello,
>>
>> I have a data array in 3-dimensions i.e., X -> BYTE = [3,360,2167]. I want to transform the data array retaining the same dimensions as X' -> BYTE = [3,2167,360]. Is there a simple function in IDL which can automatically rearrange the data to the new dimensions?
>>
>> Any suggestions would be of great help.
>>
>> Thanking you in advance,
>> Regards,
>> Madhavan
>
> Would this do:
> IDL> a = bytarr(3,50,100)
> IDL> help, transpose(a,[0,2,1])
> <Expression> BYTE = Array[3, 100, 50]
>
> Cheers,
> Helder
Here is a better example:
IDL> file1 = FILEPATH('Night.jpg', SUBDIRECTORY=['examples','data'])
IDL> read_jpeg, file1, a
IDL> help, a
A BYTE = Array[3, 1024, 512]
IDL> image(transpose(a,[0,2,1]))
This way the image is...weel, transposed.
Cheers,
Helder
|
|
|