-
Notifications
You must be signed in to change notification settings - Fork 341
ctsm5.3.069: Add SystemTests to run subset_data and then CTSM #3292
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
Merged
Changes from 4 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
5a3ae01
Add SUBSETDATAPOINT system test.
samsrabin fb569f1
Refactor SUBSETDATAPOINT to use new SUBSETDATASHARED parent class.
samsrabin c6c6cad
Add SUBSETDATAREGION SystemTest.
samsrabin c4604b8
Merge branch 'b4b-dev' into subsetdata-systemtest-rebase2
samsrabin 4575931
Use self.build_indv() instead of super.build_phase().
samsrabin dfffcdb
Check if sharedlib_only rather than for existence of subset_data outp…
samsrabin c7458b8
CDEPS: Merge in cdeps1.0.77
samsrabin 139c876
Run subset_data if outputs don't exist.
samsrabin b026d0c
CDEPS: Delete DATAMODELTEST test.
samsrabin 1022b00
Fix subset_data call condition.
samsrabin 03cd0dc
CDEPS: More CX-length nlfilename and streamfilename.
samsrabin 0e14784
CDEPS: Use cdeps1.0.78 with 512-char PR merged.
samsrabin e3f8855
CIME: Move case.cmpgen_namelists call to _sharedlib_build_phase
samsrabin 0d03938
SUBSETDATA: Add redundant script call for safety.
samsrabin d8bf1b8
CIME: Fix behavior of --skip-tests-with-existing-baselines.
samsrabin 3b9abd5
Merge tag 'ctsm5.3.067' into subsetdata-systemtest
samsrabin e16d273
CIME: Use cime6.1.112.
samsrabin 93ec33c
Merge tag 'ctsm5.3.068' into subsetdata-systemtest
samsrabin c579805
Update ChangeLog/Sum.
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,72 @@ | ||
| """ | ||
| Parent class for CTSM-specific tests that first run the subset_data tool and then ensure | ||
| that CTSM does not fail using the just-generated input files | ||
| """ | ||
|
|
||
| import os | ||
| import sys | ||
| import logging | ||
| from CIME.SystemTests.system_tests_common import SystemTestsCommon | ||
| from CIME.user_mod_support import apply_user_mods | ||
| from CIME.XML.standard_module_setup import * | ||
|
|
||
| # In case we need to import subset_data later | ||
| _CTSM_PYTHON = os.path.join( | ||
| os.path.dirname(os.path.realpath(__file__)), os.pardir, os.pardir, "python" | ||
| ) | ||
| sys.path.insert(1, _CTSM_PYTHON) | ||
|
|
||
| logger = logging.getLogger(__name__) | ||
|
|
||
|
|
||
| class SUBSETDATASHARED(SystemTestsCommon): | ||
| def __init__(self, case, subset_data_cmd): | ||
| """ | ||
| initialize an object interface to the SMS system test | ||
| """ | ||
| SystemTestsCommon.__init__(self, case) | ||
|
|
||
| # Check the test setup | ||
| if not self._case.get_value("LND_GRID") == "CLM_USRDAT": | ||
| raise RuntimeError("SUBSETDATA tests require resolution CLM_USRDAT") | ||
| if "serial" not in self._case.get_value("MPILIB"): | ||
| raise RuntimeError("SUBSETDATA tests require a serial MPILIB") | ||
| if "BGC-CROP" not in self._case.get_value("COMPSET"): | ||
| raise RuntimeError("SUBSETDATA tests require a BGC-CROP compset") | ||
|
|
||
| # Add standard subset_data arguments | ||
| out_dir = os.path.join(self._get_caseroot(), "subset_data_output") | ||
| self.usermods_dir = os.path.join(out_dir, "user_mods") | ||
| self.subset_data_cmd = subset_data_cmd + [ | ||
| "--create-user-mods", | ||
| "--outdir", | ||
| out_dir, | ||
| "--user-mods-dir", | ||
| self.usermods_dir, | ||
| "--overwrite", | ||
| ] | ||
|
|
||
| def build_phase(self, sharedlib_only=False, model_only=False): | ||
|
|
||
| # Import subset_data. Do it here rather than at top because otherwise the import will | ||
| # be attempted even during RUN phase. | ||
| # pylint: disable=wrong-import-position,import-outside-toplevel | ||
| from ctsm.subset_data import main as subset_data | ||
|
|
||
| # Run the tool, if not already run, and apply usermods | ||
| if not os.path.exists(self.usermods_dir): | ||
samsrabin marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| sys.argv = self.subset_data_cmd | ||
| subset_data() | ||
|
|
||
| # Required so that CTSM doesn't fail | ||
| user_nl_clm_path = os.path.join(self.usermods_dir, "user_nl_clm") | ||
| with open(user_nl_clm_path, "a", encoding="utf-8") as user_nl_clm: | ||
| user_nl_clm.write("\ncheck_dynpft_consistency = .false.\n") | ||
|
|
||
| # Apply the user mods | ||
| self._case.flush(flushall=True) | ||
| apply_user_mods(self._get_caseroot(), self.usermods_dir) | ||
| self._case.read_xml() | ||
|
|
||
| # Do the build | ||
| super().build_phase(sharedlib_only, model_only) | ||
samsrabin marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
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,38 @@ | ||
| """ | ||
| CTSM-specific test that first runs the subset_data point tool and then ensures | ||
| that CTSM does not fail using the just-generated input files | ||
| """ | ||
|
|
||
| from subsetdata import SUBSETDATASHARED | ||
|
|
||
|
|
||
| class SUBSETDATAPOINT(SUBSETDATASHARED): | ||
| def __init__(self, case): | ||
| """ | ||
| initialize an object interface to the SMS system test | ||
| """ | ||
|
|
||
| lat = 45.402252 | ||
| lon = -92.798085 | ||
|
|
||
| # Don't need to include things that are added during SUBSETDATASHARED.__init__() | ||
| subset_data_cmd = [ | ||
| "tools/site_and_regional/subset_data", | ||
| "point", | ||
| "--lat", | ||
| str(lat), | ||
| "--lon", | ||
| str(lon), | ||
| "--create-surface", | ||
| "--crop", | ||
| "--create-landuse", | ||
| "--surf-year", | ||
| "1850", | ||
| "--create-datm", | ||
| "--datm-syr", | ||
| "1901", | ||
| "--datm-eyr", | ||
| "1901", | ||
| ] | ||
|
|
||
| super().__init__(case, subset_data_cmd) |
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,41 @@ | ||
| """ | ||
| CTSM-specific test that first runs the subset_data region tool and then ensures | ||
| that CTSM does not fail using the just-generated input files | ||
| """ | ||
|
|
||
| from subsetdata import SUBSETDATASHARED | ||
|
|
||
|
|
||
| class SUBSETDATAREGION(SUBSETDATASHARED): | ||
| def __init__(self, case): | ||
| """ | ||
| initialize an object interface to the SMS system test | ||
| """ | ||
|
|
||
| lat1 = -9 | ||
| lat2 = -7 | ||
| lon1 = 291 | ||
| lon2 = 293 | ||
|
|
||
| # Don't need to include things that are added during SUBSETDATASHARED.__init__() | ||
| subset_data_cmd = [ | ||
| "tools/site_and_regional/subset_data", | ||
| "region", | ||
| "--lat1", | ||
| str(lat1), | ||
| "--lat2", | ||
| str(lat2), | ||
| "--lon1", | ||
| str(lon1), | ||
| "--lon2", | ||
| str(lon2), | ||
| "--create-mesh", | ||
| "--create-domain", | ||
| "--create-surface", | ||
| "--crop", | ||
| "--create-landuse", | ||
| "--surf-year", | ||
| "1850", | ||
| ] | ||
|
|
||
| super().__init__(case, subset_data_cmd) |
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
Submodule cdeps
updated
7 files
| +6 −5 | datm/atm_comp_nuopc.F90 | |
| +5 −4 | dglc/glc_comp_nuopc.F90 | |
| +7 −6 | dice/ice_comp_nuopc.F90 | |
| +9 −8 | dlnd/lnd_comp_nuopc.F90 | |
| +7 −6 | docn/ocn_comp_nuopc.F90 | |
| +7 −6 | drof/rof_comp_nuopc.F90 | |
| +7 −6 | dwav/wav_comp_nuopc.F90 |
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
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.
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.