Skip to content

Commit

Permalink
Merge PR geoschem#216 (add mass accumulation table to benchmark output)
Browse files Browse the repository at this point in the history
This merge brings PR geoschem#216 (by @lizziel) into the GCPy 1.4.0
development stream.

PR geoschem#216 adds an option for a mass accumulation table (full column
only) as a 1-month benchmark option. The mass accumulation table
compares the difference in mass change for each species across two
different runs, ref and dev. The mass change per species is computed
as the difference between start and end based on values in the restart
files (end restart mass minus start restart mass). Concentrations are
converted to mass in the same way as done for the benchmark mass tables.

Signed-off-by: Bob Yantosca <yantosca@seas.harvard.edu>
  • Loading branch information
yantosca committed May 23, 2023
2 parents 65185f7 + f658f21 commit 6421958
Show file tree
Hide file tree
Showing 5 changed files with 882 additions and 2 deletions.
1 change: 1 addition & 0 deletions benchmark/1mo_benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ options:
plot_jvalues: True
plot_aod: True
mass_table: True
mass_accum_table: False
ops_budget_table: False
OH_metrics: True
ste_table: True # GCC only
Expand Down
9 changes: 9 additions & 0 deletions benchmark/modules/run_1yr_tt_benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,8 @@ def run_benchmark(config, bmk_year_ref, bmk_year_dev):
print(" - Radionuclides budget table")
if config["options"]["outputs"]["operations_budget"]:
print(" - Operations budget table")
if config["options"]["outputs"]["mass_accumulation"]:
print(" - Mass accumulation table")
if config["options"]["outputs"]["ste_table"]:
print(" - Table of strat-trop exchange")
if config["options"]["outputs"]["cons_table"]:
Expand Down Expand Up @@ -1002,6 +1004,13 @@ def run_benchmark(config, bmk_year_ref, bmk_year_dev):
dst=gchp_vs_gchp_tablesdir,
)

# ==================================================================
# GCHP vs GCHP mass accumulation table
# ==================================================================
if config["options"]["outputs"]["mass_accumulation"]:
print("\n%%% Creating GCHP vs. GCHP mass accumulation table %%%")


# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# Create mass conservations tables for GCC and GCHP
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Expand Down
157 changes: 157 additions & 0 deletions benchmark/run_benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,8 @@ def run_benchmark_default(config):
print(" - Table of emissions totals by spc and inventory")
if config["options"]["outputs"]["mass_table"]:
print(" - Table of species mass")
if config["options"]["outputs"]["mass_accum_table"]:
print(" - Table of species mass accumulation")
if config["options"]["outputs"]["OH_metrics"]:
print(" - Table of OH metrics")
if config["options"]["outputs"]["ste_table"]:
Expand Down Expand Up @@ -605,6 +607,41 @@ def run_benchmark_default(config):
spcdb_dir=spcdb_dir,
)

# ==================================================================
# GCC vs GCC global mass accumulation tables
# ==================================================================
if config["options"]["outputs"]["mass_accum_table"]:
print("\n%%% Creating GCC vs. GCC mass accumulation tables %%%")

# Filepaths for start and end restart files
refs = get_filepath(gcc_vs_gcc_refrst, "Restart", gcc_ref_date)
devs = get_filepath(gcc_vs_gcc_devrst, "Restart", gcc_dev_date)
refe = get_filepath(gcc_vs_gcc_refrst, "Restart", gcc_end_ref_date)
deve = get_filepath(gcc_vs_gcc_devrst, "Restart", gcc_end_dev_date)

# Get period strings
refs_str = np.datetime_as_string(gcc_ref_date, unit="s")
devs_str = np.datetime_as_string(gcc_dev_date, unit="s")
refe_str = np.datetime_as_string(gcc_end_ref_date, unit="s")
deve_str = np.datetime_as_string(gcc_end_dev_date, unit="s")
refperiod = refs_str + ' - ' + refe_str
devperiod = devs_str + ' - ' + deve_str

# Create tables
bmk.make_benchmark_mass_accumulation_tables(
refs,
refe,
config["data"]["ref"]["gcc"]["version"],
refperiod,
devs,
deve,
config["data"]["dev"]["gcc"]["version"],
devperiod,
overwrite=True,
dst=gcc_vs_gcc_tablesdir,
spcdb_dir=spcdb_dir,
)

# ==================================================================
# GCC vs GCC operation budgets tables
# ==================================================================
Expand Down Expand Up @@ -956,6 +993,63 @@ def run_benchmark_default(config):
spcdb_dir=spcdb_dir,
)

