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

Home » Public Forums » archive » Re: Reading and using GrADS format binary data in 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: Reading and using GrADS format binary data in IDL [message #36594] Tue, 07 October 2003 08:30
Rick Towler is currently offline  Rick Towler
Messages: 821
Registered: August 1998
Senior Member
"Maura Hannenberger" wrote ...

> How do you read in and then call up data in binary format. It is in the
> type that is used in GrADS...

A good place to start would be here:

http://gmao.gsfc.nasa.gov/data_stuff/formatPages/grads.html

It looks like grads is a 32bit float binary flat file which should be pretty
easy to read (at least their example leads one to believe this).

In IDL take a look at the OPENR and READU procedures. Keep in mind that
multi-byte binary data has an order, or endian-ness. x86 machines assume
that the low byte comes first (little-endian) and (most of) the rest of the
world assumes the high byte comes first. This matters when you are sharing
data between these platforms, say when you run your model on that trusty
alpha in the corner but process data on your windows PC. OPENR has keywords
to help deal with endian-ness.

To read in the single level 144x91 example give on the above webpage you
would do something like:

data = FLTARR(144,91)
OPENR, lun, 'mytestfile.grads', /GET_LUN
READU, lun, data
FREE_LUN, lun


Hope this helps.

-Rick
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: inconsistence in 5.4 -> 6.0
Next Topic: Re: Help! G4 problem reading ascii data

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

Current Time: Wed Oct 08 15:57:15 PDT 2025

Total time taken to generate the page: 0.00505 seconds