[ncl-talk] binary file read

Debasish Hazra debasish.hazra5 at gmail.com
Wed Mar 29 17:03:08 MDT 2017


Thanks Mary for looking in to it. I have find only one IDL file that read
that data set and it is attahced.

Debasish.

On Wed, Mar 29, 2017 at 5:28 PM, Mary Haley <haley at ucar.edu> wrote:

> 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/08e3f53d/attachment.html 
-------------- next part --------------
pro read_data
lat_resolution=0.25
lon_resolution=0.25
nlat=fix(180.0/lat_resolution)
nlon=fix(360.0/lon_resolution)
lat=fltarr(nlon+1,nlat+1)
lon=fltarr(nlon+1,nlat+1)
;print, nlat,nlon

for i=0,nlon do begin
   for j=0,nlat do begin
  lat(i,j)=-90+j*lat_resolution
  lon(i,j)=-180+i*lon_resolution
   endfor
endfor
for i=23, 25 do begin
day=string(i,format='(I3.3)')
   fdata=read_binary('viirs_meandbdi_gridded_statis2013'+day+'.dat',data_type=5,data_dims=[1440,720])
; idx is the index of the grid has dust 
   idx=where(fdata ge 0.0,n)
   print, n
   print, fdata(idx)
;print, fdata
endfor
end


More information about the ncl-talk mailing list