Skip to content

Prioritize kroend over krowend/krogend#502

Open
alifbe wants to merge 4 commits intoequinor:mainfrom
alifbe:swap-endpoint
Open

Prioritize kroend over krowend/krogend#502
alifbe wants to merge 4 commits intoequinor:mainfrom
alifbe:swap-endpoint

Conversation

@alifbe
Copy link
Copy Markdown
Collaborator

@alifbe alifbe commented May 7, 2026

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.

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented May 7, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.79%. Comparing base (3e90ecb) to head (fa9a883).
✅ All tests successful. No failed tests found.

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.
📢 Have feedback on the report? Share it here.

@alifbe alifbe requested review from bartekvik and berland May 7, 2026 12:42
Comment thread src/pyscal/factory.py Outdated
Comment thread src/pyscal/factory.py Outdated
Comment thread src/pyscal/factory.py
params_copy["kroend"],
)
# Overwrite any existing 'krowend' with the 'kroend' value
params_copy["krowend"] = params_copy["kroend"]
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

expected outcome for this function is: If 'krowend' is present, rename it to 'kroend'. and return. But is that what happen here?

Comment thread src/pyscal/factory.py
params_copy["kroend"],
)
# Overwrite any existing 'krogend' with the 'kroend' value
params_copy["krogend"] = params_copy["kroend"]
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

expected outcome for this function is: If 'krogend' is present, rename it to 'kroend'. and return. But is that what happen here?

Comment thread tests/test_factory.py
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)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

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.

3 participants