<div dir="ltr"><div><div>Hi,<br><br></div>According to the docs at:<br><br><a href="ftp://ftp.cpc.ncep.noaa.gov/precip/global_CMORPH/README.cmorph.8km_30minute">ftp://ftp.cpc.ncep.noaa.gov/precip/global_CMORPH/README.cmorph.8km_30minute</a><br><br></div>the data are given as unsigned bytes, not floats. This would explain the warning about file size. By the comments in the GRADS definition, you multiply the cmorph values by 0.2 to get mm/hr. With that in mind, I *think* you need something like (untested!):<br><br><pre style="word-wrap:break-word">cmorrf_ubytes = fbinrecread("test.bin",0,(/nlat,nlon/),"ubyte")<br></pre><pre style="word-wrap:break-word">cmorrf_ubytes@_FillValue = 255B<br></pre><pre style="word-wrap:break-word">cmorrf = cmorrf_ubytes * 0.2 ; convert to floats, units are mm/hr<br><br><br></pre><pre style="word-wrap:break-word"><span style="font-family:arial,helvetica,sans-serif">As a side note, since its byte data, the setfileoption(...) is superfluous.<br><br></span></pre><pre style="word-wrap:break-word"><span style="font-family:arial,helvetica,sans-serif">Hope that helps..<br></span></pre><pre style="word-wrap:break-word"><span style="font-family:arial,helvetica,sans-serif">Rick</span><br></pre></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Dec 20, 2015 at 4:39 AM, Geeta Geeta <span dir="ltr"><<a href="mailto:geetag54@yahoo.com" target="_blank">geetag54@yahoo.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div style="color:#000;background-color:#fff;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,Sans-Serif;font-size:16px"><div dir="ltr"><span>I have to plot 8km_30minutes resolution CMORPH rainfall. </span></div><div dir="ltr"><span>The data is binary format. and has 24 files of each hour. </span></div><div dir="ltr"><br></div><div dir="ltr"><div dir="ltr">-rw-r--r-- 1 aditya aditya 48955512 Dec 1 19:33 CMORPH_8KM-30MIN_<a href="tel:2015113021" value="+12015113021" target="_blank">2015113021</a><br></div><div dir="ltr">-rw-r--r-- 1 aditya aditya 48955512 Dec 1 19:33 CMORPH_8KM-30MIN_<a href="tel:2015113022" value="+12015113022" target="_blank">2015113022</a></div><div dir="ltr">-rw-r--r-- 1 aditya aditya 48955512 Dec 1 19:33 CMORPH_8KM-30MIN_<a href="tel:2015113023" value="+12015113023" target="_blank">2015113023</a></div><div dir="ltr"><br></div></div><div dir="ltr">As per the documentation of this data from (<a href="ftp://ftp.cpc.ncep.noaa.gov/precip/global_CMORPH/CMORPH_8km-30-minute.ctl" target="_blank">ftp://ftp.cpc.ncep.noaa.gov/precip/global_CMORPH/CMORPH_8km-30-minute.ctl</a>)</div><pre style="word-wrap:break-word">DSET /your-data-set-path/advt-8km-intrp-prim-sat-spat-2lag-2.5+5dovlp8kmIR-%y4%m2%d2%h2
OPTIONS yrev big_endian template
UNDEF 255
TITLE correlation estimates
XDEF 4948 LINEAR 0.036378335 0.072756669
YDEF 1649 LINEAR -59.963614 0.072771377
ZDEF 01 LEVELS 1
TDEF 99999 LINEAR 00z21dec2002 30mn
VARS 3
cmorph 1 -1,40,1,-1 xxxxxx yyyyy (mult. by 0.2 to get mm/hr units)
time 1 -1,40,1,-1 xxxxxx yyyyy
satid 1 -1,40,1,-1 xxxxxx yyyyy
ENDVARS
</pre><pre style="word-wrap:break-word">there are 3 records, 1st record being the desired parameter. (<a href="ftp://ftp.cpc.ncep.noaa.gov/precip/global_CMORPH/README.cmorph.8km_30minute" target="_blank">ftp://ftp.cpc.ncep.noaa.gov/precip/global_CMORPH/README.cmorph.8km_30minute</a>). </pre><pre style="word-wrap:break-word">I have to plot each hourly file and then get 24 hrs rainfall for a day. </pre><pre style="word-wrap:break-word">;;;;;;;Code;</pre><pre style="word-wrap:break-word"> print(isbigendian)
; ----Defining for Once -----
wks = gsn_open_wks("ps","CMO-v1")
gsn_define_colormap(wks,"prcp_2")
nlat = 1649
nlon = 4948
;--------------------------------------------------
lat = -59.963614 + ispan(0,nlat-1,1)*0.072771377
; print(lat)
lon = 0.036378335 + ispan(0,nlon-1,1)*0.072756669
; print(lon)
setfileoption("bin","ReadByteOrder","BigEndian")
; cmorrf = fbinrecread("test.bin",0,(/nlat,nlon/),"float") ; print 0th record. </pre><pre style="word-wrap:break-word"><br></pre><pre style="word-wrap:break-word"><pre style="word-wrap:break-word">cmorrf = fbinrecread("test.bin",0,-1,"float") ; print 0th record.</pre>
print("Sizeof rf ="+dimsizes(cmorrf))
; print(cmorrf)
asciiwrite("rf.txt",cmorrf)
</pre><div dir="ltr">When I run this, </div><div dir="ltr"><br></div><div dir="ltr"><div dir="ltr">See <a href="http://www.ncl.ucar.edu/" target="_blank">http://www.ncl.ucar.edu/</a> for more details.</div><div dir="ltr">(0)<span style="white-space:pre-wrap">        </span>False</div><div dir="ltr">warning:fbinrecread: size specified is greater than record size, filling with missing values</div><div dir="ltr">(0)<span style="white-space:pre-wrap">        </span>Sizeof rf =1649</div><div dir="ltr">(1)<span style="white-space:pre-wrap">        </span>Sizeof rf =4948</div><div dir="ltr"><br></div><div dir="ltr">when I use -1 in line defining cmorphh, I get this output. </div><div dir="ltr"><br></div><div dir="ltr">aditya@agniilap:~/geeta/ncl/CMORPH$ See <a href="http://www.ncl.ucar.edu/" target="_blank">http://www.ncl.ucar.edu/</a> for more details.</div><div dir="ltr">(0)<span style="white-space:pre-wrap">        </span>False</div><div dir="ltr">(0)<span style="white-space:pre-wrap">        </span>Sizeof rf =0</div><div dir="ltr"><br></div><div dir="ltr"><br></div><div dir="ltr">no rainfall is written to the file. <br></div></div><div dir="ltr">Also the 1st and 2nd records are not being shown. </div><div dir="ltr"><br></div><div dir="ltr">Pls suggest. </div></div></div><br>_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>