Re: Read End-of-file for Fortran Sequential Access

From: Dave Allured - NOAA Affiliate <dave.allured_at_nyahnyahspammersnyahnyah>
Date: Fri Jun 14 2013 - 15:03:31 MDT

Bruce,

Although I have never used this, it looks like there is an NCL
function for this exact purpose:
http://www.ncl.ucar.edu/Document/Functions/Built-in/fbinnumrec.shtml

--Dave

On Fri, Jun 14, 2013 at 2:29 PM, Lunde, Bruce N CIV NAVOCEANO, NP1
<bruce.lunde@navy.mil> wrote:
> Hello,
>
> I have a binary Fortran sequential access file
> that I am trying to read with
>
> setfileoption("bin","ReadByteOrder","BigEndian")
> nssh = fbinrecread(FILESSH, 0, 1, "integer")
> sshlat = fbinrecread(FILESSH, 4, nssh, "float")
> sshlon = fbinrecread(FILESSH, 5, nssh, "float")
>
> The problem is that the file is made up of many
> such sections of data (in the same sequence).
> Thus the datafile looks something like this:
>
> nssh1
> sshlat1
> sshlon1
> nssh2
> sshlat2
> sshlon2
> ...
> ...
> ...
> nsshN
> sshlatN
> sshlonN
>
> I do not know how many sections of data there are.
> In Fortran I can try to read the next "nsshN" value
> and if there is an error/EOF I can specify what to
> do (i.e. what line of code to jump to).
>
> Is there some way in NCL to try and do this (catch
> the EOF error and continue on in the script) ?
>
> When I do try and read beyond the last data record,
> I get this message and this value for nssh:
>
> warning:fbinrecread: size specified is less than record size, some data will not be read
> nssh=1133733212
>
> Thanks, Bruce
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Jun 14 15:03:44 2013

This archive was generated by hypermail 2.1.8 : Mon Jun 24 2013 - 11:46:47 MDT