# ==================================================================
# GCHP vs GCC global mass accumulation tables
# ==================================================================
if config["options"]["outputs"]["mass_accum_table"]:
print("\n%%% Creating GCHP vs. GCC mass accumulation tables %%%")

# Filepaths for start and end restart files
refs = get_filepath(
gchp_vs_gcc_refrst,
"Restart",
gcc_dev_date
)
devs = get_filepath(
gchp_vs_gcc_devrst,
"Restart",
gchp_dev_date,
is_gchp=True,
gchp_res=config["data"]["dev"]["gchp"]["resolution"],
gchp_is_pre_14_0=config["data"]["dev"]["gchp"]["is_pre_14.0"]
)
refe = get_filepath(
gchp_vs_gcc_refrst,
"Restart",
gcc_end_dev_date
)
deve = get_filepath(
gchp_vs_gcc_devrst,
"Restart",
gchp_end_dev_date,
is_gchp=True,
gchp_res=config["data"]["dev"]["gchp"]["resolution"],
gchp_is_pre_14_0=config["data"]["dev"]["gchp"]["is_pre_14.0"]
)

# Get period strings
refs_str = np.datetime_as_string(gcc_dev_date, unit="s")
devs_str = np.datetime_as_string(gchp_dev_date, unit="s")
refe_str = np.datetime_as_string(gcc_end_dev_date, unit="s")
deve_str = np.datetime_as_string(gchp_end_dev_date, unit="s")
refperiod = refs_str + ' - ' + refe_str
devperiod = devs_str + ' - ' + deve_str

# Create tables
bmk.make_benchmark_mass_accumulation_tables(
refs,
refe,
config["data"]["dev"]["gcc"]["version"],
refperiod,
devs,
deve,
config["data"]["dev"]["gchp"]["version"],
devperiod,
overwrite=True,
dst=gchp_vs_gcc_tablesdir,
spcdb_dir=spcdb_dir,
)

# ==================================================================
# GCHP vs GCC operations budgets tables
# ==================================================================
Expand Down Expand Up @@ -1339,6 +1433,69 @@ def run_benchmark_default(config):
spcdb_dir=spcdb_dir,
)

# ==================================================================
# GCHP vs GCHP global mass accumulation tables
# ==================================================================
if config["options"]["outputs"]["mass_accum_table"]:
print("\n%%% Creating GCHP vs. GCHP mass accumulation tables %%%")

# Filepaths for start and end restart files
refs = get_filepath(
gchp_vs_gchp_refrst,
"Restart",
gchp_ref_date,
is_gchp=True,
gchp_res=config["data"]["ref"]["gchp"]["resolution"],
gchp_is_pre_14_0=config["data"]["ref"]["gchp"]["is_pre_14.0"]
)
devs = get_filepath(
gchp_vs_gchp_devrst,
"Restart",
gchp_dev_date,
is_gchp=True,
gchp_res=config["data"]["dev"]["gchp"]["resolution"],
gchp_is_pre_14_0=config["data"]["dev"]["gchp"]["is_pre_14.0"]
)
refe = get_filepath(
gchp_vs_gchp_refrst,
"Restart",
gchp_end_ref_date,
is_gchp=True,
gchp_res=config["data"]["ref"]["gchp"]["resolution"],
gchp_is_pre_14_0=config["data"]["ref"]["gchp"]["is_pre_14.0"]
)
deve = get_filepath(
gchp_vs_gchp_devrst,
"Restart",
gchp_end_dev_date,
is_gchp=True,
gchp_res=config["data"]["dev"]["gchp"]["resolution"],
gchp_is_pre_14_0=config["data"]["dev"]["gchp"]["is_pre_14.0"]
)

# Get period strings
refs_str = np.datetime_as_string(gchp_ref_date, unit="s")
devs_str = np.datetime_as_string(gchp_dev_date, unit="s")
refe_str = np.datetime_as_string(gchp_end_ref_date, unit="s")
deve_str = np.datetime_as_string(gchp_end_dev_date, unit="s")
refperiod = refs_str + ' - ' + refe_str
devperiod = devs_str + ' - ' + deve_str

# Create tables
bmk.make_benchmark_mass_accumulation_tables(
refs,
refe,
config["data"]["ref"]["gchp"]["version"],
refperiod,
devs,
deve,
config["data"]["dev"]["gchp"]["version"],
devperiod,
overwrite=True,
dst=gchp_vs_gchp_tablesdir,
spcdb_dir=spcdb_dir,
)

# ==================================================================
# GCHP vs GCHP operations budgets tables
# ==================================================================
Expand Down
Loading

0 comments on commit 6421958

Please sign in to comment.