gcpy.benchmark.modules.oh_metrics
Prints key metrics (e.g. global mean OH, MCF lifetime, and CH4 lifetimes) for a GEOS-Chem full-chemistry simulation or methane simulation.
Functions
|
Wrapper for xarray.open_mfdataset. |
|
Computes the mass-weighted mean OH concentration, CH3CCl3 (aka MCF) lifetime w/r/t OH, and CH4 lifetime w/r/t OH. |
|
Computes the global mean OH concentration (1e5 molec cm-3). |
|
Returns a dictionary containing various quantities that need to be passed between methods. |
|
Computes the lifetimes (in years) of CH4 and CH3CCl3 (aka MCF) against tropospheric OH. |
|
Creates a text file containing metrics of global mean OH, MCF lifetime, and CH4 lifetime for benchmarking purposes. |
|
Prints the mass-weighted mean OH (full atmospheric column) from a GEOS-Chem simulation. |
|
Reads data from all "Metrics" collection netCDF files into a single xarray Dataset. |
|
Computes the total airmass (in both kg and molec). |
Determines if a Dataset contains variables for computing metrics from a CH4 simulation or a fullchem simulation. |
|
|
Internal routine used by print_metrics to write a specific quantity (mean OH, MCF lifetime, CH4 lifetime) to a file. |
- gcpy.benchmark.modules.oh_metrics.combine_dataset(file_list=None)[source]
Wrapper for xarray.open_mfdataset.
- Parameters:
file_list (
list, optional) – List of files to read.- Returns:
data – Object w/ “Metrics” collection data.
- Return type:
xr.Dataset
- gcpy.benchmark.modules.oh_metrics.validate_metrics_collection(ds)[source]
Determines if a Dataset contains variables for computing metrics from a CH4 simulation or a fullchem simulation.
- Parameters:
ds (
xr.Dataset) – Input dataset to validate.- Returns:
is_ch4_sim – True if the dataset contains all required variables.
- Return type:
- gcpy.benchmark.modules.oh_metrics.read_metrics_collection(files)[source]
Reads data from all “Metrics” collection netCDF files into a single xarray Dataset.
- Parameters:
files (
list) – List of “Metrics” collection netCDF files.- Returns:
data – Object containing “Metrics” collection data.
- Return type:
xr.Dataset
- gcpy.benchmark.modules.oh_metrics.total_airmass(data)[source]
Computes the total airmass (in both kg and molec).
- Parameters:
data (
xr.Dataset) – Object w/ “Metrics” collection data.- Returns:
airmass_kg (
np.float64) – Total atmospheric air mass [kg].airmass_m (
np.float64) – Total atmospheric air mass [molecules].
- gcpy.benchmark.modules.oh_metrics.global_mean_oh(data, airmass_kg, mw_oh_kg)[source]
Computes the global mean OH concentration (1e5 molec cm-3).
- Parameters:
data (
xr.Dataset) – Object w/ “Metrics” collection data.airmass_kg (
np.float64) – Total atmospheric air mass [kg].mw_oh_kg (
np.float64) – Mol. wt. of OH [kg].
- Returns:
mean_oh – Mean OH [1e5 molec/cm3].
- Return type:
np.float64
- gcpy.benchmark.modules.oh_metrics.lifetimes_wrt_oh(data, airmass_m)[source]
Computes the lifetimes (in years) of CH4 and CH3CCl3 (aka MCF) against tropospheric OH.
- Parameters:
data (
xr.Dataset) – Object w/ “Metrics” collection data.airmass_m (
np.float64) – Total airmass [molecules].
- Returns:
ch4_life_wrt_oh (
np.float64) – CH4 lifetime w/r/t OH [years].mcf_life_wrt_oh (
np.float64) – MCF lifetime w/r/t OH [years].
- gcpy.benchmark.modules.oh_metrics.init_common_vars(ref, refstr, dev, devstr, spcdb_files)[source]
Returns a dictionary containing various quantities that need to be passed between methods.
- Parameters:
- Returns:
common_vars – OH Metrics data.
- Return type:
- gcpy.benchmark.modules.oh_metrics.compute_oh_metrics(common_vars)[source]
Computes the mass-weighted mean OH concentration, CH3CCl3 (aka MCF) lifetime w/r/t OH, and CH4 lifetime w/r/t OH.
- gcpy.benchmark.modules.oh_metrics.write_to_file(f, title, ref, dev, absdiff, pctdiff, is_mean_oh=False)[source]
Internal routine used by print_metrics to write a specific quantity (mean OH, MCF lifetime, CH4 lifetime) to a file.
- gcpy.benchmark.modules.oh_metrics.print_metrics(common_vars, dst)[source]
Prints the mass-weighted mean OH (full atmospheric column) from a GEOS-Chem simulation.
- gcpy.benchmark.modules.oh_metrics.make_benchmark_oh_metrics(ref, refstr, dev, devstr, spcdb_files, dst='./benchmark', overwrite=True)[source]
Creates a text file containing metrics of global mean OH, MCF lifetime, and CH4 lifetime for benchmarking purposes.
- Parameters:
ref (
str) – Path name of “Ref” (aka “Reference”) data file.refstr (
str) – Label to describe Ref.dev (
str) – Path name of “Dev” (aka “Development”) data file.devstr (
str) – Label to describe Dev.spcdb_files (
list) – Paths to Ref & Dev species_database.yml files.dst (
str, optional) – Folder where OH Metrics output will be written.overwrite (
bool, optional) – Overwrite previously-generated files?