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

Home » Public Forums » archive » Re: Quick array question
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: Quick array question [message #21679] Wed, 13 September 2000 14:30
Mark Hadfield is currently offline  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 Go to previous message
Liam E. Gumley is currently offline  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
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: String/integer use in variable definitions
Next Topic: Re: Odd string/index problem

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

Current Time: Wed Oct 08 19:44:06 PDT 2025

Total time taken to generate the page: 0.00430 seconds