gcpy.benchmark.modules.benchmark_mass_cons_table

Creates mass conservation tables from passive tracer concentrations stored in GEOS-Chem Classic and/or GCHP restart files.

Functions

compute_diff(key, ref, dev)

Computes the difference in two dictionaries (Dev - Ref) for a given search key.

compute_diff_statistics(ref, dev)

Computes difference statistics between the Ref and Dev versions.

compute_statistics(masses)

Returns a dictionary with statistics for total masses.

compute_total_mass(dset, area, delta_p, metadata)

Computes the total mass (in Tg) for the passive tracer.

get_area(area_path, dset)

Returns the area variable from a dataset (if present), or reads it from the supplied file path.

get_delta_pressure(dset)

Returns the delta-pressure variable from GEOS-Chem Classic or GCHP data files.

get_passive_tracer_metadata(spcdb_files)

Returns a dictionary with metadata for the passive tracer.

get_passive_tracer_varname(dset)

Returns the variable name under which the passive tracer is stored GEOS-Chem Classic or GCHP restart files.

make_benchmark_mass_conservation_table(...)

Creates a text file containing global mass of passive species contained in GEOS-Chem Classic and/or GCHP restart files.

gcpy.benchmark.modules.benchmark_mass_cons_table.get_area(area_path, dset)[source]

Returns the area variable from a dataset (if present), or reads it from the supplied file path.

Parameters:
  • area_path (str or None) – Full file path of area data.

  • dset (xr.Dataset) – Input data.

Returns:

area – Grid box areas [m2].

Return type:

xr.DataArray

gcpy.benchmark.modules.benchmark_mass_cons_table.get_delta_pressure(dset)[source]

Returns the delta-pressure variable from GEOS-Chem Classic or GCHP data files.

Parameters:

dset (xr.Dataset or xr.DataArray) – Input data.

gcpy.benchmark.modules.benchmark_mass_cons_table.get_passive_tracer_metadata(spcdb_files)[source]

Returns a dictionary with metadata for the passive tracer.

Parameters:

spcdb_files (list) – Paths to Ref & Dev species_database.yml files.

Returns:

properties – Dictionary with species metadata.

Return type:

dict

gcpy.benchmark.modules.benchmark_mass_cons_table.get_passive_tracer_varname(dset)[source]

Returns the variable name under which the passive tracer is stored GEOS-Chem Classic or GCHP restart files.

Parameters:

dset (xr.Dataset) – The input data.

Returns:

varname – Variable name for passive tracer.

Return type:

str

gcpy.benchmark.modules.benchmark_mass_cons_table.compute_total_mass(dset, area, delta_p, metadata)[source]

Computes the total mass (in Tg) for the passive tracer.

Parameters:
  • t_idx (int) – Time index.

  • dset (xr.Dataset) – Data [mol/mol dry air].

  • area (xr.DataArray) – Grid box areas [m2].

  • delta_p (xr.Dataset) – Pressure thicknesses [hPa].

  • metadata (dict) – Dictionary w/ species metadata.

Returns:

total_mass – Total mass [Tg] of species.

Return type:

np.float64

gcpy.benchmark.modules.benchmark_mass_cons_table.compute_statistics(masses)[source]

Returns a dictionary with statistics for total masses.

Parameters:

masses (np.ndarray) – Total masses in Tg.

Returns:

statistics – Dictionary with statistics.

Return type:

dict

gcpy.benchmark.modules.benchmark_mass_cons_table.compute_diff(key, ref, dev)[source]

Computes the difference in two dictionaries (Dev - Ref) for a given search key.

Parameters:
  • key (str) – Search key.

  • ref (dict) – Dictionary of values from Ref model.

  • dev (dict) – Dictionary of values from Dev model.

Returns:

diffs – Absolute & percent differences btw Dev & Ref for key.

Return type:

dict

gcpy.benchmark.modules.benchmark_mass_cons_table.compute_diff_statistics(ref, dev)[source]

Computes difference statistics between the Ref and Dev versions.

Parameters:
  • ref_masses (dict) – Statistics for Ref model.

  • dev_masses (dict) – Statistics for Dev model.

Returns:

diff_stats – Difference statistics between Dev and Ref.

Return type:

dict

gcpy.benchmark.modules.benchmark_mass_cons_table.make_benchmark_mass_conservation_table(ref_files, ref_label, dev_files, dev_label, spcdb_files, dst='./benchmark', overwrite=False, ref_areapath=None, dev_areapath=None)[source]

Creates a text file containing global mass of passive species contained in GEOS-Chem Classic and/or GCHP restart files.

Parameters:
  • ref_files (list or str) – List of files from the Ref model.

  • ref_label (str) – Ref version label.

  • dev_files (list or str) – List of files from the Dev model.

  • dev_label (str) – Dev version label.

  • spcdb_files (list) – Paths to Ref & Dev species_database.yml files.

  • dst (str, optional) – Destination folder for file output.

  • overwrite (bool, optional) – Overwrite pre-existing files?

  • ref_areapath (list or str, optional) – Path to file w/ Ref area data.

  • dev_areapath (list or str, optional) – Path to file w/ Dev area data.