Skip to content

Fix errors in annual mean GCHP vs GC-Classic "diff-of-diffs" plots#397

Merged
yantosca merged 2 commits intodevfrom
bugfix/diff-of-diffs
Jan 23, 2026
Merged

Fix errors in annual mean GCHP vs GC-Classic "diff-of-diffs" plots#397
yantosca merged 2 commits intodevfrom
bugfix/diff-of-diffs

Conversation

@yantosca
Copy link
Contributor

Name and Institution (Required)

Name: Bob Yantosca
Institution: Harvard + GCST

Describe the update

This is the companion PR to #393. We have updated the code so as to do the following:

  1. In functions compare_single_level and compare_zonal_mean, do not take the time mean of data if we are doing for diff-of-diffs plots.
  2. Simplified function get_diff_of_diffs (in gcpy/util.py) so that a single algorithm is used for both GC-Classic and GCHP.
  3. Now take the time mean of absolute and fractional differences in get_diff_of_diffs
  4. Cosmetic changes (comments)

Expected changes

As pointed out in #393, the top row of the buggy diff-of-diffs plots looked like this:

image

With this fix, the top row now (correctly) looks like this:

dod4

Related Github Issue

Tagging @sdeastham

gcpy/benchmark/modules/benchmark_funcs.py
- Restructure the if block logic so that we do not take the time mean
  of data if we are computing the diff-of-diffs plots.  The time mean
  has to be done in the compute_zonal_mean and compute_single_level
  functions.
- Now only print info about second_ref and second_dev if verbose==True
- Updated comments

CHANGELOG.md
- Updated accordingly

Signed-off-by: Bob Yantosca <yantosca@seas.harvard.edu>
gcpy/util.py
- Removed special handling for data files generated prior to
  MAPL 1.0.0
- Use a single algorithm for computing diff-of-diffs
- Add a guard clause at the top of get_diff_of_diffs to exit unless
  both Ref and Dev are on the same grid
- Added if blocks to compute the mean of differences if absddiffs
  or fracdiffs has more than one time point
- Updated PyDoc header comments

gcpy/plot/compare_single_level.py
gcpy/plot/compare_zonal_mean.py
- In a commented-out code block for diff-of-diffs, place the comment
  character at the same level as the code (instead of in the 1st column)

Signed-off-by: Bob Yantosca <yantosca@seas.harvard.edu>
@yantosca yantosca added this to the 1.7.0 milestone Jan 23, 2026
@yantosca yantosca requested a review from msulprizio January 23, 2026 16:41
@yantosca yantosca self-assigned this Jan 23, 2026
@yantosca yantosca added topic: Benchmark Plots and Tables Issues pertaining to generating plots/tables from benchmark output category: Bug Fix Fixes a bug that was previously reported labels Jan 23, 2026
@yantosca yantosca merged commit 1350ff9 into dev Jan 23, 2026
20 checks passed
@yantosca yantosca deleted the bugfix/diff-of-diffs branch January 23, 2026 18:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

category: Bug Fix Fixes a bug that was previously reported 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.

Annual mean "diff of diffs" plots are incorrect in 1-year benchmark simulations

2 participants