+
Skip to content
Merged
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@ All notable changes to GCPy will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased] - TBD
### Added
- Script `gcpy/benchmark/modules/benchmark_utils.py`, with common benchmark utility functions
- Script `gcpy/benchmark/modules/benchmark_drydep.py`, with code to create drydep velocity plots
- YAML tag `plot_drydep` in `gcpy/benchmark/config/*.yml` files

### Changed
- YAML tag `operations_budget` is now `ops_budget_table` in `gcpy/benchmark/config/1yr_tt_benchmark.yml`

## [1.4.0] - 2023-11-20
### Added
- Added C2H2 and C2H4 to `emission_species.yml`
Expand Down
1 change: 1 addition & 0 deletions gcpy/benchmark/cloud/template.1hr_benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ options:
plot_emis: False
emis_table: True
plot_jvalues: False
plot_drydep: False
plot_aod: False
mass_table: True
mass_accum_table: False
Expand Down
1 change: 1 addition & 0 deletions gcpy/benchmark/cloud/template.1mo_benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ options:
emis_table: True
plot_jvalues: True
plot_aod: True
plot_drydep: False # Need to save out DryDep collection for 1-mo
mass_table: True
mass_accum_table: False
ops_budget_table: False
Expand Down
1 change: 1 addition & 0 deletions gcpy/benchmark/config/1mo_benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ options:
emis_table: True
plot_jvalues: True
plot_aod: True
plot_drydep: False # Need to save out DryDep collection for 1-mo
mass_table: True
mass_accum_table: False
ops_budget_table: False
Expand Down
1 change: 1 addition & 0 deletions gcpy/benchmark/config/1yr_fullchem_benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ options:
emis_table: True
plot_jvalues: True
plot_aod: True
plot_drydep: True
mass_table: True
ops_budget_table: False
aer_budget_table: True
Expand Down
4 changes: 3 additions & 1 deletion gcpy/benchmark/config/1yr_tt_benchmark.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

---
# =====================================================================
# Benchmark configuration file (**EDIT AS NEEDED**)
Expand Down Expand Up @@ -108,8 +109,9 @@ options:
outputs:
plot_conc: True
plot_wetdep: True
plot_drydep: True
rnpbbe_budget: True
operations_budget: False
ops_budget_table: False
mass_table: True
ste_table: True
cons_table: True
Expand Down
175 changes: 175 additions & 0 deletions gcpy/benchmark/modules/benchmark_drydep.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
"""
Specific utilities for creating plots from GEOS-Chem benchmark simulations.
"""
import os
import gc
import numpy as np
from gcpy import util
from gcpy.plot.compare_single_level import compare_single_level
import gcpy.benchmark.modules.benchmark_utils as bmk_util

# Suppress numpy divide by zero warnings to prevent output spam
np.seterr(divide="ignore", invalid="ignore")


def make_benchmark_drydep_plots(
ref,
refstr,
dev,
devstr,
collection="DryDep",
dst="./benchmark",
subdst=None,
cmpres=None,
overwrite=False,
verbose=False,
log_color_scale=False,
weightsdir=".",
sigdiff_files=None,
n_job=-1,
time_mean=False,
varlist=None,
spcdb_dir=os.path.join(os.path.dirname(__file__), "..", "..")
):
"""
Creates six-panel comparison plots (PDF format) from GEOS-Chem
benchmark simualtion output. Can be used with data collections
that do not require special handling (e.g. concentrations).

Args:
ref: str
Path name for the "Ref" (aka "Reference") data set.
refstr: str
A string to describe ref (e.g. version number)
dev: str
Path name for the "Dev" (aka "Development") data set.
This data set will be compared against the "Reference"
data set.
devstr: str
A string to describe dev (e.g. version number)

Keyword Args (optional):
collection : str
Name of the diagnostic collection (e.g. "DryDep")
dst: str
A string denoting the destination folder where a PDF
file containing plots will be written.
Default value: ./benchmark
subdst: str
A string denoting the sub-directory of dst where PDF
files containing plots will be written. In practice,
subdst is only needed for the 1-year benchmark output,
and denotes a date string (such as "Jan2016") that
corresponds to the month that is being plotted.
Default value: None
benchmark_type: str
A string denoting the type of benchmark output to plot, options are
FullChemBenchmark, TransportTracersBenchmark, or CH4Benchmark.
Default value: "FullChemBenchmark"
overwrite: bool
Set this flag to True to overwrite files in the
destination folder (specified by the dst argument).
Default value: False.
verbose: bool
Set this flag to True to print extra informational output.
Default value: False.
n_job: int
Defines the number of simultaneous workers for parallel plotting.
Set to 1 to disable parallel plotting. Value of -1 allows the
application to decide.
Default value: -1
spcdb_dir: str
Directory of species_datbase.yml file
Default value: Directory of GCPy code repository
time_mean : bool
Determines if we should average the datasets over time
Default value: False
varlist: list of str
List of variables to plot. If varlist is None, then
all common variables in Ref & Dev will be plotted.
"""

# Create directory for plots (if it doesn't exist)
dst = bmk_util.make_output_dir(
dst,
collection,
subdst,
overwrite=overwrite,
)

# Read data
refdata, devdata = bmk_util.read_ref_and_dev(
ref,
dev,
time_mean=time_mean
)

# Get common variables between Ref and Dev
if varlist is None:
varlist = bmk_util.get_common_varnames(
refdata,
devdata,
prefix="DryDepVel_",
verbose=verbose
)

# Create surface plots
sigdiff_list = []
pdfname = bmk_util.pdf_filename(
dst,
collection,
subdst,
plot_type="Surface"
)
compare_single_level(
refdata,
refstr,
devdata,
devstr,
varlist=varlist,
cmpres=cmpres,
ilev=0,
pdfname=pdfname,
log_color_scale=log_color_scale,
extra_title_txt=subdst,
sigdiff_list=sigdiff_list,
weightsdir=weightsdir,
n_job=n_job,
spcdb_dir=spcdb_dir
)
util.add_bookmarks_to_pdf(
pdfname,
varlist,
remove_prefix=collection + '_',
verbose=verbose
)

# Write significant differences to file (if there are any)
bmk_util.print_sigdiffs(
sigdiff_files,
sigdiff_list,
sigdiff_type="sfc",
sigdiff_cat="DryDepVel"
)

# -------------------------------------------
# Clean up
# -------------------------------------------
del refdata
del devdata
gc.collect()


def drydepvel_species():
"""
Returns a list of species for the dry deposition velocity
(DryDepVel) benchmark plots:

Returns:
--------
varnames (list of str): Variable names to plot
"""
# These are key dry deposition species (as per Mat Evans)
return ["DryDepVel_ACET", "DryDepVel_HNO3", "DryDepVel_NH3",
"DryDepVel_NH4", "DryDepVel_NIT", "DryDepVel_NITs",
"DryDepVel_O3", "DryDepVel_SO4"]
Loading
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载