Create grads-compatible (fortran-unformatted) binary files with perl
Ryo Furue
furue at HAWAII.EDU
Thu May 21 23:26:27 EDT 2009
Hi GrADS users,
| Based on the documentation, the grads binary files are in sequential
| (unformatted) fortran binary format.
If your purpose is solely to create files for GrADS,
the stream binary is definitely the way to go. But,
if you want to read the data also from Fortran, the
sequential format is sometimes more convenient.
| So, they should contain a record header, record, & record trailer.
[. . .]
| 1) how many bytes should the record header&trailer be?
| Is this platform-specific, or does GrADS expect a specific size?
For future reference, I describe the Fortran file format here.
(Jennifer already answered what format GrADS expects.)
In theory, the Fortran format is implementation-specific.
In practice (that is, if you forget about the old dinosaurs
like the IBM mainframe), the format is almost always this:
1) a record = header|data|trailer;
2) the header is a signed integer
that is the size of the data in bytes;
3) the trailer is identical to the header;
4) the header is usually four bytes.
An obvious problem is that this format allows only
up to 2 GiB of data per record. So, modern Fortran
compilers sometimes (usually?) have an option to
switch to an eight-byte header.
Regards,
Ryo
More information about the gradsusr
mailing list