Prioritize kroend over krowend/krogend#502
Open
alifbe wants to merge 4 commits intoequinor:mainfrom
Open
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #502 +/- ##
==========================================
- Coverage 98.79% 98.79% -0.01%
==========================================
Files 18 18
Lines 2664 2662 -2
==========================================
- Hits 2632 2630 -2
Misses 32 32 ☔ View full report in Codecov by Sentry. |
bartekvik
reviewed
May 8, 2026
bartekvik
reviewed
May 8, 2026
bartekvik
reviewed
May 8, 2026
| params_copy["kroend"], | ||
| ) | ||
| # Overwrite any existing 'krowend' with the 'kroend' value | ||
| params_copy["krowend"] = params_copy["kroend"] |
Collaborator
There was a problem hiding this comment.
expected outcome for this function is: If 'krowend' is present, rename it to 'kroend'. and return. But is that what happen here?
bartekvik
reviewed
May 8, 2026
| params_copy["kroend"], | ||
| ) | ||
| # Overwrite any existing 'krogend' with the 'kroend' value | ||
| params_copy["krogend"] = params_copy["kroend"] |
Collaborator
There was a problem hiding this comment.
expected outcome for this function is: If 'krogend' is present, rename it to 'kroend'. and return. But is that what happen here?
bartekvik
reviewed
May 8, 2026
Comment on lines
662
to
699
| def test_factory_wateroilgas_krowgend(): | ||
| """ | ||
| Test normalize krowend and krogend to kroend and put into | ||
| create_water_oil and create_oil_gas, respectively | ||
| Normalize WaterOil parameters to be used for creating a | ||
| WaterOil(look into swof) object: | ||
| - If 'krowend' is present, rename it to 'kroend'. | ||
| - If both 'krowend' and 'kroend' are provided, use the 'krowend' value | ||
| and log a warning. | ||
| - Always remove 'krogend' if present (not relevant for WaterOil). | ||
| """ | ||
|
|
||
| wog = create_water_oil_gas( | ||
| { | ||
| "nw": 2, | ||
| "now": 3, | ||
| "ng": 1, | ||
| "nog": 2.5, | ||
| "krowend": 0.6, | ||
| "krogend": 0.7, | ||
| "kroend": 0.5, | ||
| } | ||
| ) | ||
| swof = wog.SWOF() | ||
| sgof = wog.SGOF() | ||
| sat_table_str_ok(swof) | ||
| sat_table_str_ok(sgof) | ||
| assert "Corey krg" in sgof | ||
| assert "Corey krog" in sgof | ||
| assert "kroend=0.7" in sgof | ||
| assert "kroend=0.5" in sgof | ||
| assert "Corey krw" in swof | ||
| assert "Corey krow" in swof | ||
| assert "kroend=0.6" in swof | ||
| assert "kroend=0.5" in swof | ||
| assert "krogend" not in swof | ||
| assert "krowend" not in sgof | ||
|
|
||
| check_table(wog.gasoil.table) | ||
| check_table(wog.wateroil.table) |
Collaborator
There was a problem hiding this comment.
Suggested change
| # sugggest two tests, one for case when kroend does not excist, and one where kroend is prioritiezed over krogend/krowend. Both test cover the wanted funcionality | |
| def test_factory_wateroilgas_krowgend(): | |
| """ | |
| Test normalize krowend and krogend to kroend and put into | |
| create_water_oil and create_oil_gas, respectively | |
| - If 'krowend' is present, rename it to 'kroend'. | |
| - If 'krogend' is present, rename it to 'kroend'. | |
| - Always remove 'krowend' and 'krogend' if present (not relevant for WaterOil/GasOil). | |
| """ | |
| wog = create_water_oil_gas( | |
| { | |
| "nw": 2, | |
| "now": 3, | |
| "ng": 1, | |
| "nog": 2.5, | |
| "krowend": 0.6, | |
| "krogend": 0.7, | |
| } | |
| ) | |
| swof = wog.SWOF() | |
| sgof = wog.SGOF() | |
| sat_table_str_ok(swof) | |
| sat_table_str_ok(sgof) | |
| assert "Corey krg" in sgof | |
| assert "Corey krog" in sgof | |
| assert "kroend=0.7" in sgof | |
| assert "Corey krw" in swof | |
| assert "Corey krow" in swof | |
| assert "kroend=0.6" in swof | |
| assert "krogend" not in swof | |
| assert "krowend" not in sgof | |
| check_table(wog.gasoil.table) | |
| check_table(wog.wateroil.table) | |
| def test_factory_swap_krowgend(): | |
| """ | |
| Test prioritize kroend over krowend and krogend. | |
| Always remove 'krowend' and 'krogend' if present (not relevant for WaterOil/GasOil). | |
| """ | |
| wog = create_water_oil_gas( | |
| { | |
| "nw": 2, | |
| "now": 3, | |
| "ng": 1, | |
| "nog": 2.5, | |
| "krowend": 0.6, | |
| "krogend": 0.7, | |
| "kroend": 0.5, | |
| } | |
| ) | |
| swof = wog.SWOF() | |
| sgof = wog.SGOF() | |
| sat_table_str_ok(swof) | |
| sat_table_str_ok(sgof) | |
| assert "Corey krg" in sgof | |
| assert "Corey krog" in sgof | |
| assert "kroend=0.5" in sgof | |
| assert "Corey krw" in swof | |
| assert "Corey krow" in swof | |
| assert "kroend=0.5" in swof | |
| assert "krogend" not in swof | |
| assert "krowend" not in sgof | |
| check_table(wog.gasoil.table) | |
| check_table(wog.wateroil.table) |
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.
This will PR will revert the previous behavior prior to 02ed1af
When user specify both krowend and kroend, it will use kroend.
When user specify both krogend and kroend, it will use kroend.