[ncl-talk] Calculating monthly number of precipitation days using daily data from netCDF file

Dennis Shea shea at ucar.edu
Sun Nov 8 20:26:38 MST 2015


It should work, if you change 't1' to 'm' in the last line

Change
  xMon = calculate_monthly_values(t1, "sum", 0, False)
To
xMon = calculate_monthly_values(m, "sum", 0, False)

Then
 printVaarSummary(xMon)
 printMinMax(xMon, 0)

On Sat, Nov 7, 2015 at 11:05 AM, amit timilsina
<timilsinaamit87 at huskers.unl.edu> wrote:
>
> Hello all,
> I have precipitation data in netCDF file. I intended to calculate the number of precipitation days per month over 30 years period considering days with precipitation more than 0.001 mm. I used following syntax:
>
> a1 =addfile("pr_day_MIROC5_rcp85_r2i1p1_20100101-20191231.nc","r") ; reading file
> b1 = a1->pr
> x1 = b1*86400    ; converting kg/m-2/s to mm/day
> m = where(x1.ge. 0.001, 1, 0)       ; replacing pr value with 1 if prcipitation values is > 0.001 mm per day otherwise with 0
> copy_VarCoords(b1,m)                 ; copying metadata
> xMon = calculate_monthly_values(t1, "sum", 0, False)            ; caculating sum of days
> warning:tofloat: A bad value was passed to (string) tofloat, input strings must contain numeric digits, replacing with missing value
>
> Are there any other ways I could follow to calculate numbers of precipitation day? If not, what could be the best way to solve the above problem.
>
> Thank you in advance.
>
>
> Regards,
> Amit Prasad Timilsina
> University of Nebraska-Lincoln
>
> _______________________________________________
> 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