gcpy.benchmark.modules.benchmark_species_changes

Generates a list of species that differ between versions, that can be printed on the GEOS-Chem wiki.

Example

$ conda activate gcpy_env
$ python gcpy.benchmark.modules.benchmark_species_changes \
  --ref-label   "14.4.0"                                  \
  --ref-log     "gcc_14.4.0/14.4.0.log"                   \
  --dev-label   "14.5.0"                                  \
  --dev-log     "gcc_14.5.0/14.5.0.log"                   \
  --spcdb-files ["gcc_14.4.0/species_database.yml",       \
                 "gcc_14.5.0/species_database.yml"],      \
  --output-file "wiki_tables.txt"

Functions

append_keys(species, species_database, keys)

Copies dictionary keys from the species database to the existing dictionary.

bool_to_str(val)

Converts a boolean True value to an "X" for printing in the wiki table.

check_for_species_changes(species, ref, dev)

Prints a list of species with attributes that have changed between the Ref and Dev versions.

create_table(keys, species, ofile)

Creates a wiki table containing selected species.

get_species_metadata(log_file, species_database)

Returns the relevant metadata for a given species, taken from a GEOS-Chem log file as well as from the species database.

main()

Parses command-line arguments.

make_benchmark_species_changes_wiki_tables(...)

Creates tables of species that have been added and removed between Ref and Dev versions.

read_one_log_file(log_file)

Parses the GEOS-Chem Classic log file (plain text) with timing information and returns a dictionary with the results.

write_wiki_row(species, ofile)

Prints metadata for a given GEOS-Chem species.

write_wiki_table_footer(ofile)

Writes the footer for a wiki table.

write_wiki_table_header(ofile)

Writes the header of a wiki table.

gcpy.benchmark.modules.benchmark_species_changes.read_one_log_file(log_file)[source]

Parses the GEOS-Chem Classic log file (plain text) with timing information and returns a dictionary with the results.

Parameters:

log_file (str) – GEOS-Chem log file.

Returns:

species – Dictionary with species metadata.

Return type:

dict

gcpy.benchmark.modules.benchmark_species_changes.append_keys(species, species_database, keys)[source]

Copies dictionary keys from the species database to the existing dictionary.

Parameters:
  • species (dict) – Dictionary w/ GEOS-Chem metadata.

  • species_database (dict) – GEOS-Chem species database.

  • keys (list) – Keys in species_database to append to species.

Returns:

species – Updated dictionary with appended keys.

Return type:

dict

gcpy.benchmark.modules.benchmark_species_changes.get_species_metadata(log_file, species_database)[source]

Returns the relevant metadata for a given species, taken from a GEOS-Chem log file as well as from the species database.

Parameters:
  • log_file (str) – GEOS-Chem log file.

  • species_database (dict) – GEOS-Chem species database.

Returns:

species_df – GEOS-Chem species metadata.

Return type:

pd.DataFrame

gcpy.benchmark.modules.benchmark_species_changes.bool_to_str(val)[source]

Converts a boolean True value to an “X” for printing in the wiki table.

Parameters:

val (bool) – Boolean value to test.

gcpy.benchmark.modules.benchmark_species_changes.write_wiki_table_header(ofile)[source]

Writes the header of a wiki table.

Parameters:

ofile (io.TextIOWrapper) – Output file handle.

gcpy.benchmark.modules.benchmark_species_changes.write_wiki_row(species, ofile)[source]

Prints metadata for a given GEOS-Chem species.

Parameters:
  • species (pd.Series) – GEOS-Chem species metadata.

  • ofile (file) – File object for output file.

Writes the footer for a wiki table.

Parameters:

ofile (io.TextIOWrapper) – Output file handle.

gcpy.benchmark.modules.benchmark_species_changes.create_table(keys, species, ofile)[source]

Creates a wiki table containing selected species.

Parameters:
  • keys (list) – Names of species to include in table.

  • species (pd.DataFrame) – Species metadata.

  • ofile (io.TextIOWrapper) – Output file handle.

gcpy.benchmark.modules.benchmark_species_changes.check_for_species_changes(species, ref, dev)[source]

Prints a list of species with attributes that have changed between the Ref and Dev versions.

Parameters:
  • species (list) – List of species in both Ref and Dev.

  • ref (pd.DataFrame) – Species metadata for the Ref version.

  • dev (pd.DataFrame) – Species metadata for the Dev version.

gcpy.benchmark.modules.benchmark_species_changes.make_benchmark_species_changes_wiki_tables(ref_label, ref_log, dev_label, dev_log, spcdb_files, output_file)[source]

Creates tables of species that have been added and removed between Ref and Dev versions.

Parameters:
  • ref_label (str) – Label for the Ref version.

  • ref_log (str) – Path to log file for the Ref version.

  • dev_label (str) – Label for the Dev version.

  • dev_log (str) – Path to log file for the Dev version.

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

  • output_file (str) – Path to file with generated wiki tables.

gcpy.benchmark.modules.benchmark_species_changes.main()[source]

Parses command-line arguments.