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

Namelist build script skips last line if it doesn't have a return on it #2735

Open
samsrabin opened this issue Aug 29, 2024 · 4 comments
Open
Labels
bug something is working incorrectly

Comments

@samsrabin
Copy link
Collaborator

Brief summary of bug

@adrifoster and I have noticed that, if you specify something in the very last line of a user_nl_clm file, it's not actually incorporated into the built namelist. This could quietly cause major problems if a user puts something behavior-changing there that gets ignored.

General bug information

CTSM version you are using: All

Does this bug cause significantly incorrect results in the model's science? Potentially

Configurations affected: All

Details of bug

Resolving this bug will require a fix to the build-namelist script. In the meantime, we should (a) fix the testmods that don't have a blank line at the bottom of user_nl_clm and (b) add a Github action that ensures new testmod user_nl_clm files have a blank last line.

@samsrabin samsrabin added the bug something is working incorrectly label Aug 29, 2024
@ekluzek
Copy link
Collaborator

ekluzek commented Aug 29, 2024

The user_nl_clm file is handled in cime_config/buildnml and uses cime python code (CIME/buildnml.py (create_namelist_infile) )which uses readlines to read in the file. @adrifoster found some references for this where certain languages have this behavior. @adrifoster could you post what you found here?

I'll file a bug in CIME once we've done a bit more exploration.

@ekluzek
Copy link
Collaborator

ekluzek commented Aug 29, 2024

@cacraigucar from looking on cam_development it looks like the same problem applies to CAM. I don't know if you also have user-mods and/or test-mods user_nl_* files that don't have a blank line at the end, but we do see that in CTSM, so I'd check in CAM as well.

@cacraigucar
Copy link

@nusbaume is our CAM expert on buildnml. I just tried with a user_nl_cam on a code I just committed, and the last line in my user_nl_cam got put into my atm_in file. I did not have a blank line at the end.

@ekluzek
Copy link
Collaborator

ekluzek commented Aug 29, 2024

@cacraigucar thanks for checking, glad it worked correctly for you in CAM. We'll look into this more to make sure we understand it to fix it in a robust way.

@ekluzek ekluzek changed the title Namelist build script skips last line Namelist build script skips last line if it doesn't have a return on it Sep 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something is working incorrectly
Projects
None yet
Development

No branches or pull requests

3 participants