-
Notifications
You must be signed in to change notification settings - Fork 216
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
Fixes for zlev problem in #1459 #1469
Conversation
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.
I have pushed a proposed fix to the branch for review.
I think the regular expression for levmatch
should also be updated on line 237 (original version) or 241 (my version). Thoughts?
scripts/lib/CIME/XML/grids.py
Outdated
if component_gridname == 'atm' and atmnlev is not None: | ||
lname += "z" + atmnlev | ||
elif component_gridname == 'lnd' and lndnlev is not None: | ||
lname += "z" + lndnlev |
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.
I think we may need some error checking here. I tried an A compset with a grid alias of ne30z32_ne30z14 and ended up with LND_GRID="nullz14" in env_build.xml
I'm not sure this damages anything but I don't think this is intended.
Maybe modifying the land levmatch:
levmatch = re.match(r"(.*_)([^_]+)z(\d+)(_[^m].*)$", name)
and add an additional check to each if block above.
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.
I think that this regex changes is broken if the mask is not present isn't it?
scripts/lib/CIME/XML/grids.py
Outdated
if component_gridname == 'atm' and atmnlev is not None: | ||
lname += "z" + atmnlev | ||
elif component_gridname == 'lnd' and lndnlev is not None: | ||
lname += "z" + lndnlev |
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.
I think that this regex changes is broken if the mask is not present isn't it?
scripts/lib/CIME/XML/grids.py
Outdated
@@ -57,7 +57,7 @@ def get_grid_info(self, name, compset): | |||
name = levmatch.group(1)+levmatch.group(3) | |||
|
|||
#mechanism to specify lnd levels | |||
levmatch = re.match(r"(.*_)([^_]+)z(\d+)(.*)$", name) | |||
levmatch = re.match(r"(.*_)([^_]+)z(\d+)(_[^m].*)$", name) |
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.
Is group 4 always expected to be present?
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.
No but at the moment, there is no way to specify land levels if it is not present. For example:
ne30z192_ne30
always specifies atmosphere levels. If you want to specify land levels, you need a tri-grid short name which means group 4 will be present.
scripts/lib/CIME/XML/grids.py
Outdated
@@ -205,9 +205,13 @@ def _read_config_grids_v2(self, name, compset, atmnlev, lndnlev): | |||
if model_grid[component_gridname] is not None: | |||
lname += model_grid[component_gridname] | |||
if component_gridname == 'atm' and atmnlev is not None: | |||
lname += "z" + atmnlev | |||
if re.search(r"a%null", lname) is None: |
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.
You don't need a regex here
if not "a%null" in lname:
should do it.
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.
Doh, will fix.
scripts/lib/CIME/XML/grids.py
Outdated
elif component_gridname == 'lnd' and lndnlev is not None: | ||
lname += "z" + lndnlev | ||
if re.search(r"l%null", lname) is None: |
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.
same here, don't use regex if you don't need to
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.
ditto
scripts/lib/CIME/XML/grids.py
Outdated
@@ -234,7 +238,7 @@ def _get_domains_v2(self, component_grids): | |||
levmatch = re.match(r"([^_]+)z(\d+)(.*)$", grid_name) | |||
if levmatch: | |||
grid_name_nonlev = levmatch.group(1)+levmatch.group(3) | |||
levmatch = re.match(r"(.*_)([^_]+)z(\d+)(.*)$", grid_name) | |||
levmatch = re.match(r"(.*_)([^_]+)z(\d+)(_[^m].*)$", grid_name) |
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.
Can we reorganize so that the regex expression only appears in the code once?
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.
Is that the royal we?
I'll look into it.
@mvertens that doesn't sound right - f09z30_f09 looks different than f09_f09z30 |
but the second f09 is for the ocean/ice, not for the land. Do we really want to add land levels to the ocean grid name? |
Oh - you got me there - would it work then to specify a tri-grid like this for this special case? |
That is the idea (and what I'm testing). That is why the (anti-)mask test is in the land regex. |
Okay, changes are in. Reran scripts_regression_tests on Hobart and code checker on Yellowstone. |
If you'll update the status I'll go ahead and merge. |
Add tests for ne30_oECv3_ICG.A_WCYCL1850S Replace three integration tests that were using ne30_oEC.A_WCYCL2000 with ne30_oECv3_ICG.A_WCYCL1850S The above is the config/compset actually used by the coupled group. [BFB] * origin/rljacob/coupled/test-spinups: Introduced tests for ne30_oECv3_ICG.A_WCYCL1850S
Add tests for ne30_oECv3_ICG.A_WCYCL1850S Replace three integration tests that were using ne30_oEC.A_WCYCL2000 with ne30_oECv3_ICG.A_WCYCL1850S The above is the config/compset actually used by the coupled group. [BFB] * origin/rljacob/coupled/test-spinups: Introduced tests for ne30_oECv3_ICG.A_WCYCL1850S
Add tests for ne30_oECv3_ICG.A_WCYCL1850S Replace three integration tests that were using ne30_oEC.A_WCYCL2000 with ne30_oECv3_ICG.A_WCYCL1850S The above is the config/compset actually used by the coupled group. [BFB] * origin/rljacob/coupled/test-spinups: Introduced tests for ne30_oECv3_ICG.A_WCYCL1850S
The level specifier for atm and lnd grids was being ignored.
Test suite: scripts_regression_tests.py, SMS.ne30z60_ne30.F1850
Test baseline:
Test namelist changes:
Test status: bit for bit
Fixes #1459
User interface changes?:
Code review: