equilibrate: modify total conc check for missing elements#352
Merged
rkingsbury merged 2 commits intomainfrom Feb 14, 2026
Merged
equilibrate: modify total conc check for missing elements#352rkingsbury merged 2 commits intomainfrom
rkingsbury merged 2 commits intomainfrom
Conversation
Member
Author
|
(Note to self, the USGS link https://www.usgs.gov/software/phreeqc-version-3 is timing out during the docs linkcheck. I think that's temporary and on their server side so I'm ignoring) |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #352 +/- ##
==========================================
+ Coverage 85.36% 85.53% +0.17%
==========================================
Files 14 14
Lines 1858 1860 +2
Branches 322 323 +1
==========================================
+ Hits 1586 1591 +5
+ Misses 226 224 -2
+ Partials 46 45 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR slightly modifies the logic used to detect whether PHREEQC has discarded an element. The previous logic compared the original total element concentration with the one returned by PHREEQC, and if the two differed by more than a low tolerance,
pyEQLwould assume that the element had been dropped and add back in the entire original concentration, as discovered by @vineetbansal in #329 .Although the bug has already been fixed in #351 , this PR goes a step further to check only whether the "new" total concentration (i.e., that returned by PHREEQC) is greater than zero. If it is, that indicates that PHREEQC is "aware" of the element in question and has retained it.
We retain an error message that will be thrown if the original and new total concentrations differ by more than 5%. This really should never happen, but had this error message been present in previous versions of
equilibrate, it would have caught #329 and brought it to the user's attention.