Updates

 

How to change Small Endian format to Big Endian format

Question:

I have successfully downloaded the hourly PAR file, but I am having problems unzipping and reading it. I suspect my problems are related to the little endian/big endian issue, since we have IBM/AIX and SGI/IRIX systems rather than DEC systems. In addition, I noticed in the "readme" file that the uncompressed files should be about 15.5 MB. However, when I download the *.gz file, I am finding that it is already about 16 MB, implying that it is already uncompressed. Is it zipped or unzipped? And do you know of a method to transform the file into a format my computers can read? I have some colleagues who have DEC machines, but I would prefer not to ask them for assistance if there is a method that we can use in-house. Any help you can give me will be greatly appreciated. I am enthusiastic about the possibility of using your data--the quality and areal coverage are unequaled, and I think we can improve our modeling significantly if we can use them.

Answer:

In general, as stated in the "readme" file, the uncompressed file is about 15.5MB, but it could be over 15MB. The data you download is an compressed file. You should uncompress it before you read it.

For transforming into the format your computer can read, as also described in the "Data Description" section( http://metosrv2.umd.edu/~srb/gcip/readme.htm), under "File structure", the binary data conform to the little endian specification of IEEE. Presumably, IBM and SGI computers use the big endian representation of binary data. To read the data correctly on a big-endian machine, the bytes must be swapped around the middle. The FORTRAN compiler on your machine may have an option for doing the conversion between the two formats. Alternatively, you may want to try the Fortran program (read_d_bigend.f). This is a big-endian version of read_d.f. It has a subroutine to swap the bytes.

Tthe sample code assumes that the record length is given in 4-byte words. If your compiler requires bytes for the record length, you should uncomment the line "Lrec = 4 * Nlon" and comment out the line "Lrec =Nlon" in the read programs.

 


Home Project Background Data Access Validation The Gallery Known Problems Links Contacts References Updates Faq