Skip to content

Hydrology Basin Aggregation Clean #357

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

Wegatriespython
Copy link

Cleaned up and refactored hydro_agg_basin.py to a be jupyter notebook

Old file was in a poor condition was hard to decipher and had many errors.

  1. Datetime issues, there was no month to group on
 .groupby(["month"]
  1. val_2020 calculation
    Used 16 years instead of 12 months to calculate 2020 values.
qtot_2p6_gfdl_avg = qtot_2p6_gfdl[pd.date_range("2015-01-01", periods=192, freq="M")]
qtot_7p0_gfdl_avg = qtot_7p0_gfdl[pd.date_range("2015-01-01", periods=192, freq="M")]

val_2020 = (
    qtot_7p0_gfdl_avg.T.groupby(["month"]).mean()
    + qtot_2p6_gfdl_avg.T.groupby(["month"]).mean()
) / 2
  1. Loop was overwriting all outputs to the final 5 year block in bias_correction
    for year in np.arange(2020, 2105, 5):
          df_{name}
          
   return df_{name}

How to review

Read the notebook.
Clarify any issues

PR checklist

  • Continuous integration checks all ✅
  • Add or expand tests; coverage checks both ✅
  • Add, expand, or update documentation.
  • Update doc/whatsnew.

@Wegatriespython Wegatriespython self-assigned this May 27, 2025
@Wegatriespython Wegatriespython added water MESSAGEix-Nexus (water) variant ai PR includes some AI generated Code labels May 27, 2025
Copy link

codecov bot commented May 27, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 72.0%. Comparing base (c8ab04d) to head (2f736a0).

Additional details and impacted files
@@          Coverage Diff          @@
##            main    #357   +/-   ##
=====================================
  Coverage   72.0%   72.0%           
=====================================
  Files        243     243           
  Lines      19451   19451           
=====================================
  Hits       14011   14011           
  Misses      5440    5440           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ai PR includes some AI generated Code water MESSAGEix-Nexus (water) variant
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant