[ncl-talk] lat lon info in binary file

Dennis Shea shea at ucar.edu
Tue Mar 16 08:15:13 MDT 2021


e384tile1.dat  ==> 589832 bytes

(589832/4) = 147458 values  [real or integer]

Since the division is exact, I speculate this is a 'flat' binary file.
likely written via a fortran direct access or (say) C
as opposed to a binary file written by a fortran sequential write
(fortran's default) which adds an
INTEGER*4 byte count *at the beginning and end of each unformatted**
sequential record*
during an unformatted* sequential WRITE.*

I have tried assorted permutations of the following:

          nlat  = 384
           mlon  = 384

          setfileoption("bin","readbyteorder","littleendian")
         ;setfileoption("bin","readbyteorder","bigendian")
           d1 = fbindirread("./e384tile1.dat",0,(/nlat,mlon/),"float")
           printMinMax(d1,0)
           UNDEF = -999.0
           d1 = where(d1.gt.1e10,UNDEF,d1)
           printMinMax(d1,0)
         ; d1 = fbindirread("./e384tile1.dat",0,(/nlat,mlon/),"integer")

           printVarSummary(d1)
           printMinMax(d1,0)
====
  Nothing makes sense.



On Tue, Mar 16, 2021 at 2:57 AM Debasish Hazra via ncl-talk <
ncl-talk at mailman.ucar.edu> wrote:

> Hello,
> Trying to read binary file and trying to extract lat-lon info for tile
> file (binary file in C384 grid). Used the following to read it :
>            nlat  = 384
>            mlon  = 384
>
>           setfileoption("bin","readbyteorder","littleendian")
>            d1 = fbinrecread("./e384tile1.dat",0,-1,"float")
>
>             printVarSummary(d1)
>            UNDEF = -999.0
>
>            finarr     = onedtond(d1(1:), (/nlat,mlon/))
>            finarr at _FillValue = UNDEF                     ;
>            printVarSummary(finarr)
>           printMinMax(finarr,0)
>
> How to extract lat-lon bounds for that file  ? Any help
> Thanks
> Debasish
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at mailman.ucar.edu
> List instructions, subscriber options, unsubscribe:
> https://mailman.ucar.edu/mailman/listinfo/ncl-talk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20210316/b2c53b37/attachment.html>


More information about the ncl-talk mailing list