[ncl-talk] binary file

Rick Brownrigg brownrig at ucar.edu
Fri Oct 9 12:33:38 MDT 2020


Well I don't think you want to read it as double, particularly not if you
are certain the dimensions are 384x384. I'm wondering if you can safely
ignore that last 8 bytes (and ignore the warning).  A quick plot would
reveal whether the data seem reasonable or definitely misaligned.

RB

On Fri, Oct 9, 2020 at 12:14 PM Debasish Hazra <debasish.hazra5 at gmail.com>
wrote:

> Thanks Rick.Should I read it as double?
>
> On Fri, Oct 9, 2020 at 1:39 PM Rick Brownrigg <brownrig at ucar.edu> wrote:
>
>> Well, the math works out: 4x384x384=589824.  Further, the last 8 bytes of
>> that file do not look like valid floating point values. They are:
>>
>>  00 00 00 00 00 00 09 00
>>
>> Do you have reason to believe the data is not being read correctly, or
>> are you mostly concerned about the warning message?
>>
>> BTW - the data are mostly zeros.
>>
>> Rick
>>
>>
>> On Fri, Oct 9, 2020 at 11:09 AM Debasish Hazra via ncl-talk <
>> ncl-talk at mailman.ucar.edu> wrote:
>>
>>> Hi,
>>> I am trying to read binary file (attached in the email) through NCL and
>>> file size is 589832 bytes. I am reading it as float but it coming out to be
>>> 589824. I am not sure what needs to be done to read it.
>>>
>>>  setfileoption("bin","readbyteorder","littleendian")
>>>  d1 = cbinread("./Test/modelout.dat",(/4,384,384/),"float")
>>>
>>> warning:cbinread: The size implied by the dimension arrays is less that
>>> the size of the file.
>>>  Only the first 589824 contiguous bytes of the file will be read in.
>>> Note dimensions and values may not be aligned properly
>>>
>>> Any help on this is appreciated.
>>> 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/20201009/aca40861/attachment.html>


More information about the ncl-talk mailing list