-
Notifications
You must be signed in to change notification settings - Fork 344
Fix plumber2_surf_wrapper #3264
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
Merged
samsrabin
merged 27 commits into
ESCOMP:b4b-dev
from
samsrabin:plumber2_surf_wrapper-fixes
Jun 21, 2025
Merged
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
4b186f1
plumber2 scripts: Find csv file from anywhere.
samsrabin 0bc1cce
plumber2_surf_wrapper: Call subset_data directly.
samsrabin 55b97e6
plumber2_surf_wrapper: Specify --lon-type 180.
samsrabin 44d461d
plumber2_surf_wrapper: Respect --verbose.
samsrabin 6d96107
plumber2_surf_wrapper: Stop on errors.
samsrabin 8781571
plumber2_surf_wrapper: Add optional --plumber2-sites-csv argument.
samsrabin 6943fe4
plumber2_surf_wrapper: Fix handling of one-PFT sites.
samsrabin d2c7118
Add Python system test for plumber2_surf_wrapper.
samsrabin 132d6f8
Remove an unused import.
samsrabin 194ce43
Test plumber2_surf_wrapper invalid-PFT error.
samsrabin b9ed339
Replace plumber2_surf_wrapper args test with useful ones. Failing.
samsrabin 3019c4e
plumber2_surf_wrapper: Respect user not saying --16pft.
samsrabin 4707843
plumber2_surf_wrapper: Test full run with --16pft.
samsrabin 30f4558
plumber2_surf_wrapper: Add --overwrite option.
samsrabin 1c5c1e7
plumber2_surf_wrapper: Improve execute() comments.
samsrabin 63d61f4
plumber2_surf_wrapper: Switch --16pft to --78pft to preserve previous…
samsrabin d491e64
Merge branch 'subset_data-lon-fixes' into plumber2_surf_wrapper-fixes
samsrabin 56a36f1
plumber2 scripts: Remove addition of CTSM python dir to path.
samsrabin cf86bfc
Simplify PLUMBER2_SITES_CSV path.
samsrabin 602fe61
Move Python constants for PFT numbers to pft_utils.py.
samsrabin 8ca6e45
Rename and replace some PFT number constants for clarity.
samsrabin f6a9afc
Use MAX_PFT_ variables in more places.
samsrabin ddca30f
plumber2_surf_wrapper: Avoid mentioning 78.
samsrabin b7f7af3
plumber2_surf_wrapper: Better is_valid_pft() check.
samsrabin 75db098
Reformat with black.
samsrabin 0eb376d
Add previous commit to .git-blame-ignore-revs.
samsrabin c325805
Resolve pylint complaint.
samsrabin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| """ | ||
| Constants and functions relating to PFTs | ||
| """ | ||
|
|
||
| MIN_PFT = 0 # bare ground | ||
| MIN_NAT_PFT = 1 # minimum natural pft (not including bare ground) | ||
| MAX_NAT_PFT = 14 # maximum natural pft | ||
| MAX_PFT_GENERICCROPS = 16 # for runs with generic crops | ||
| MAX_PFT_MANAGEDCROPS = 78 # for runs with explicit crops | ||
|
|
||
|
|
||
| def is_valid_pft(pft_num, managed_crops): | ||
| """ | ||
| Given a number, check whether it represents a valid PFT (bare ground OK) | ||
| """ | ||
| if managed_crops: | ||
| max_allowed_pft = MAX_PFT_MANAGEDCROPS | ||
| else: | ||
| max_allowed_pft = MAX_PFT_GENERICCROPS | ||
|
|
||
| return MIN_PFT <= pft_num <= max_allowed_pft |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| """ | ||
| Things shared between plumber2 scripts | ||
| """ | ||
|
|
||
| import os | ||
| import pandas as pd | ||
| from ctsm.path_utils import path_to_ctsm_root | ||
|
|
||
| PLUMBER2_SITES_CSV = os.path.join( | ||
| path_to_ctsm_root(), | ||
| "tools", | ||
| "site_and_regional", | ||
| "PLUMBER2_sites.csv", | ||
| ) | ||
|
|
||
|
|
||
| def read_plumber2_sites_csv(file=PLUMBER2_SITES_CSV): | ||
| """ | ||
| Read PLUMBER2_sites.csv using pandas | ||
| """ | ||
| return pd.read_csv(file, skiprows=5) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.