-
Notifications
You must be signed in to change notification settings - Fork 23
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
Catch missing RO2 species error when prepping #457
Conversation
Adds an exception where an RO2 species is encountered in the RO2 sum of the mechanism file but isn't encountered in the mechanism species list. We shouldn't get to a point where there is an RO2 species in mechanism.ro2 that isn't in the full species list in the mechanism, so the user needs to correct their mechanism file before running the model!
Codecov Report
@@ Coverage Diff @@
## master #457 +/- ##
=======================================
Coverage 65.51% 65.51%
=======================================
Files 17 17
Lines 2047 2047
=======================================
Hits 1341 1341
Misses 706 706
Flags with carried forward coverage won't be shown. Click here to find out more. Continue to review full report at Codecov.
|
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.
Generally looks good (see comment).
build/mech_converter.py
Outdated
@@ -463,7 +463,15 @@ def convert(input_file, mech_dir, mcm_dir): | |||
# This code only executes if the break is NOT called, i.e. if the loop runs to completion without the RO2 being | |||
# found in the species list | |||
else: | |||
ro2_file.write('0 ! error RO2 not in mechanism: ' + ro2List_i + '\n') | |||
error_message = ' ****** Warning: RO2 species "' + str(ro2List_i.strip()) + '" NOT found in the mechanism. Please check the RO2 section of your mechansm file for incorrect species names! ******' |
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 this line has snuck into the commit and needs removing.
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.
Yep you're right - relic from messing around.
I've removed that line.
Adds an exception where an RO2 species is encountered in the RO2 sum of the mechanism file but isn't encountered in the mechanism species list.
We shouldn't get to a point where there is an RO2 species in mechanism.ro2 that isn't in the full species list in the mechanism, so I think the user needs to correct their mechanism before building and running the model, as opposed to a warning being shown and them being allowed to erroneously continue.
I had a look at adding some error handling to the
ro2Sum
function inoutputFunctions.f90
- it is apure
function which disallowserror stop
. I think there would be a bit too much unpicking to make that error handling neat, so I avoided it.Let me know what you think - happy to make changes as requested.
Closes #453