[ncl-talk] reading binary file
Dennis Shea
shea at ucar.edu
Fri Jun 19 13:18:19 MDT 2015
First file:
N = 5*720*1440*4=20736000 ; 4 bytes per integer
var1: min=0 max=4.29438 <=== 'good' values
====
2nd fileThe IDL code indicates "double" ( dblarr )
mean_dbdi = dblarr(nlon1,nlat1) <=== double array
mean_dbdi(*,*) = -999.9d <=== _FillValue (initialize)
openr,1,'viirs_meandbdi_gridded_statis'+yrday+'.dat'
readu,1,mean_dbdi <=== read into
pre-allocated space
=====
M8= 720*1440*8 = 8294400 ; double (8 bytes)
===
setfileoption("bin","readbyteorder","bigendian")
var2 :=
cbinread("viirs_meandbdi_gridded_statis2015032.dat",(720,1440/),"double")
var2 at _FillValue = -999d0
If the values are wrong .... don't know what to say. ....
Good luck
On Fri, Jun 19, 2015 at 8:25 AM, Debasish Hazra <debasish.hazra5 at gmail.com>
wrote:
> Thanks Dennis. Only information I got that
> "viirs_meandbdi_gridded_statis2015032.dat" is a mean-dbdi value in a grid
> box (so it is different than the 2013 file I sent, which was not just a
> mean in grid box).
>
> Also. the text information says to read in IDL like :
>
> lat_resolution=0.25
> lon_resolution=0.25
> nlat1=fix(180.0/lat_resolution)
> nlon1=fix(360.0/lon_resolution)
> latt=fltarr(nlat1+1)
> lonn=fltarr(nlon1+1)
> print, nlat1,nlon1
>
> for i=0,nlat1 do begin
> latt(i)=-90+i*lat_resolution
> endfor
> for i=0,nlon1 do begin
> lonn(i)=-180+i*lon_resolution
> endfor
>
> mean_dbdi=dblarr(nlon1,nlat1)
> mean_dbdi(*,*)=-999.9d
>
> openr,1,'viirs_meandbdi_gridded_statis'+yrday+'.dat'
> readu,1,mean_dbdi
> close,1
>
> Any suggestion/help on this.
>
> Thanks,
> Debasish
>
>
>
> On Fri, Jun 19, 2015 at 9:14 AM, Dennis Shea <shea at ucar.edu> wrote:
>
>> The files you sent re two different sizes (bytes):
>>
>> 20736000 Jun 19 06:55 viirs_dbdi_gridded_statis2013212.dat
>> 8294400 Jun 19 06:55 viirs_meandbdi_gridded_statis2015032.dat
>>
>> Your read code:
>>
>> setfileoption("bin","readbyteorder","bigendian")
>> var1 = 1e-9 *
>> tofloat(cbinread("./Feb/viirs_meandbdi_gridded_statis2015032.dat",(/5,720,1440/),"uint"))
>> var2 = 1e-9 *
>> tofloat(cbinread("./Jul/viirs_dbdi_gridded_statis2013212.dat",(/5,720,1440/),"uint"))
>>
>> indicates the two files should be the same sizes
>>
>> N = 5*720*1440*4 ; 4 bytes per integer
>>
>> N = 20736000
>>
>> So something is wrong with the viirs_meandbdi_gridded_statis2015032.dat
>> file
>>
>>
>>
>>
>> On Thu, Jun 18, 2015 at 2:28 PM, Debasish Hazra <
>> debasish.hazra5 at gmail.com> wrote:
>>
>>> Hi,
>>>
>>> I need some help reading binary files with ncl (version 6.3). I have
>>> attached the code and the resulting plot from the files. Print statement
>>> shows minimum and maximum value for the first file (1st feb, 2015) , but in
>>> the resulting figure field it is completely empty without showing any error
>>> message. Let me know how to resolve this.
>>>
>>> Both files (gridded_statis2013212.dat and gridded_statis2015032.dat)
>>> are uploaded in the ftp.
>>>
>>> Thanks and regards,
>>> 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/20150619/adcebc28/attachment.html
More information about the ncl-talk
mailing list