<html><head><meta http-equiv="content-type" content="text/html; charset=us-ascii"><style>body { line-height: 1.5; }body { font-size: 10.5pt; font-family: ??; color: rgb(0, 0, 0); line-height: 1.5; }</style></head><body>
<table width="99.99%" height="100%" style="padding: 10px; background-color: transparent;" border="0" cellpadding="0" cellspacing="0" background="cid:_Foxmail.1@030e346b-08f2-7057-27e4-73f9d039be65">
<tbody><tr>
<td valign="top" style="width:100%;height:100%;">
<div style="">
<div><span style="font-size: 16px; background-color: rgba(0, 0, 0, 0);">i have one trmm data file, whose file has seven blocks(2880-byte header and six variables with the same dimension 1440*720),as follows:
<br>
<br>block byte_count integer_byte
<br>1 2880 2
<br>2 2073600 2
<br>3 2073600 1
<br>4 1036800 1
<br>5 1036800 1
<br>6 1036800 1
<br>7 1036800 1
<br>+++++++++++++++++++++++++++++++++++++++
<br>i have a test using ncl prompt,as follows:
<br>
<br>ncl 0> nlat=720
<br>ncl 1> nlon=1440
<br>ncl 2> filn="3B40RT.2001012212.7R2.bin"
<br>ncl 3> ncha=2880
<br>ncl 4> dims=(/nlon,nlat/)
<br>ncl 5> nbyt=nlon*nlat
<br>ncl 6> setfileoption("bin","ReadByteOrder","BigEndian")
<br>ncl 7> ff=fbindirread(filn,0,-1,"byte")
<br>ncl 8> printVarSummary(ff)
<br>
<br>Variable: ff
<br>Type: byte
<br>Total Size: 8297280 bytes
<br> 8297280 values
<br>Number of Dimensions: 1
<br>Dimensions and sizes: [8297280]
<br>Coordinates:
<br>
<br>+++++++++++++++++++++++++++++++++++++
<br>there is 8297280 bytes in file.
<br>
<br>
<br>
<br>
<br>but when i want to extract the six variable with ncl script,the below is my ncl code:
<br>++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
<br>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
<br>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
<br>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
<br>
<br>begin
<br> nlat=720
<br> nlon=1440
<br> filn="3B40RT.2001012212.7R2.bin"
<br> ncha=2880
<br> dims=(/nlon,nlat/)
<br> nbyt=nlon*nlat
<br> setfileoption("bin","ReadByteOrder","BigEndian")
<br> ff=fbindirread(filn,0,-1,"byte")
<br> ffhead=ff(0:ncha-1)
<br>
<br> pr=new(dims,"float")
<br> pr@_FillValue=-31999
<br>
<br> pe=new(dims,"float")
<br> pe@_FillValue=-31999
<br>
<br> tp=new(dims,"float")
<br> tp@_FillValue=-31999
<br>
<br> ap=new(dims,"float")
<br> ap@_FillValue=-31999
<br>
<br> rp=new(dims,"float")
<br> rp@_FillValue=-31999
<br>
<br> sr=new(dims,"float")
<br> sr@_FillValue=-31999
<br>
<br>
<br> pr=byte2flt(onedtond(ff(ncha:ncha+nbyt*2-1),dims))
<br> pe=byte2flt(onedtond(ff(ncha+nbyt*2:ncha+nbyt*4-1),dims))
<br> tp=byte2flt(onedtond(ff(ncha+nbyt*4:ncha+nbyt*5-1),dims))
<br> ap=byte2flt(onedtond(ff(ncha+nbyt*5:ncha+nbyt*6-1),dims))
<br> rp=byte2flt(onedtond(ff(ncha+nbyt*6:ncha+nbyt*7-1),dims))
<br> sr=byte2flt(onedtond(ff(ncha+nbyt*7:ncha+nbyt*8-1),dims))
<br>
<br>end
<br>
<br>+++++++++++++++++++++++++++++++++++++++++++++++++++++++
<br>
<br>there come to two warnings:
<br>warning:onedtond : output dimension sizes have fewer elements than input, some data not copied
<br>warning:onedtond : output dimension sizes have fewer elements than input, some data not copied
<br>
<br><font color="#0000ff"><b>what i'm confused is the "rec_num" set in function fbindirread, is it a byte position or integer position?</b></font> <br></span></div>
<div><br></div><hr style="width: 210px; height: 1px;" color="#b5c4df" size="1" align="left">
<div><span><div style="FONT-FAMILY: verdana; FONT-SIZE: 10pt">
<div>dyjbean@gmail.com</div></div></span></div>
<div></div></div>
</td>
</tr>
</tbody></table>
</body></html>