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

Re: little and big endian -- once more



Martin Schultz wrote:
> So, I guess, I should give Liam's suggestion a try.
> Unfortunately, it seems that you must know what's in the file in order
> to test it, but that's probably a good idea anyway when you are dealing
> with binary files ;-)

Yeah, it's pretty hard to read a binary file if you don't know the
format.

> Just for clarification: is it true that the
> endian matters for integers as well as floats?

Yes, it's true.

Here at SSEC we've messed with porting binary datafiles for years.
However in the last year or so, netCDF has become very widely used in
our applications. Some of the reasons are:
(1) No more byte-swapping worries, ever.
(2) The same IDL code can read the same datafile and give the same
results on any IDL platform (Unix, Linux, Windows, Mac).
(3) If you give someone the file and tell them it's netCDF, they can
then easily figure out what it contains. You don't need to tell them the
format details.
(4) The netCDF API is available for Fortran77/90, C, C++, IDL, Matlab,
perl, Python, and Java.
(5) The API is very simple and concise: the only things you can store in
a netCDF file are arrays, attributes, and dimensions. However, you can
create structures using these building blocks which are as simple or as
complex as you like.
(6) netCDF supports the following IDL datatypes: BYTE, STRING, INT,
LONG, FLOAT, DOUBLE.

More information is available at
http://www.unidata.ucar.edu/packages/netcdf/faq.html

---
Liam E. Gumley
Space Science and Engineering Center, UW-Madison
http://cimss.ssec.wisc.edu/~gumley