[ncl-talk] lat lon info in binary file

Dave Allured - NOAA Affiliate dave.allured at noaa.gov
Tue Mar 16 09:42:46 MDT 2021


Debasish, this C384 binary grid format does not include its own lat/lon
info.  You need to go back to the data source, and either (1) find
supplemental files that contain the lat and lon coordinates, or (2) read
the source documentation for the method of computing the coordinates.

Method (1) is best for your purposes.  It is worth asking the data
publisher to provide coordinate files, if they have not already done so.
Method (2) is possible, but complicated and error prone.


On Tue, Mar 16, 2021 at 8:15 AM Dennis Shea via ncl-talk <
ncl-talk at mailman.ucar.edu> wrote:

> 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
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20210316/2d44a7af/attachment.html>


More information about the ncl-talk mailing list