fbinread can't read binary file created by Fortran correctly

From: Xitian Cai <brookcai_at_nyahnyahspammersnyahnyah>
Date: Wed Jun 13 2012 - 09:48:41 MDT

Hi All,

I'm writing a NCL script to read regular binary files created by FORTRAN.
For example, when I compiled the FORTRAN code using ifort compiler and
write the binary file, the NCL script is working fine to read it, however
when I use gfortran, fbinread got the first value as 0 and neglect the last
value. The attached are the example FORTRAN code, NCL script and the binary
file created by the FORTRAN code using FORTRAN compiler.

(1) Compile code: gfortran write_binary_test.f
(2) Run a.out, which creates the binary file Test_WrittenByF.bin
(3) Run "ncl ReadWrite_Binary_NCL.ncl" which will print the data.

The result should be: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
But I got:
(0,0) 0
(0,1) 1
(0,2) 2
(0,3) 3
(0,4) 4
(1,0) 5
(1,1) 6
(1,2) 7
(1,3) 8
(1,4) 9
(2,0) 10
(2,1) 11
(2,2) 12
(2,3) 13
(2,4) 14

Does anyone know the problem?

Thanks,

Xitian

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk

Received on Wed Jun 13 09:48:50 2012

This archive was generated by hypermail 2.1.8 : Fri Jun 15 2012 - 14:51:31 MDT