[ncl-talk] help reading binary file

Dennis Shea shea at ucar.edu
Fri Nov 20 17:53:40 MST 2015


fortran binary writes can create 'flat' binary files (access='direct')
or access='sequential'. The latter is the default.

To read 'flat' files use: fbinread

To read 'sequential' (which you explicitly specified) use: fbinrecread

===
Note: fortran precedes *each* sequential record by a  record separator.

Good luck


On Fri, Nov 20, 2015 at 5:25 PM, Laura Fowler <laura at ucar.edu> wrote:
> 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
>
> !-------------------------------------------------------------------------------------------------------------
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk


More information about the ncl-talk mailing list