[ncl-talk] CMORPH Rainfall
Geeta Geeta
geetag54 at yahoo.com
Mon Dec 21 10:33:57 MST 2015
Thanks Rick and Dennis for your help..
So the Rf values are now being wriiten properly. how to see the 1st and 2nd records.
nlat = 1649
nlon = 4948;--------------------------------------------------
lat = 59.963614 + ispan(0,nlat-1,1)*0.072771377 lat!0 = "latitude" lat at units = "degrees_north" printVarSummary(lat)
lon = 0.036378335 + ispan(0,nlon-1,1)*0.072756669 lon!0 = "longitude" lon at units = "degrees_east" printVarSummary(lon)
; Reading File-----------------rf = fbindirread("test.bin",0,(/nlat,nlon/),"ubyte"); res1 = fbindirread("test.bin",1,-1,"float") asciiwrite("rf.txt",rf); print(res1) printVarSummary(rf)
;rf at _FillValue= 255
cmorrf = where(rf.eq.255,255,rf*0.2) asciiwrite("crf.txt",cmorrf) cmorrf at _FillValue = 255 cmorrf at units = "mm" printVarSummary(cmorrf)
This doc mentions that there are 6 records. ;; Each file contains 6 records. The 1st 3 records pertain to the top half;; of the hour (00-29 minus after the hour) and the last 3 records are for the
;; bottom half of the hour. Within each group:
;;
;; - the 1st record contains the CMORPH precipitation estimates
;;
;; - the 2nd record contains the time (in half hour units) since the most
;; recent microwave pass. Note that since we do both a forward &
;; backward interpolation in time, the nearest time may be prior to
;; the file time stamp or after it.
;;
;; - the 3rd record contains an ID that tells the satellite from which the last
;; microwave observation was made which can be interpretted by the following
;; table (as of the time of the last update of this documentation):
;;
How should I see the rest of them??
On Monday, 21 December 2015 8:03 PM, Dennis Shea <shea at ucar.edu> wrote:
Also ... *you* must read the documentation carefully. The documentation states:
"Each direct access record is a 4948 x 1649 CHARACTER*1"
[1]
You are using 'fbinrecread' which is for fortran sequential records.
You should use 'fbindirread' which is for direct access records.
[2]
Ypu have 'lat' going from South-to-North. The documentation states the
data are N->S.
[3]
Since the max byte is 255, I think unsigned byte type should be used.
http://www.ncl.ucar.edu/Applications/
Under 'Datasets' ... Click 'High Res Precipitation'
Minor modifications to existing CMORPH examples resulted in cmorph_4.ncl
On Mon, Dec 21, 2015 at 6:46 AM, Rick Brownrigg <brownrig at ucar.edu> wrote:
> Hi,
>
> According to the docs at:
>
> ftp://ftp.cpc.ncep.noaa.gov/precip/global_CMORPH/README.cmorph.8km_30minute
>
> 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!):
>
> cmorrf_ubytes = fbinrecread("test.bin",0,(/nlat,nlon/),"ubyte")
>
> cmorrf_ubytes at _FillValue = 255B
>
> cmorrf = cmorrf_ubytes * 0.2 ; convert to floats, units are mm/hr
>
>
> As a side note, since its byte data, the setfileoption(...) is superfluous.
>
> Hope that helps..
>
> Rick
>
>
> On Sun, Dec 20, 2015 at 4:39 AM, Geeta Geeta <geetag54 at yahoo.com> wrote:
>>
>> I have to plot 8km_30minutes resolution CMORPH rainfall.
>> The data is binary format. and has 24 files of each hour.
>>
>> -rw-r--r-- 1 aditya aditya 48955512 Dec 1 19:33
>> CMORPH_8KM-30MIN_2015113021
>> -rw-r--r-- 1 aditya aditya 48955512 Dec 1 19:33
>> CMORPH_8KM-30MIN_2015113022
>> -rw-r--r-- 1 aditya aditya 48955512 Dec 1 19:33
>> CMORPH_8KM-30MIN_2015113023
>>
>> As per the documentation of this data from
>> (ftp://ftp.cpc.ncep.noaa.gov/precip/global_CMORPH/CMORPH_8km-30-minute.ctl)
>>
>> 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
>>
>> there are 3 records, 1st record being the desired parameter.
>> (ftp://ftp.cpc.ncep.noaa.gov/precip/global_CMORPH/README.cmorph.8km_30minute).
>>
>> I have to plot each hourly file and then get 24 hrs rainfall for a day.
>>
>> ;;;;;;;Code;
>>
>> 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.
>>
>>
>> cmorrf = fbinrecread("test.bin",0,-1,"float") ; print 0th record.
>>
>> print("Sizeof rf ="+dimsizes(cmorrf))
>> ; print(cmorrf)
>> asciiwrite("rf.txt",cmorrf)
>>
>> When I run this,
>>
>> See http://www.ncl.ucar.edu/ for more details.
>> (0) False
>> warning:fbinrecread: size specified is greater than record size, filling
>> with missing values
>> (0) Sizeof rf =1649
>> (1) Sizeof rf =4948
>>
>> when I use -1 in line defining cmorphh, I get this output.
>>
>> aditya at agniilap:~/geeta/ncl/CMORPH$ See http://www.ncl.ucar.edu/ for more
>> details.
>> (0) False
>> (0) Sizeof rf =0
>>
>>
>> no rainfall is written to the file.
>> Also the 1st and 2nd records are not being shown.
>>
>> Pls suggest.
>>
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>
>
> _______________________________________________
> 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/20151221/06150ede/attachment.html
More information about the ncl-talk
mailing list