[ncl-talk] binary file read

Mary Haley haley at ucar.edu
Wed Mar 29 15:28:14 MDT 2017


Hi Debasish,

Kevin and I took a look at this. For starters, there *is* an error message
coming out of your script:

warning:cbinread: The size implied by the dimension arrays is greater that
the size of the file.
 The default _FillValue for the specified type will be filled in.
 Note dimensions and values may not be aligned properly

If you look at the size of the file, it doesn't match with the dimensions
you're requesting:

Size of file = 8294400 bytes

Size of dimensions = 5 * 720 * 1440 * 4 (for a uint) = 20736000

If this is truly a C binary file, it looks like it only has 2 * 720 * 1440
* 4 bytes.

This doesn't really change the results, however, because you still get two
strange looking plots.

We tried several different things:

1) reading the data as ubyte, int, and ushort
2) reversing the array to 1440 x 720 x 2
3) reading the data as little endian
4) plotting the data as a simple contour plot to take out the map component.

Nothing we did produced more information about the file, or produced better
plots.

Is there some documentation on this file to understand how it was written?
For example, are you sure the "uint" type is correct? Are you sure the
dimension sizes are correct? Why are the values so large? Is it possible
that this is "packed" data, and that you need to use a function like
dim_gbits to pick off individual bits of information?

If you can find a C or Fortran code that was used to create this file, then
it should be fairly straightforward to figure out how to read it.

--Mary






On Wed, Mar 29, 2017 at 2:18 PM, Debasish Hazra <debasish.hazra5 at gmail.com>
wrote:

> Hi,
>
> I am trying to read a binary file with the attached code, but  getting all
> empty fields in the figure with no apparent error message. Uploaded  the
> data file in the ftp server "viirs_meandbdi_gridded_statis2015048.dat".
> Any help with this is appreciated.
>
> Thanks.
> Debasish
>
> On Wed, Mar 22, 2017 at 10:33 AM, Debasish Hazra <
> debasish.hazra5 at gmail.com> wrote:
>
>> Hi,
>>
>> I am trying to read a binary file with the attached code, but  getting
>> all empty fields in the figure with no apparent error message. Uploaded
>>  the data file in the ftp server "viirs_meandbdi_gridded_statis2015002.dat".
>> Any help with this is appreciated.
>>
>> Thanks.
>> Debasish.
>>
>>
>>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170329/e1e01dda/attachment.html 


More information about the ncl-talk mailing list