Re: Quick array question [message #21679] |
Wed, 13 September 2000 14:30 |
Mark Hadfield
Messages: 783 Registered: May 1995
|
Senior Member |
|
|
"Liam E. Gumley" <Liam.Gumley@ssec.wisc.edu> wrote in message
news:39BFEBA1.65DBBA99@ssec.wisc.edu...
> Ricardo Fonseca wrote:
>> How does IDL store arrays in memory, does it use c style ordering or
fortran
>> style ordering?
Just a quick incidental comment now that Liam's answered the actual
question. I find it strange that people talk about the order in which the
arrays are stored in memory (column-major, row-major and all that stuff). To
my mind, it's not the storage order that differs between languages, it's the
*order in which you write the subscripts*.
Just my NZ$0.02 (approx US$0.008) worth.
---
Mark Hadfield
m.hadfield@niwa.cri.nz http://katipo.niwa.cri.nz/~hadfield/
National Institute for Water and Atmospheric Research
PO Box 14-901, Wellington, New Zealand
|
|
|
Re: Quick array question [message #21686 is a reply to message #21679] |
Wed, 13 September 2000 00:00  |
Liam E. Gumley
Messages: 378 Registered: January 2000
|
Senior Member |
|
|
Ricardo Fonseca wrote:
> How does IDL store arrays in memory, does it use c style ordering or fortran
> style ordering?
>
> Here's my problem, I wrote a fortran program that writes a binary file to
> disk with an array (nx,ny,nz). Now when I read that file should I do
>
> data = fltarr(nx,ny,nz)
> readu, unit, data
>
> or should I do
>
> data = fltarr(nz,ny,nx)
> readu, unit, data
>
> and convert it later?
IDL uses FORTRAN-style ordering for arrays in memory. If you wrote the
array in FORTRAN with dimensions (nx, ny, nz), then read it in IDL with
dimensions (nx, ny, nz).
Cheers,
Liam.
http://cimss.ssec.wisc.edu/~gumley
|
|
|