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

Addressing bug caused when units="SI" in a call to write_inp() #410

Merged
merged 1 commit into from
Mar 26, 2024

Conversation

kbonney
Copy link
Collaborator

@kbonney kbonney commented Mar 12, 2024

Summary

Related: #409
When the units keyword argument is set to "SI" in write_inp, WNTR will generate an INP file with values in SI units and the UNITS option set to "SI". The file can be loaded into EPANET file, where the "SI" gets changed to "LPS." No other values seem to be changed in the inp file, but I think that is correct since the only difference between "SI" units and "LPS" would be flow values and maybe pressure, which are not recorded in the inp file.

I recommend not allowing "SI" to be passed as an argument here as one potential option to address this unintuitive behavior. My PR implements a basic approach by throwing an exception when "SI" is passed. Another option would be to allow "SI", but specify to the user what is happening when they load the "SI" inpfile into EPANET (this would require first really understanding what is going on ourselves). There seems to be special behavior in EPANET when you pass "SI" as UNITS, because the same conversion to "LPS" does not occur if you load an inp file with a nonsense unit like "ASDF" into EPANET.

Tests and documentation

Clarification of what values should be input as units should be added somewhere, perhaps the docstring.

Acknowledgement

By contributing to this software project, I acknowledge that I have reviewed the software quality assurance guidelines and that my contributions are submitted under the Revised BSD License.

@kaklise kaklise merged commit 214f1f4 into USEPA:main Mar 26, 2024
41 checks passed
@kbonney kbonney deleted the issue-409 branch June 11, 2024 15:37
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.

None yet

2 participants