I am trying to compute the 99th centile precipt for all matching month-days across multiple years. For example, what is the 99th centile max precipt for all five Jan 1st’s from 1984-1989? Likewise of all five Jan 2nds…Dec 31st
The precipt data are stored as an NETCDF from 1984 to 1989 on hourly timestep that gets filtered to the 00 timestamp which represents total daily precipt. The example NETCDF is over Australia with legit values over land and NANs over water. It has three dimensions: lat, lon, and time.
The code fails when attempting to run a groupgy to compute the 99th centile precipt. This error message continually loops “RuntimeWarning: All-NaN slice encountered”.
Any advice/ for more efficent approach to compuing this metric is appreciated. The real data are global and cover dozens of years. Worried GroupBy will choke at scale. The resulting 99th precipt for each lat/lon should be stored as an array to use in subsquent calcs.
code follows
#open file w xarray
ds = xr.open_dataset(r'...hourly_precipt.nc')
#select the timestep representing total precipt
tp_00 = ds['tp'].sel(valid_time=ds['valid_time'].dt.hour == 0)
#create new monthday coordinate
tp_daily['monthday'] = tp_daily['valid_time'].dt.strftime('%m-%d')
#Find 90th percentile for each monthday
Per90 = tp_daily.groupby('monthday').quantile(0.9)
Map
File Description
Error Message
Dav0999 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.