fix(path_utils): resolve C(E|T)SM root paths in Python tools (resolves #2658, #3552) - #4207
Open
johnpaulalex wants to merge 3 commits into
Open
johnpaulalex wants to merge 3 commits into
johnpaulalex wants to merge 3 commits into
Conversation
johnpaulalex
force-pushed
the
fix/2658-ccs-config-path
branch
2 times, most recently
from
September 13, 2026 13:54
f2b43d2 to
7e24a94
Compare
johnpaulalex
force-pushed
the
fix/2658-ccs-config-path
branch
4 times, most recently
from
September 13, 2026 14:12
e3a8344 to
85aafae
Compare
johnpaulalex
force-pushed
the
fix/2658-ccs-config-path
branch
from
September 13, 2026 14:18
85aafae to
211a991
Compare
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description of changes
This PR resolves issues #2658 and #3552 where CTSM Python tools (
gen_mksurfdata_namelist,subset_data,run_tower,tower_site) failed when executed inside a full CESM checkout layout (<CESM_ROOT>/components/clm).Key Refactoring:
path_under_ctsm()&path_under_top_submodule():path_under_ctsm()strictly resolves submodules under<CTSM_ROOT>/<submodule>.path_under_top_submodule()checks<CTSM_ROOT>/<submodule>first, falling back to<CESM_ROOT>/<submodule>when inside a CESM checkout.path_to_ccs_config()&path_to_top_root():path_to_cime()/../ccs_configcalls ingen_mksurfdata_namelistwithpath_to_ccs_config().subset_data.py,run_tower.py, andtower_site.pyto usepath_to_top_root()forcesmrootwhile retainingpath_to_ctsm_root()for CTSM-internal config (default_data_2000.cfg,cime_config/usermods_dirs).standalone_onlytoctsm_only:path_utils.py,run_sys_tests, and unit test modules for clearer intent.test_setupFiles_cesmCheckoutLayoutintest_unit_subset_data.py.test_towerSite_cesmCheckoutLayoutintest_unit_run_tower.py.Specific notes
Contributors other than yourself, if any:
CTSM issues resolved or otherwise addressed, if any:
Description of generative AI usage:
Google Antigravity was used to write the code and tests, followed by human-guided verification.
Any user interface changes (namelist or namelist defaults changes)?
None.
Testing planned or performed, if any:
python3 -m unittest python/ctsm/test/test_unit_path_utils.py: 15/15 OKpython3 -m unittest python/ctsm/test/test_unit_subset_data.py: 37/37 OK (includingtest_setupFiles_cesmCheckoutLayout)python3 -m unittest python/ctsm/test/test_unit_run_tower.py: 3/3 OK (includingtest_towerSite_cesmCheckoutLayout)Requirements before merge:
test_unit_path_utils.py,test_unit_subset_data.py,test_unit_run_tower.py) under macOS python3 environment.