[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

New Binary Data I/O Tools

I've just posted a couple of new procedures (BINWRITE and BINREAD) which
allow I/O of arrays in IDL using a simple, portable binary format, e.g.

Write array(s) to a portable output file:

a = dist(256) 
b = bindgen(100) 
openw, lun, 'test.dat', /get_lun 
binwrite, lun, a 
binwrite, lun, b 
free_lun, lun 

Read array(s) from the above input file:

openr, lun, 'test.dat', /get_lun 
binread, lun, c, header=header 
binread, lun, d 
free_lun, lun 
print, header 
help, c, d 

The advantage of these routines is that they provide a way to write
binary data that can be read back easily in IDL, or other environments
(FORTRAN, C, Matlab etc.), on any host platform without using SAVE, XDR,
or Standard Data Formats. The SAVE and XDR formats in IDL are useful in
certain cases, but they produce files which can be difficult to read in
other environments. Standard formats like CDF, netCDF, or HDF get around
this problem, but they require the user to learn a new API, which can
sometimes be a bit daunting. 

You can find BINWRITE and BINREAD, and a description of the format, at


Liam E. Gumley
Space Science and Engineering Center, UW-Madison