def compute_RLB(varobj, onc, wnfiles, wntimes, options): incvar = wnfiles.current.variables["ACLWUPB"] aclwupb = incvar deac_aclwupb = deaccumulate_var(aclwupb, "ACLWUPB", wnfiles, wntimes) aclwdnb = wnfiles.current.variables["ACLWDNB"] deac_aclwdnb = deaccumulate_var(aclwdnb, "ACLWDNB", wnfiles, wntimes) copyval = (deac_aclwupb - deac_aclwdnb) / float(wntimes.outstep_s) oncvar = get_oncvar(varobj, incvar, onc, options) return oncvar, copyval
def compute_RST(varobj, onc, wnfiles, wntimes, options): incvar = wnfiles.current.variables["ACSWUPT"] acswupt = incvar[:] deac_acswupt = deaccumulate_var(acswupt, "ACSWUPT", wnfiles, wntimes) acswdnt = wnfiles.current.variables["ACSWDNT"][:] deac_acswdnt = deaccumulate_var(acswdnt, "ACSWDNT", wnfiles, wntimes) rst = deac_acswdnt - deac_acswupt copyval = rst / float(wntimes.outstep_s) oncvar = get_oncvar(varobj, incvar, onc, options) return oncvar, copyval
def compute_RAIN(varobj, onc, wnfiles, wntimes, options): """Deaccumulates the precipitation field This function adds RAINNC and RAINC, RAINTOT has been deprecated since it does not support buckets. It deaccumulates from the value on the previous output time step. """ incvar = wnfiles.current.variables["RAINNC"] rainnc = incvar[:] rainc = wnfiles.current.variables["RAINC"][:] deac_rainnc = deaccumulate_var(rainnc, "RAINNC", wnfiles, wntimes) deac_rainc = deaccumulate_var(rainc, "RAINC", wnfiles, wntimes) copyval = deac_rainnc + deac_rainc oncvar = get_oncvar(varobj, incvar, onc, options) return oncvar, copyval
def compute_RLT(varobj, onc, wnfiles, wntimes, options): incvar = wnfiles.current.variables["OLR"] olr = incvar aclwdnt = wnfiles.current.variables["ACLWDNT"] deac_aclwdnt = deaccumulate_var(aclwdnt, "ACLWDNT", wnfiles, wntimes) copyval = (olr - deac_aclwdnt) / float(wntimes.outstep_s) oncvar = get_oncvar(varobj, incvar, onc, options) return oncvar, copyval
def compute_MRRO(varobj, onc, wnfiles, wntimes, options): """Deaccumulates the total runoff field This function adds SFROFF and UDROFF. It deaccumulates from the value on the previous output time step. The flux is computed dividing by the time interval in seconds. """ incvar = wnfiles.current.variables["SFROFF"] sfroff = incvar[:] udroff = wnfiles.current.variables["UDROFF"][:] deac_sfroff = deaccumulate_var(sfroff, "SFROFF", wnfiles, wntimes, options) deac_udroff = deaccumulate_var(udroff, "UDROFF", wnfiles, wntimes, options) copyval = deac_sfroff + deac_udroff #copyval = np.where(copyval<0., 0, copyval)/float(wntimes.outstep_s) copyval = copyval / float(wntimes.outstep_s) oncvar = get_oncvar(varobj, incvar, onc, options) return oncvar, copyval
def compute_RAINF(varobj, onc, wnfiles, wntimes, options): """Deaccumulates the precipitation field This function adds RAINNC and RAINC, support for RAINTOT has been deprecated since it does not support buckets. It deaccumulates from the value on the previous output time step. The flux is computed dividing by the time interval in seconds. """ incvar = wnfiles.current.variables["RAINNC"] rainnc = incvar[:] rainc = wnfiles.current.variables["RAINC"][:] deac_rainnc = deaccumulate_var(rainnc, "RAINNC", wnfiles, wntimes, options) deac_rainc = deaccumulate_var(rainc, "RAINC", wnfiles, wntimes, options) copyval = deac_rainnc + deac_rainc #copyval = np.where(copyval<0., 0, copyval)/float(wntimes.outstep_s) copyval = copyval / float(wntimes.outstep_s) oncvar = get_oncvar(varobj, incvar, onc, options) return oncvar, copyval
def compute_ACRLS(varobj, onc, wnfiles, wntimes, options): incvar = wnfiles.current.variables["ACLWUPB"] aclwupb = incvar[:] deac_aclwupb = deaccumulate_var(aclwupb, "ACLWUPB", wnfiles, wntimes) # # If there is not ACLWDNB in the file it deaccumulates just ACLWUPB and the uses GLW to compute ACRLS. # if wnfiles.current.variables.has_key("ACLWDNB"): aclwdnb = wnfiles.current.variables["ACLWDNB"][:] deac_aclwdnb = deaccumulate_var(aclwdnb, "ACLWDNB", wnfiles, wntimes) deac_rlt = deac_aclwdnb - deac_aclwupb copyval = deac_rlt / float(wntimes.outstep_s) else: glw = wnfiles.current.variables["GLW"][:] if not wnfiles.prv: glw[0] = 0 #If there is not previous file makes 0 the first glw, so the substraction below is also 0. copyval = (glw - deac_aclwupb) / float(wntimes.outstep_s) oncvar = get_oncvar(varobj, incvar, onc, options) return oncvar, copyval