-
Notifications
You must be signed in to change notification settings - Fork 322
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
Python scripts: Require user to specify lon format when ambiguous #3024
base: b4b-dev
Are you sure you want to change the base?
Python scripts: Require user to specify lon format when ambiguous #3024
Conversation
|
* Require that user specify whether longitude is in [-180, 180] format (i.e., centered around Prime Meridian) or [0, 360] format (i.e., centered around International Date Line). * Specified as --lon-type, either 180 or 360 (respectively) * Resolves ESCOMP#2017 * Resolves ESCOMP#3001
dd68889
to
6b29b53
Compare
Also improve an error message.
a777427
to
27d45c9
Compare
879ddd8
to
7ca9ad0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 20 out of 25 changed files in this pull request and generated 1 comment.
Files not reviewed (5)
- .git-blame-ignore-revs: Language not supported
- python/ctsm/test/testinputs/modify_fsurdat_1x1mexicocity.cfg: Language not supported
- python/ctsm/test/testinputs/modify_fsurdat_opt_sections.cfg: Language not supported
- python/ctsm/test/testinputs/modify_fsurdat_short.cfg: Language not supported
- python/ctsm/test/testinputs/modify_fsurdat_short_nofiles.cfg: Language not supported
Comments suppressed due to low confidence (2)
python/ctsm/test/test_sys_mesh_modifier.py:60
- The variable _lon_type is set to None in the test setup but never given a proper default value. Consider initializing it with an appropriate default (e.g., 360) to ensure consistent behavior in tests.
self._lon_type = None
python/ctsm/subset_data.py:440
- The condition intended to check for the existence of the config file uses surf_year as a proxy, leading to a misleading error message (“Entered default config file does not exist”). Clarify the condition by directly checking the existence of the config file and update the corresponding error message accordingly.
if args.surf_year != 1850 and args.surf_year != 2000:
@@ -119,6 +137,7 @@ def get_parser(): | |||
type=plon_type, | |||
default=287.8, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Add "must be unambiguous" note here.
Description of changes
At the moment, our Python tools are dangerous in that they can allow the user to enter longitude in the [-180, 180] format when the tools actually assume the [0, 360] format. This PR fixes that by, in ambiguous cases, requiring the user to specify the format they're using with
--lon-type
either 180 or 360.Specific notes
Contributors other than yourself, if any: None
CTSM Issues Fixed:
Are answers expected to change (and if so in what way)? No
Any User Interface Changes (namelist or namelist defaults changes)? No
Does this create a need to change or add documentation? Did you do so? Yes; see ESCOMP/ctsm-docs#9.
Testing performed, if any:
Remaining:
clm_pymods
test suite