[ncl-talk] Taking ratio of precipitation dataset

amit timilsina timilsinaamit87 at huskers.unl.edu
Tue Jan 5 16:10:17 MST 2016


Respected all,

I would like to take ratio and differences of variable precipitation(pr) in such way that if both the values for particular day is positive or greater than zero, I want to take ratio. If one of the values, either denominator or numerator, is zero, then I would like to take differences. Here is my code:
ncl 0> a=addfile("pr_day_MRI-CGCM3_decadal2005_r1i1p1_20060101-20351231.nc","r")
ncl 1> b=a->pr
ncl 2> c=addfile("pr_day_MRI-CGCM3_rcp45_r1i1p1_20060101-20351231.nc","r")
ncl 3> d=a->pr
ncl 4> if (any(b(:,:,:).eq.0)) .or. (any(d(:,:,:).eq.0)) then 
ncl 5> output = (d-b)                                         
ncl 6> else                                                   
ncl 7> ouput = d/b                                            
ncl 8> end if 

This output gives me only differences, not a combination of both. Is it possible to put any flag to know whether we have considered differences or ratio at each grid level? I have attached printVarSummary for further information.

Thank you in advance



Amit Prasad Timilsina
PhD student
School of Natural Resources,UNL
-------------- next part --------------
A non-text attachment was scrubbed...
Name: printVarSummary.docx
Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document
Size: 106998 bytes
Desc: printVarSummary.docx
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160105/8ea35f46/attachment.bin 


More information about the ncl-talk mailing list