Skip to content

Commit

Permalink
Support monthly average and variable name convention for EAMxx (#712)
Browse files Browse the repository at this point in the history
* support monthly average in viewer

* add 12 monthly mean to core sets as options

* Initial modifications for EAMxx variable names

* add monthly mean option for aerosol budget tables

* update SCREAM variable convention

* more update for supporting monthly data

---------

Co-authored-by: Chris Golaz <[email protected]>
  • Loading branch information
chengzhuzhang and golaz authored Feb 8, 2024
1 parent 10b16f8 commit 3061cec
Show file tree
Hide file tree
Showing 20 changed files with 576 additions and 454 deletions.
99 changes: 92 additions & 7 deletions e3sm_diags/derivations/acme.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,13 @@ def restom(fsnt, flnt):
return var


def restom3(swdn, swup, lwup):
"""TOM(top of model) Radiative flux"""
var = swdn - swup - lwup
var.long_name = "TOM(top of model) Radiative flux"
return var


def restoa(fsnt, flnt):
"""TOA(top of atmosphere) Radiative flux"""
var = fsnt - flnt
Expand Down Expand Up @@ -619,6 +626,10 @@ def cosp_histogram_standardize(cld: "FileVariable"):
(("pr",), lambda pr: qflxconvert_units(rename(pr))),
(("PRECC", "PRECL"), lambda precc, precl: prect(precc, precl)),
(("sat_gauge_precip",), rename),
(
("PrecipLiqSurfMassFlux", "PrecipIceSurfMassFlux"),
lambda precl, preci: prect(precl, preci),
), # EAMxx
]
),
"PRECST": OrderedDict(
Expand Down Expand Up @@ -654,9 +665,18 @@ def cosp_histogram_standardize(cld: "FileVariable"):
("prw",),
lambda prw: convert_units(rename(prw), target_units="kg/m2"),
),
(
("VapWaterPath",), # EAMxx
lambda prw: convert_units(rename(prw), target_units="kg/m2"),
),
]
),
"SOLIN": OrderedDict(
[
(("rsdt",), rename),
(("SW_flux_dn_at_model_top",), rename), # EAMxx
]
),
"SOLIN": OrderedDict([(("rsdt",), rename)]),
"ALBEDO": OrderedDict(
[
(("ALBEDO",), rename),
Expand Down Expand Up @@ -705,6 +725,10 @@ def cosp_histogram_standardize(cld: "FileVariable"):
lambda fsntoa, fsntoac: swcf(fsntoa, fsntoac),
),
(("rsut", "rsutcs"), lambda rsutcs, rsut: swcf(rsut, rsutcs)),
(
("SW_flux_up_at_model_top", "SW_clrsky_flux_up_at_model_top"),
lambda rsutcs, rsut: swcf(rsut, rsutcs),
), # EAMxx
]
),
"SWCFSRF": OrderedDict(
Expand Down Expand Up @@ -913,29 +937,55 @@ def cosp_histogram_standardize(cld: "FileVariable"):
),
]
),
"FLUT": OrderedDict([(("rlut",), rename)]),
"FLUT": OrderedDict(
[
(("rlut",), rename),
(("LW_flux_up_at_model_top",), rename), # EAMxx
]
),
"FSUTOA": OrderedDict([(("rsut",), rename)]),
"FSUTOAC": OrderedDict([(("rsutcs",), rename)]),
"FLNT": OrderedDict([(("FLNT",), rename)]),
"FLUTC": OrderedDict([(("rlutcs",), rename)]),
"FLUTC": OrderedDict(
[
(("rlutcs",), rename),
(("LW_clrsky_flux_up_at_model_top",), rename), # EAMxx
]
),
"FSNTOA": OrderedDict(
[
(("FSNTOA",), rename),
(("rsdt", "rsut"), lambda rsdt, rsut: rst(rsdt, rsut)),
(
("SW_flux_dn_at_model_top", "SW_flux_up_at_model_top"),
lambda rsdt, rsut: rst(rsdt, rsut),
), # EAMxx
]
),
"FSNTOAC": OrderedDict(
[
# Note: CERES_EBAF data in amwg obs sets misspells "units" as "lunits"
(("FSNTOAC",), rename),
(("rsdt", "rsutcs"), lambda rsdt, rsutcs: rstcs(rsdt, rsutcs)),
(
("SW_flux_dn_at_model_top", "SW_clrsky_flux_up_at_model_top"),
lambda rsdt, rsutcs: rstcs(rsdt, rsutcs),
), # EAMxx
]
),
"RESTOM": OrderedDict(
[
(("RESTOA",), rename),
(("toa_net_all_mon",), rename),
(("FSNT", "FLNT"), lambda fsnt, flnt: restom(fsnt, flnt)),
(
(
"SW_flux_dn_at_model_top",
"SW_flux_up_at_model_top",
"LW_flux_up_at_model_top",
),
lambda swdn, swup, lwup: restom3(swdn, swup, lwup),
), # EAMxx
(("rtmt",), rename),
]
),
Expand All @@ -944,6 +994,14 @@ def cosp_histogram_standardize(cld: "FileVariable"):
(("RESTOM",), rename),
(("toa_net_all_mon",), rename),
(("FSNT", "FLNT"), lambda fsnt, flnt: restoa(fsnt, flnt)),
(
(
"SW_flux_dn_at_model_top",
"SW_flux_up_at_model_top",
"LW_flux_up_at_model_top",
),
lambda swdn, swup, lwup: restom3(swdn, swup, lwup),
), # EAMxx
(("rtmt",), rename),
]
),
Expand Down Expand Up @@ -983,6 +1041,10 @@ def cosp_histogram_standardize(cld: "FileVariable"):
[
(("PSL",), lambda psl: convert_units(psl, target_units="mbar")),
(("psl",), lambda psl: convert_units(psl, target_units="mbar")),
(
("SeaLevelPressure",),
lambda psl: convert_units(psl, target_units="mbar"),
), # EAMxx
]
),
"T": OrderedDict(
Expand Down Expand Up @@ -1011,23 +1073,31 @@ def cosp_histogram_standardize(cld: "FileVariable"):
lambda t: convert_units(t, target_units="DegC"),
),
(("tas",), lambda t: convert_units(t, target_units="DegC")),
(("T_2m",), lambda t: convert_units(t, target_units="DegC")), # EAMxx
]
),
# Surface water flux: kg/((m^2)*s)
"QFLX": OrderedDict(
[
(("evspsbl",), rename),
(("QFLX",), lambda qflx: qflxconvert_units(qflx)),
(("surf_evap",), lambda qflx: qflxconvert_units(qflx)), # EAMxx
]
),
# Surface latent heat flux: W/(m^2)
"LHFLX": OrderedDict(
[
(("hfls",), rename),
(("QFLX",), lambda qflx: qflx_convert_to_lhflx_approxi(qflx)),
(("surface_upward_latent_heat_flux",), rename), # EAMxx "s^-3 kg"
]
),
"SHFLX": OrderedDict(
[
(("hfss",), rename),
(("surf_sens_flux",), rename), # EAMxx
]
),
"SHFLX": OrderedDict([(("hfss",), rename)]),
"TGCLDLWP_OCN": OrderedDict(
[
(
Expand Down Expand Up @@ -1454,7 +1524,12 @@ def cosp_histogram_standardize(cld: "FileVariable"):
),
# Surface temperature: Degrees C
# (Temperature of the surface (land/water) itself, not the air)
"TS": OrderedDict([(("ts",), rename)]),
"TS": OrderedDict(
[
(("ts",), rename),
(("surf_radiative_T",), rename), # EAMxx
]
),
"PS": OrderedDict([(("ps",), rename)]),
"U10": OrderedDict([(("sfcWind",), rename), (("si10",), rename)]),
"QREFHT": OrderedDict(
Expand All @@ -1471,8 +1546,18 @@ def cosp_histogram_standardize(cld: "FileVariable"):
]
),
"PRECC": OrderedDict([(("prc",), rename)]),
"TAUX": OrderedDict([(("tauu",), lambda tauu: -tauu)]),
"TAUY": OrderedDict([(("tauv",), lambda tauv: -tauv)]),
"TAUX": OrderedDict(
[
(("tauu",), lambda tauu: -tauu),
(("surf_mom_flux_U",), lambda tauu: -tauu), # EAMxx
]
),
"TAUY": OrderedDict(
[
(("tauv",), lambda tauv: -tauv),
(("surf_mom_flux_V",), lambda tauv: -tauv), # EAMxx
]
),
"CLDICE": OrderedDict([(("cli",), rename)]),
"TGCLDIWP": OrderedDict([(("clivi",), rename)]),
"CLDLIQ": OrderedDict([(("clw",), rename)]),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[#]
sets = ["aerosol_budget"]
variables = ["bc, dst, mom, ncl, pom, so4, soa"]
seasons = ["ANN", "DJF", "MAM", "JJA", "SON"]
seasons = ["ANN", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "DJF", "MAM", "JJA", "SON"]
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[#]
sets = ["aerosol_budget"]
variables = ["bc, dst, mom, ncl, pom, so4, soa"]
seasons = ["ANN", "DJF", "MAM", "JJA", "SON"]
seasons = ["ANN", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "DJF", "MAM", "JJA", "SON"]
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@ case_id = "model_vs_model"
variables = ["COSP_HISTOGRAM_MISR"]
contour_levels = [0,0.5,1.0,1.5,2.0,2.5,3.0,3.5,4.0,4.5,5.0,5.5]
diff_levels = [-3.0,-2.5,-2.0,-1.5,-1.0,-0.5,0,0.5,1.0,1.5,2.0,2.5,3.0]
seasons = ["ANN", "DJF", "MAM", "JJA", "SON"]
seasons = ["ANN", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "DJF", "MAM", "JJA", "SON"]

[#]
sets = ["cosp_histogram"]
case_id = "model_vs_model"
variables = ["COSP_HISTOGRAM_MODIS"]
contour_levels = [0,0.5,1.0,1.5,2.0,2.5,3.0,3.5,4.0,4.5,5.0,5.5]
diff_levels = [-3.0,-2.5,-2.0,-1.5,-1.0,-0.5,0,0.5,1.0,1.5,2.0,2.5,3.0]
seasons = ["ANN", "DJF", "MAM", "JJA", "SON"]
seasons = ["ANN", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "DJF", "MAM", "JJA", "SON"]

[#]
sets = ["cosp_histogram"]
case_id = "model_vs_model"
variables = ["COSP_HISTOGRAM_ISCCP"]
contour_levels = [0,0.5,1.0,1.5,2.0,2.5,3.0,3.5,4.0,4.5,5.0,5.5]
diff_levels = [-3.0,-2.5,-2.0,-1.5,-1.0,-0.5,0,0.5,1.0,1.5,2.0,2.5,3.0]
seasons = ["ANN", "DJF", "MAM", "JJA", "SON"]
seasons = ["ANN", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "DJF", "MAM", "JJA", "SON"]
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ ref_name = "MISRCOSP"
reference_name = "MISR COSP"
contour_levels = [0,0.5,1.0,1.5,2.0,2.5,3.0,3.5,4.0,4.5,5.0,5.5]
diff_levels = [-3.0,-2.5,-2.0,-1.5,-1.0,-0.5,0,0.5,1.0,1.5,2.0,2.5,3.0]
seasons = ["ANN", "DJF", "MAM", "JJA", "SON"]
seasons = ["ANN", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "DJF", "MAM", "JJA", "SON"]

[#]
sets = ["cosp_histogram"]
Expand All @@ -16,7 +16,7 @@ ref_name = "MODISCOSP"
reference_name = "MODIS COSP"
contour_levels = [0,0.5,1.0,1.5,2.0,2.5,3.0,3.5,4.0,4.5,5.0,5.5]
diff_levels = [-3.0,-2.5,-2.0,-1.5,-1.0,-0.5,0,0.5,1.0,1.5,2.0,2.5,3.0]
seasons = ["ANN", "DJF", "MAM", "JJA", "SON"]
seasons = ["ANN", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "DJF", "MAM", "JJA", "SON"]

[#]
sets = ["cosp_histogram"]
Expand All @@ -26,4 +26,4 @@ ref_name = "ISCCPCOSP"
reference_name = "ISCCP COSP"
contour_levels = [0,0.5,1.0,1.5,2.0,2.5,3.0,3.5,4.0,4.5,5.0,5.5]
diff_levels = [-3.0,-2.5,-2.0,-1.5,-1.0,-0.5,0,0.5,1.0,1.5,2.0,2.5,3.0]
seasons = ["ANN", "DJF", "MAM", "JJA", "SON"]
seasons = ["ANN", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "DJF", "MAM", "JJA", "SON"]
Loading

0 comments on commit 3061cec

Please sign in to comment.