Create grads-compatible (fortran-unformatted) binary files with perl

P.R. romero619 at HOTMAIL.COM
Thu May 21 19:58:07 EDT 2009


Im trying to setup a perl script to create a grads binary file.

Based on the documentation, the grads binary files are in sequential
(unformatted) fortran binary format.
So, they should contain a record header, record, & record trailer.

Example for a record containing a 32bit single-precision float ('REAL*4' in
fortan).
4byte/32bit header:
Value='4'

4byte/32bit record:
Value='3.23343'

4byte/32bit trailer:
Value='4'

I have a few questions on how GrADS reads (fortran unformatted) binary
files:

1) how many bytes should the record header&trailer be?
Is this platform-specific, or does GrADS expect a specific size?

2) grads expects each record to contain a REAL (float) value, correct?

3) if question #2 is correct, does grads expect "REAL" values in the binary
file to be 4 bytes or 8?
So, if my data is a 'double' data-type, should it be forced to 'REAL*8',
i.e. 64bit double-precision float?
Or, does it need to be 'REAL*4', 32bit single precision float?

Please help,
Thanks,
P.Romero



More information about the gradsusr mailing list