Skip to content
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

_read_MOM_input in changes '=' to ' ' in value of MOM parameter #93

Closed
klindsay28 opened this issue Sep 20, 2021 · 3 comments · Fixed by #94
Closed

_read_MOM_input in changes '=' to ' ' in value of MOM parameter #93

klindsay28 opened this issue Sep 20, 2021 · 3 comments · Fixed by #94
Assignees

Comments

@klindsay28
Copy link
Collaborator

If the value of a MOM parameter in MOM_input or user_nl has an '=' character in it, like

DIAG_COORD_DEF_Z_NK = "FILE:/glade/scratch/klindsay/newton/IRF_20210909.nc,interfaces=depth_edges"

an example of https://mom6.readthedocs.io/en/dev-gfdl/api/generated/pages/Diagnostics.html#diagnostic-vertical-coordinates
_read_MOM_input in cime_config/MOM_RPS/FType_MOM_params.py converts the '=' to ' '.
The problem is that the line is split using '=', but the parameter value is joined using ' '.
The following patch fixes the problem

--- a/cime_config/MOM_RPS/FType_MOM_params.py
+++ b/cime_config/MOM_RPS/FType_MOM_params.py
@@ -63,7 +63,7 @@ class FType_MOM_params(MOM_RPS):
                             if ("=" in line_j):
                                 line_ss     = line_j.split("=")
                                 param_str   = (line_ss[0]).strip()  # the first element is the parameter name
-                                val_str     = ' '.join(line_ss[1:]) # the rest is tha value string
+                                val_str     = '='.join(line_ss[1:]) # the rest is the value string
                                 if '!' in val_str:
                                     val_str = val_str.split("!")[0] # discard the comment in val str, if there is
@alperaltuntas
Copy link
Member

Agreed. But, I think, we need a regex-based implementation here for robustness (that replaces the whole if-block). Will look into it.

@alperaltuntas alperaltuntas self-assigned this Sep 22, 2021
@mnlevy1981
Copy link
Collaborator

Any progress on this? @klindsay28 shared some user_nl_mom mods that include setting DIAG_COORD_DEF_*, so I ran into this same issue. I'm using the workaround mentioned in the initial report, but I won't commit it to my branch

@alperaltuntas
Copy link
Member

Just submitted a PR that fixes this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants