Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion e3sm_diags/derivations/derivations.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
pminuse_convert_units,
precst,
prect,
prect_frac,
qflx_convert_to_lhflx,
qflx_convert_to_lhflx_approxi,
qflxconvert_units,
Expand Down Expand Up @@ -117,6 +118,16 @@
rename(prw), target_units="kg/m2"
), # EAMxx
},
"PRECC": {
("PRECC",): lambda pr: convert_units(pr, target_units="mm/day"),
("prc",): rename,
},
"PRECL": {
("PRECL",): lambda pr: convert_units(rename(pr), target_units="mm/day"),
},
"PRECC_Frac": {
("PRECC", "PRECL"): lambda precc, precl: prect_frac(precc, precl),
},
# Sea Surface Temperature: Degrees C
# Temperature of the water, not the air. Ignore land.
"SST": OrderedDict(
Expand Down Expand Up @@ -734,7 +745,6 @@
("huss",): lambda q: convert_units(q, target_units="g/kg"),
("d2m", "sp"): qsat,
},
"PRECC": {("prc",): rename},
"TAUX": {
("tauu",): lambda tauu: -tauu,
("surf_mom_flux_U",): lambda tauu: -tauu, # EAMxx
Expand Down
11 changes: 11 additions & 0 deletions e3sm_diags/derivations/formulas.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,17 @@ def prect(precc: xr.DataArray, precl: xr.DataArray):
return var


def prect_frac(precc: xr.DataArray, precl: xr.DataArray):
"""convective precipitation fraction = convective /(convective + large-scale)"""
with xr.set_options(keep_attrs=True):
var = precc / (precc + precl) * 100.0

var.attrs["units"] = "%"
var.attrs["long_name"] = "convective precipitation fraction"

return var


def precst(precc: xr.DataArray, precl: xr.DataArray):
"""Total precipitation flux = convective + large-scale"""
with xr.set_options(keep_attrs=True):
Expand Down
Loading