[ncl-talk] help reading binary file

Laura Fowler laura at ucar.edu
Fri Nov 20 17:25:40 MST 2015


Hi:

I created a binary file using a fortran sourcecode on my iMac. Using
gfortran, I used the option -fconvert=big-endian tom compie the
sourcecode. I used the open statement:

open(unit=21,file='oro_usgs.bin',form='unformatted',access='sequential')

to write the data out. I want to open and read the file in an ncl
script to later plot the data. My script looks like that:

setfileoption("bin","ReadByteOrder","BigEndian")
file1    = "oro_usgs.bin"
recl     = 43200*21600
oro_usgs = fbinread(file1,recl,"float")
print(max(oro_usgs))
printVarSummary(oro_usgs)

I get the error:
 See http://www.ncl.ucar.edu/ for more details.
 fatal:fbinread: 0 or less than zero fortran control word, FILE NOT
SEQUENTIAL ACCESS!
 fatal:["Execute.c":8128]:Execute: Error occurred at or near line 17
in file plot.ncl

without the setfileoption, I get the error:

See http://www.ncl.ucar.edu/ for more details.
fatal:fbinread: requested variable size exceeds record size
fatal:["Execute.c":8128]:Execute: Error occurred at or near line 17 in
file plot.ncl


I do not know what to do next and help would be greatly appreciated. Thanks,

Laura


-- 
!-------------------------------------------------------------------------------------------------------------
Laura D. Fowler
Mesoscale and Microscale Meteorology Division (MMM)
National Center for Atmospheric Research
P.O. Box 3000, Boulder CO 80307-3000

e-mail: laura at ucar.edu
phone: 303-497-1628

!-------------------------------------------------------------------------------------------------------------


More information about the ncl-talk mailing list