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

Home » Public Forums » archive » Re: Read 3D array into IDL
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: Read 3D array into IDL [message #39172] Wed, 28 April 2004 19:57 Go to next message
Tmorri is currently offline  Tmorri
Messages: 10
Registered: April 2004
Junior Member
this is the info I have about the data:

Dims: 409x233x5 [BIP]
Size: [Integer] 1,078,784 bytes
File type: AVHRR CD
Sensor type: AVHRR
Byte Order: Host [Intel]
Projection: None
Pixel: 4400 Meters
Upper Left Corner: 1,1
Description: AVHRR GHRR file

The file was downloaded from the internet, it contains satellite data (one
image for each of the 5 channels of the sensor AVHRR in a NOAA
satellite).

your code did the job very well, I could read the data into IDL, but when
I displayed the Images on the screen I got something useless. Could you
suggest anything else?

Thank you for your time and help.

Tmorri
Re: Read 3D array into IDL [message #39174 is a reply to message #39172] Wed, 28 April 2004 12:55 Go to previous messageGo to next message
James Kuyper is currently offline  James Kuyper
Messages: 425
Registered: March 2000
Senior Member
Tmorri wrote:
> I have a 3D array [409x233x5] in my C drive, I need to read the data into
> IDL and then process it.
> Could anyone tell me how to read the data?

Not until you explain the precise format of the data. Is the array an
array of integers, floating point numbers, or strings? If it's numeric
data, are the numbers stored as binary data or as ascii text strings? If
binary format is used, how many bytes are used for the numbers? If
it's in text format, what delimiters are used, if any?

In what order to the three dimensions vary? For instance, consider a
2x2x2 array named 'array'. One of the possible orders it could be
printed out in is the following (this is the natural order for IDL):

array[0,0,0] array[1,0,0]
array[0,1,0] array[1,1,0]

array[0,0,1] array[1,0,1]
array[0,1,1] array[1,1,1]

On the assumption that your data is stored as an ascii text file
containing 409*233*5 floating point numbers, with natural IDL dimension
ordering, then the following should do the job quite nicely:

data = FLTARR(409,233,5)
OPENR,infile,'C:\path\name\filename.txt',/GET_LUN
READF,infile,data
CLOSE,infile
Re: Read 3D array into IDL [message #39255 is a reply to message #39172] Fri, 30 April 2004 23:14 Go to previous message
jnettle1 is currently offline  jnettle1
Messages: 27
Registered: January 2001
Junior Member
the most obvious differences between James' code and the file info you
presented, you need to use and intarr rather than a fltarr (but i'm
betting you caught that yourself since IDL read the file without
errors), and James' code would work for BSQ files (BSQ = band
sequential). Your data are BIP (band interleaved by pixel), so more
than likely you've read the data in the wrong order. You have a 5-band
image cube. In BIP images, the values of each of all five bands for
pixel (0,0) are read first, then all five for pixel (0,1), and so on.
Reading the data in as BSQ assumes that the all values for all pixels
for band 1 are first, followed by all values for all pixels for band
2, and so on. Lastly, you might need to set !order = 1 to have the
origin be at the top left of the image cube rather than bottom
left....I'm not sure about this one though.


Good luck, hope this helps.
Jeff

"Tmorri" <torrimorri@yahoo.com> wrote in message news:<9d9a7a938d21f6262254716c471d4d3e@localhost.talkaboutprogramming.com>...
> this is the info I have about the data:
>
> Dims: 409x233x5 [BIP]
> Size: [Integer] 1,078,784 bytes
> File type: AVHRR CD
> Sensor type: AVHRR
> Byte Order: Host [Intel]
> Projection: None
> Pixel: 4400 Meters
> Upper Left Corner: 1,1
> Description: AVHRR GHRR file
>
> The file was downloaded from the internet, it contains satellite data (one
> image for each of the 5 channels of the sensor AVHRR in a NOAA
> satellite).
>
> your code did the job very well, I could read the data into IDL, but when
> I displayed the Images on the screen I got something useless. Could you
> suggest anything else?
>
> Thank you for your time and help.
>
> Tmorri
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Randomu Period
Next Topic: Re: IDL 6.0.x crashes on mac os x?

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

Current Time: Wed Oct 08 16:51:56 PDT 2025

Total time taken to generate the page: 0.00539 seconds