Re: Reading and using GrADS format binary data in IDL [message #36594] |
Tue, 07 October 2003 08:30 |
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
|
|
|