Dec-10-2018, 12:55 PM
Dear all, I have two dataset, both of which contains precipitation rate. However, one of the dataset (ldasin) requires computation in order to get the hourly precipitation rate and plot them. Basically, it needs to be computed in this manner: ldasin.RAINC(time=time) + (time=time) ldasin.RAINNC - ldasin.RAINC (time=time-1) - ldasin.RAINNC(time=time-1). Afterwards, it can the be used in the ldasin_avg in order to get the mean. I've only ever tried the formula in GRADS and it worked since I can just directly input the timestep.
Thank you!
Below is the code that I used.
Thank you!
Below is the code that I used.
%matplotlib inline import xarray as xr import matplotlib.pyplot as plt import pandas as pd import numpy as np ldasin = xr.open_mfdataset('/home/ES403/MODEL/WRF-HYDRO/TEMPLATE/FORCING/*wrfout*', concat_dim='Time') supp_precip = xr.open_mfdataset('/home/ES403/MODEL/WRF-HYDRO/TEMPLATE/FORCING/*PRECIP*', concat_dim='Time') ldasin_avg = ldasin.RAINRATE.mean(dim=('south_north','west_east'))*3600 supp_avg = supp_precip.precip_rate.mean(dim=('south_north','west_east'))*3600 fig, axes = plt.subplots(ncols=1,figsize=(12, 6)) plt.suptitle('Hyetograph of the WRF and supplied precipitation',fontsize=24) ldasin_avg.plot(label='WRF', color='black', linestyle='-') supp_avg.plot(label='GSMaP', color='blue', linestyle='-') plt.legend() plt.show()