Repository: equinor/fmu-dataio

Issue:
Add relperm to STANDARD_TABLE_INDEX_COLUMNS
We should add a default table_index for content `relperm`. 

At least the column `SATNUM` should be set as an index column. But we should check the table generated by res2df to see if there are anymore columns that should be added.
relevant discussion on slack https://equinor.slack.com/archives/C01REMRS9A9/p1730475231699219

Discussion:
@perolavsvendsen: Ref discussion @anders-kiaer, if `SATNUM` is added as a default index column, I think the existing functionality should work (similar to e.g. `SUMMARY`). Suggest we try that first, then go deeper into this if needed?@anders-kiaer: > Ref discussion [@anders-kiaer](https://github.com/anders-kiaer), if `SATNUM` is added as a default index column, I think the existing functionality should work (similar to e.g. `SUMMARY`). Suggest we try that first, then go deeper into this if needed?

Yes, I think this would be enough for our use case. The tables are not large compared to time series, so splitting on `SATNUM` is probably optimal seen from our end (splitting out in too many tables requires more requests done towards Sumo - splitting by default only on `SATNUM` is optimal seen from webviz point of view).

Solution patch:
diff --git a/src/fmu/dataio/_definitions.py b/src/fmu/dataio/_definitions.py
index 35c6b788e..61a48e10d 100644
--- a/src/fmu/dataio/_definitions.py
+++ b/src/fmu/dataio/_definitions.py
@@ -69,4 +69,5 @@ STANDARD_TABLE_INDEX_COLUMNS: Final[dict[str, list[str]]] = {
     "timeseries": ["DATE"],
     "simulationtimeseries": ["DATE"],
     "wellpicks": ["WELL", "HORIZON"],
+    "relperm": ["SATNUM"],
 }


Test patch:
diff --git a/tests/conftest.py b/tests/conftest.py
index db4d4f035..ed1cce589 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -725,6 +725,12 @@ def fixture_summary():
     return pd.DataFrame({"alf": ["A", "B", "C"], "DATE": [1, 2, 3]})
 
 
+@pytest.fixture(name="mock_relperm")
+def fixture_relperm():
+    """Return relperm mock data"""
+    return pd.DataFrame({"alf": ["A", "B", "C"], "SATNUM": [1, 2, 3]})
+
+
 @pytest.fixture(name="drogon_summary")
 def fixture_drogon_sum(rootpath):
     """Return pyarrow table
diff --git a/tests/test_units/test_table.py b/tests/test_units/test_table.py
index f0042559b..06e5f4210 100644
--- a/tests/test_units/test_table.py
+++ b/tests/test_units/test_table.py
@@ -64,6 +64,15 @@ def test_inplace_volume_index(mock_volumes, globalconfig2, monkeypatch, tmp_path
     assert_correct_table_index(path, answer)
 
 
+def test_relperm_index(mock_relperm, globalconfig2, monkeypatch, tmp_path):
+    """Test that the table index is set correct for relperm data"""
+    monkeypatch.chdir(tmp_path)
+    answer = ["SATNUM"]
+    exd = ExportData(config=globalconfig2, content="relperm", name="baretull")
+    path = exd.export(mock_relperm)
+    assert_correct_table_index(path, answer)
+
+
 def test_derive_summary_index_pandas(
     mock_summary, globalconfig2, monkeypatch, tmp_path
 ):