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

Add option to create drydep velocity plots from benchmark output #280

Merged
merged 8 commits into from
Jan 30, 2024

Conversation

yantosca
Copy link
Contributor

Name and Institution (Required)

Name: Bob Yantosca
Institution: Harvard + GCST

Confirm you have reviewed the following documentation

Describe the update

This is the companion PR to #273. We have added the option to plot drydep velocities as part of the standard benchmark outputs.

Updates in this version:

  • Added script gcpy/benchmark/modules/benchmark_utils.py with a few utility functions.

    • This is where we can continue to abstract utility function specific to benchmark plotting codes from gcpy/util.py and gcpy/benchmark_funcs.py.
    • Eventually, all of the benchmarking code will be moved from gcpy/gcpy to gcpy/benchmark/*, so as to isolate them from other user functionality.
  • Added script gcpy/benchmark/modules/benchmark.drydep.py, which contains function make_benchmark_drydep_plots.

  • Modified the following scripts to call make_benchmark_drydep_plots from benchmark_drydep.py:

    • gcpy/benchmark/run_benchmark.py
    • gcpy/benchmark/modules/run_1yr_fullchem_benchmark.py
  • Added the plot_drydep:True YAML tag to:

    • gcpy/benchmark/config/1yr_fullchem_benchmark.yml
  • Added the plot_drydep: False YAML tag to:

    • gcpy/benchmark/cloud/template.1hr_benchmark.yml
    • gcpy/benchmark/cloud/template.1mo_benchmark.yml
    • gcpy/benchmark/config/1yr_ftt_benchmark.yml
    • gcpy/benchmark/config/1mo_fullchem_benchmark.yml
  • Changed operations_budget: False to ops_budget_table: False in gcpy/benchmark/config/1yr_tt_benchmark.yml.

    • This is to match the nomenclature used in the fullchem YAML files.

Expected changes

  • By default, drydep velocity plots are ENABED from in 1-yr fullchem benchmark output.
  • By default, drydep velocity plots are DISABLED in 1-month and 1-hour fullchem benchmark output.
    • Enabling this would require an update in the GEOS-Chem repository to archive the DryDep collection when running 1-month benchmark simulations.

Related Github Issue(s)

gcpy/benchmark/modules/benchmark_drydep.py
- Module with routine make_benchmark_drydep_plots

gcpy/benchmark/modules/benchmark_utils.py
- New module w/ utility routines for benchmark plotting/tabling code.
  We will eventually pull out other benchmark-specific routines from
  util.py into this module.

gcpy/benchmark/run_benchmark.py
- Import and call make_benchmark_drydep_plots from benchmark_drydep.py

Signed-off-by: Bob Yantosca <yantosca@seas.harvard.edu>
This commit adds YAML tags that toggle plotting of drydep velocities
in the benchmark outputs:

gcpy/benchmark/cloud/template.1hr_benchmark.yml
- Added "plot_drydep: False"

gcpy/benchmark/cloud/template.1mo_benchmark.yml
gcpy/benchmark/config/1mo_benchmark.yml
gcpy/benchmark/1yr_fullchem_benchmark.yml
gcpy/benchmark/1yr_tt_benchmark.yml
- Add "plot_drydep: True"

Signed-off-by: Bob Yantosca <yantosca@seas.harvard.edu>
gcpy/benchmark/config/1yr_tt_benchmark.yml
- Change YAML tag "operations_budget" to "ops_budget_table" to match
  usage in 1-month and 1-year YAML files

CHANGELOG.md
- Updated accordingly

Signed-off-by: Bob Yantosca <yantosca@seas.harvard.edu>
In this commit, we have fixed issues in the creation of drydep velocity
plots.  We have also taken steps to start abstracting commonly-used
benchmark code into reusable functions in benchmark_utils.py.  This
process will be continued in subsequent PRs.

gcpy/benchmark/modules/benchmark_drydep.py
- Remove unused imports
- Add the "collection" keyword argument
- Rename "datestr" argument to "subdst" for consistency w/ other routines
- Set weightsdir to "." by default
- Set default spcdb_dir to gcpy/species_database.yml
- Updated Pydoc comments
- Removed "plots" argument, as we only have drydep at the surface
- Now call make_output_dir from benchmark_utils.py to make the
  directory where plots will be placed
- Now call read_ref_and_dev tfrom benchmark_utils.py to read
  ref & dev data from disk
- Update the call to get_common_varnames from benchmark_utils.py
- Abstract the code to create the PDF filename to routine "pdf_filename"
  in benchmark_utils.py
- Remove refmetds and devmetds, they're not needed here
- Remove "normalize_by_area" keyword to compare_single_level
- Now pass "log_color_scale" to compare_single_level
- Abstract code to print significant differences to benchmark_utils.py

gcpy/benchmark_utils.py
- Updated Pydoc headers
- Removed unused imports
- Renamed "make_collection_subdir" to "make_output_dir" and simplify code
- Update code in read_ref_and_dev
- Fix bugs in routine "get_common_varnames", add Pydoc
- Add routines "print_sigdiffs" and "write_sigdiff" (needs testing)
- Add routine "pdf_filename" to get the name of the PDF output file
- Add routine "print_benchmark_info" to print a list of which
  benchmark plots/tables will be created.  This is called from the
  run_benchmark, run_1yr_fullchem_benchmark, run_1yr_tt_benchmark
  functions.

gcpy/benchmark/modules/run_1yr_fullchem_benchmark.py
- Now import and call "make_benchmark_drydep_plots" from
  "benchmark_drydep.py"
- Now call "print_benchmark_info" from "benchmark_utils.py" to display
  the list of plots/tables being generated

gcpy/benchmark/run_benchmark.py
gcpy/benchmark/modules/run_1yr_fullchem_benchmark.py
- Now call "print_benchmark_info" from "benchmark_utils.py" to display
  the list of plots/tables being generated

CHANGELOG.md
- Updated accordingly

Signed-off-by: Bob Yantosca <yantosca@seas.harvard.edu>
gcpy/benchmark/cloud/template.1mo_benchmark.yml
gcpy/benchmark/config/1mo_benchmark.yml
- Set "plot_drydep: False", as right now we do not archive the DryDep
  collection from the History diagnostics in 1-month benchmarks.
  Revisit this if we decide to archive this collection.  See issue
  geoschem/geos-chem#2065 for more info.

Signed-off-by: Bob Yantosca <yantosca@seas.harvard.edu>
gcpy/benchmark/modules/benchmark_drydep.py
- Replace "diff_title" with "sigdiff_type" in call to print_sigdiffs

gcpy/benchmark/modules/benchmark_utils.py
- Fix calls to util.verify_variable_type so that they use the proper
  variable names and arguments
- Updated Pydoc headers

gcpy/benchmark/run_benchmark.py
- Add drydep plots for GCHP vs GCC and GCHP vs GCHP
- Fix additional "cut-n-paste" errors

Signed-off-by: Bob Yantosca <yantosca@seas.harvard.edu>
@yantosca yantosca added category: Feature Request New feature or request topic: Benchmark Plots and Tables Issues pertaining to generating plots/tables from benchmark output labels Dec 11, 2023
@yantosca yantosca added this to the 1.5.0 milestone Dec 11, 2023
@yantosca yantosca self-assigned this Dec 11, 2023
@yantosca yantosca linked an issue Dec 11, 2023 that may be closed by this pull request
Copy link
Contributor

@msulprizio msulprizio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there are some typos in the GCHP vs GCC plots for the drydep option that need to be resolved before merging.

@@ -1194,6 +1226,66 @@ def gcc_vs_gcc_ops_budg(mon):
n_job=config["options"]["n_cores"]
)

# ==================================================================
# GCC vs. GCC drydep plots
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be "GCHP vs GCC"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now fixed in commit 26b597e

print("\n%%% Creating GCHP vs. GCC drydep plots %%%")

# --------------------------------------------------------------
# GCC vs GCC drydep plots: Annual mean
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be "GCHP vs GCC"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now fixed in commit 26b597e


# Filepaths
ref = get_filepaths(
gcc_vs_gcc_refdir,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be gchp_vc_gcc_refdir?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now fixed in commit 26b597e

)

# --------------------------------------------------------------
# GCC vs GCC drydep plots: Seasonal
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be "GCHP vs GCC"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now fixed in commit 26b597e

print("\n%%% Creating GCHP vs. GCC drydep plots %%%")

# Filepaths
ref = get_filepath(gcc_vs_gcc_refdir, "DryDep", gcc_ref_date)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be gchp_vs_gcc_refdir?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now fixed in commit 26b597e

gcpy/benchmark/modules/run_1yr_fullchem_benchmark.py
- Fix incorrect comments "GCC vs GCC" -> "GCHP vs GCC"
- Use gchp_vs_gcc_refdir and all_months_ref in the call to routine
  get_filepaths for the GCHP vs GCC ref model

gcpy/benchmark/run_benchmark.py
- Use gchp_vs_gcc_refdir for in the call to routine
  get_filepaths for the GCHP vs GCC ref model

Signed-off-by: Bob Yantosca <yantosca@seas.harvard.edu>
Copy link
Contributor

@msulprizio msulprizio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to merge now!

gcpy/benchmark/modules/benchmark_drydep.py
- Add new routine drydepvel_species
- Added varlist argument to make_benchmark_drydep_plots
- If varlist is None, then call bmk_util.get_common_varnames
  to get the common variables in ref & dev to plot

gcpy/benchmark/modules/run_1yr_fullchem_benchmark.py
gcpy/benchmark/modules/run_benchmark.py
- Import new function drydepvel_species() from benchmark_drydep
- Pass the output of drydepvel_species() to the varlist argument
  of make_benchmark_drydep_plots

Signed-off-by: Bob Yantosca <yantosca@seas.harvard.edu>
@yantosca yantosca merged commit bbc9e0f into dev Jan 30, 2024
0 of 3 checks passed
@yantosca yantosca deleted the feature/drydep-velocity-plots branch January 30, 2024 21:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: Feature Request New feature or request topic: Benchmark Plots and Tables Issues pertaining to generating plots/tables from benchmark output
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEATURE REQUEST] Add dry deposition velocities to benchmark output
2 participants