[ncl-talk] CMORPH Rainfall
Dennis Shea
shea at ucar.edu
Mon Dec 21 07:33:02 MST 2015
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
>
More information about the ncl-talk
mailing list