-
Notifications
You must be signed in to change notification settings - Fork 5
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
KPP to MICM #173
KPP to MICM #173
Conversation
Codecov ReportPatch and project coverage have no change.
Additional details and impacted files@@ Coverage Diff @@
## main #173 +/- ##
=======================================
Coverage 96.80% 96.80%
=======================================
Files 24 24
Lines 1974 1974
=======================================
Hits 1911 1911
Misses 63 63 ☔ View full report in Codecov by Sentry. |
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.
Looks good! I like the idea of adding some unit tests - this text parsing is always tricky because of all the edge cases
etc/scripts/kpp_to_micm.py
Outdated
for reactant in reactants: | ||
if reactant[0].isdigit(): | ||
equation_dict['reactants'][reactant[1:]] \ | ||
= {'yield': float(reactant[0])} |
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.
= {'yield': float(reactant[0])} | |
= {'qty': float(reactant[0])} |
I believe the stoichiometric coefficient on the reactants side is called the quantity, abbreviated to qty
, in the configuration format we use.
etc/scripts/kpp_to_micm.py
Outdated
parser.add_argument('--micm_species', type=str, | ||
default=os.path.join('..', 'configs', 'micm', 'species.json'), | ||
help='MICM output species config file') | ||
parser.add_argument('--micm_reactions', type=str, | ||
default=os.path.join('..', 'configs', 'micm', 'reactions.json'), | ||
help='MICM output reactions config file') |
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.
Would it be possible to change the default output directory to the name of the mechanism, maybe a path of ../configs/micm/<mechanism>
? At least this way any overwrite would be for the same mechanism
PR for initial implementation.
Need still to test MICM with the generated JSON from the KPP Chapman example ...
Description:
kpp_to_micm.py translates KPP config files to MICM JSON config files
(desginated by the suffixes .kpp, .spc, .eqn, .def)
from a single directory specified by the --kpp_dir argument.
TODO:
(1) Parse both A and B Arrhenius coefficients from KPP equations
Currently a single rate coeffient is assigned to A and B is set to 0.
(2) Translate stoichiometric coefficients in the equation string
with more than one digit.
(3) Add method unit tests with pytest.
(4) Add support for many more reaction types ...