-
Notifications
You must be signed in to change notification settings - Fork 211
Allow user to provide ocean resolution at setup_expt invocation #2204
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
Closed
aerorahul
wants to merge
12
commits into
NOAA-EMC:develop
from
aerorahul:feature/setup_expt_oceanres
Closed
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
2e5fa57
add option to provide an ocean resolution during setup_expt.py
aerorahul af6d038
Merge branch 'develop' into feature/setup_expt_oceanres
aerorahul 2fc2bb5
Merge branch 'develop' into feature/setup_expt_oceanres
aerorahul 740ef66
fix pynorm error
aerorahul 11c7206
Merge branch 'develop' into feature/setup_expt_oceanres
aerorahul 890efe1
Merge branch 'develop' into feature/setup_expt_oceanres
aerorahul 52876b9
update yamls for ci tests
aerorahul f8da865
update documentation instances of resdet and resens; add resdetocean
aerorahul 31502f4
update default resdetocean
aerorahul 631eb05
Merge branch 'develop' into feature/setup_expt_oceanres
aerorahul 15845c3
Update docs/doxygen/mainpage.h
aerorahul 19131b6
Update ci/cases/pr/C96_atm3DVar.yaml
aerorahul 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
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
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
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 |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| defaults: | ||
| !INC {{ HOMEgfs }}/parm/config/gefs/yaml/defaults.yaml | ||
| base: | ||
| ACCOUNT: ${SLURM_ACCOUNT} | ||
| ACCOUNT: {{ 'SLURM_ACCOUNT' | getenv }} |
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 |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| defaults: | ||
| !INC {{ HOMEgfs }}/parm/config/gfs/yaml/defaults.yaml | ||
| base: | ||
| ACCOUNT: ${SLURM_ACCOUNT} | ||
| ACCOUNT: {{ 'SLURM_ACCOUNT' | getenv }} |
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
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 | ||||
|---|---|---|---|---|---|---|
|
|
@@ -309,7 +309,8 @@ def edit_baseconfig(host, inputs, yaml_dict): | |||||
| "@PSLOT@": inputs.pslot, | ||||||
| "@SDATE@": datetime_to_YMDH(inputs.idate), | ||||||
| "@EDATE@": datetime_to_YMDH(inputs.edate), | ||||||
| "@CASECTL@": f'C{inputs.resdet}', | ||||||
| "@CASECTL@": f'C{inputs.resdetatmos}', | ||||||
| "@OCNRES@": f"{int(100.*inputs.resdetocean):03d}", | ||||||
| "@EXPDIR@": inputs.expdir, | ||||||
| "@ROTDIR@": inputs.comrot, | ||||||
| "@EXP_WARM_START@": is_warm_start, | ||||||
|
|
@@ -322,7 +323,7 @@ def edit_baseconfig(host, inputs, yaml_dict): | |||||
| extend_dict = dict() | ||||||
| if getattr(inputs, 'nens', 0) > 0: | ||||||
| extend_dict = { | ||||||
| "@CASEENS@": f'C{inputs.resens}', | ||||||
| "@CASEENS@": f'C{inputs.resensatmos}', | ||||||
| "@NMEM_ENS@": inputs.nens, | ||||||
| } | ||||||
| tmpl_dict = dict(tmpl_dict, **extend_dict) | ||||||
|
|
@@ -387,8 +388,10 @@ def input_args(*argv): | |||||
| def _common_args(parser): | ||||||
| parser.add_argument('--pslot', help='parallel experiment name', | ||||||
| type=str, required=False, default='test') | ||||||
| parser.add_argument('--resdet', help='resolution of the deterministic model forecast', | ||||||
| parser.add_argument('--resdetatmos', help='atmosphere resolution of the deterministic model forecast', | ||||||
| type=int, required=False, default=384) | ||||||
| parser.add_argument('--resdetocean', help='ocean resolution of the deterministic model forecast', | ||||||
| type=float, required=False, default=0.0) # 0.0 (or lower) means determine from resdetatmos (limited combinations will be available) | ||||||
| parser.add_argument('--comrot', help='full path to COMROT', | ||||||
| type=str, required=False, default=os.getenv('HOME')) | ||||||
| parser.add_argument('--expdir', help='full path to EXPDIR', | ||||||
|
|
@@ -418,7 +421,7 @@ def _gfs_cycled_args(parser): | |||||
| return parser | ||||||
|
|
||||||
| def _gfs_or_gefs_ensemble_args(parser): | ||||||
| parser.add_argument('--resens', help='resolution of the ensemble model forecast', | ||||||
| parser.add_argument('--resensatmos', help='atmosphere resolution of the ensemble model forecast', | ||||||
| type=int, required=False, default=192) | ||||||
| parser.add_argument('--nens', help='number of ensemble members', | ||||||
| type=int, required=False, default=20) | ||||||
|
|
@@ -512,7 +515,7 @@ def query_and_clean(dirname): | |||||
| def validate_user_request(host, inputs): | ||||||
| supp_res = host.info['SUPPORTED_RESOLUTIONS'] | ||||||
| machine = host.machine | ||||||
| for attr in ['resdet', 'resens']: | ||||||
| for attr in ['resdetatmos', 'resensatmos']: | ||||||
| try: | ||||||
| expt_res = f'C{getattr(inputs, attr)}' | ||||||
| except AttributeError: | ||||||
|
|
@@ -521,13 +524,32 @@ def validate_user_request(host, inputs): | |||||
| raise NotImplementedError(f"Supported resolutions on {machine} are:\n{', '.join(supp_res)}") | ||||||
|
|
||||||
|
|
||||||
| def get_ocean_resolution(resdetatmos): | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| """ | ||||||
| Method to determine the ocean resolution based on the atmosphere resolution | ||||||
| Limited options are going to be available | ||||||
| """ | ||||||
| atmos_to_ocean_map = { | ||||||
| 1152: 0.25, 768: 0.25, 384: 0.25, | ||||||
| 192: 1.0, | ||||||
| 96: 5.0, 48: 5.0} | ||||||
|
KateFriedman-NOAA marked this conversation as resolved.
|
||||||
| try: | ||||||
| return atmos_to_ocean_map[resdetatmos] | ||||||
| except KeyError: | ||||||
| raise KeyError(f"Ocean resolution for {resdetatmos} is not implemented") | ||||||
|
|
||||||
|
|
||||||
| def main(*argv): | ||||||
|
|
||||||
| user_inputs = input_args(*argv) | ||||||
| host = Host() | ||||||
|
|
||||||
| validate_user_request(host, user_inputs) | ||||||
|
|
||||||
| # Determine ocean resolution if not provided | ||||||
| if user_inputs.resdetocean <= 0: | ||||||
| user_inputs.resdetocean = get_ocean_resolution(user_inputs.resdetatmos) | ||||||
|
|
||||||
| comrot = os.path.join(user_inputs.comrot, user_inputs.pslot) | ||||||
| expdir = os.path.join(user_inputs.expdir, user_inputs.pslot) | ||||||
|
|
||||||
|
|
||||||
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.