Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optional mass accumulation table in 1-month benchmark #216

Merged
merged 2 commits into from
May 23, 2023
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
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