Skip to content

Generate mod_def.ww3 input file on the go#442

Open
ezhilsabareesh8 wants to merge 5 commits intopayu-org:masterfrom
ACCESS-NRI:440-ww3-workflow
Open

Generate mod_def.ww3 input file on the go#442
ezhilsabareesh8 wants to merge 5 commits intopayu-org:masterfrom
ACCESS-NRI:440-ww3-workflow

Conversation

@ezhilsabareesh8
Copy link
Copy Markdown
Contributor

This PR addresses part of issue #440 by implementing a feature to generate the mod_def.ww3 file on the go.

  • Added functionality to generate mod_def.ww3 on the go.
  • Updated the list of configuration files for WW3.

@pep8speaks
Copy link
Copy Markdown

Hello @ezhilsabareesh8! Thanks for opening this PR. We checked the lines you've touched for PEP 8 issues, and found:

Line 49:53: W291 trailing whitespace
Line 50:9: E124 closing bracket does not match visual indentation
Line 180:80: E501 line too long (89 > 79 characters)
Line 182:14: E114 indentation is not a multiple of four (comment)
Line 182:14: E117 over-indented (comment)
Line 183:14: E111 indentation is not a multiple of four
Line 183:14: E117 over-indented
Line 184:14: E111 indentation is not a multiple of four
Line 186:1: W293 blank line contains whitespace
Line 187:14: E114 indentation is not a multiple of four (comment)
Line 187:14: E303 too many blank lines (2)
Line 188:14: E111 indentation is not a multiple of four
Line 190:14: E114 indentation is not a multiple of four (comment)
Line 190:80: E501 line too long (83 > 79 characters)
Line 191:14: E111 indentation is not a multiple of four
Line 193:14: E114 indentation is not a multiple of four (comment)
Line 194:14: E111 indentation is not a multiple of four
Line 195:14: E111 indentation is not a multiple of four
Line 197:14: E114 indentation is not a multiple of four (comment)
Line 198:14: E111 indentation is not a multiple of four
Line 200:14: E114 indentation is not a multiple of four (comment)
Line 201:14: E111 indentation is not a multiple of four
Line 203:14: E111 indentation is not a multiple of four
Line 207:17: E117 over-indented

@anton-seaice
Copy link
Copy Markdown
Contributor

What's the status of this @ezhilsabareesh8 ?

@ezhilsabareesh8
Copy link
Copy Markdown
Contributor Author

Thanks @anton-seaice. This PR became stale after the original review requests and I did not get follow-up feedback, so it has not moved forward since then.

Since it is now far behind master, I think the best option is to first confirm whether this functionality is still wanted. If it is, I can rebase the branch onto the current master and update it as needed, or open a fresh PR based.

@anton-seaice
Copy link
Copy Markdown
Contributor

Thanks @ezhilsabareesh8 - ill give it a first review and then we can sync it up

Copy link
Copy Markdown
Contributor

@anton-seaice anton-seaice left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some general comments @ezhilsabareesh8

Is is slow to run this everytime payu setup is run ?

Comment thread payu/models/cesm_cmeps.py Outdated

# Run the ww3_grid command using the defined path
cmd = os.path.join(exec_dir, "ww3_grid")
result = os.system(cmd)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you need to check here that ww3_grid exists, and return an error otherwise

And check that result is successful, and return an error otherwise

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated in this commit dcd7f66 , to validate that ww3_grid exists and is executable before running it, and to raise a error if the command fails or does not produce mod_def.ww3.

Comment thread payu/models/cesm_cmeps.py Outdated
Comment on lines +206 to +207
else:
print("ww3dev component not found in self.components.")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't want this print statement, most of the time ww3 isn't present

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in this commit dcd7f66 , WW3 setup now only runs when ww3dev is actually present

Comment thread payu/models/cesm_cmeps.py Outdated
os.chdir(original_dir)

# Check if ww3_grid command executed successfully
if result == 0:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This check should be at line 195 - it would be easier to understand there

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in this commit dcd7f66, added here

Comment thread payu/models/cesm_cmeps.py Outdated
print("mod_def.ww3 generated successfully.")
else:
print("Error generating mod_def.ww3 file.")
raise SystemExit(1) # Terminate the program with exit code 1
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

raise and Error with a message would be better

e.g.

raise RuntimeError("Failed to generate WW3 input files")

?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in this commit dcd7f66, see here

Comment thread payu/models/cesm_cmeps.py
Comment thread payu/models/cesm_cmeps.py
Copy link
Copy Markdown
Contributor

@anton-seaice anton-seaice left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks ok to me - be good to get someone from the release team to look over it

ezhilsabareesh8 and others added 2 commits April 21, 2026 16:44
Co-authored-by: Anton Steketee <79179784+anton-seaice@users.noreply.github.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 21, 2026

Codecov Report

❌ Patch coverage is 17.39130% with 19 lines in your changes missing coverage. Please review.
✅ Project coverage is 65.16%. Comparing base (00f59e4) to head (1931551).

Files with missing lines Patch % Lines
payu/models/cesm_cmeps.py 17.39% 19 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #442      +/-   ##
==========================================
- Coverage   65.28%   65.16%   -0.13%     
==========================================
  Files          68       68              
  Lines        5710     5727      +17     
==========================================
+ Hits         3728     3732       +4     
- Misses       1982     1995      +13     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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 this pull request may close these issues.

3 participants