Repository: equinor/fmu-dataio

Issue:
Add ensemble as an FmuContext option
We are transitioning towards the terminology `ensemble` instead of `iteration.` This should also be applied to fmu.context.stage options and we need to add `ensemble` as an option here.

Discussion:

Solution patch:
diff --git a/schemas/0.10.0/fmu_results.json b/schemas/0.10.0/fmu_results.json
index 1651732ae..16bfaf416 100644
--- a/schemas/0.10.0/fmu_results.json
+++ b/schemas/0.10.0/fmu_results.json
@@ -1226,6 +1226,7 @@
       "enum": [
         "case",
         "iteration",
+        "ensemble",
         "realization"
       ],
       "title": "FMUContext",
diff --git a/src/fmu/dataio/_models/fmu_results/enums.py b/src/fmu/dataio/_models/fmu_results/enums.py
index 33c42d0b6..84ef21fd8 100644
--- a/src/fmu/dataio/_models/fmu_results/enums.py
+++ b/src/fmu/dataio/_models/fmu_results/enums.py
@@ -115,6 +115,7 @@ class FMUContext(str, Enum):
 
     case = "case"
     iteration = "iteration"
+    ensemble = "ensemble"
     realization = "realization"
 
 
diff --git a/src/fmu/dataio/aggregation.py b/src/fmu/dataio/aggregation.py
index 3bef67b07..f18fcedcd 100644
--- a/src/fmu/dataio/aggregation.py
+++ b/src/fmu/dataio/aggregation.py
@@ -246,8 +246,8 @@ class AggregatedData:
         template["fmu"]["aggregation"]["realization_ids"] = real_ids
         template["fmu"]["aggregation"]["id"] = self.aggregation_id
 
-        # fmu.context.stage should be 'iteration'
-        template["fmu"]["context"]["stage"] = FMUContext.iteration.value
+        # fmu.context.stage should be 'ensemble'
+        template["fmu"]["context"]["stage"] = FMUContext.ensemble.value
 
         # next, the new object will trigger update of: 'file', 'data' (some fields) and
         # 'tracklog'.


Test patch:
diff --git a/tests/test_units/test_aggregated_surfaces.py b/tests/test_units/test_aggregated_surfaces.py
index ad1581f36..c0d5d7d85 100644
--- a/tests/test_units/test_aggregated_surfaces.py
+++ b/tests/test_units/test_aggregated_surfaces.py
@@ -32,7 +32,7 @@ def test_regsurf_aggregated(fmurun_w_casemetadata, aggr_surfs_mean):
     newmeta = aggdata.generate_metadata(aggr_mean)
     logger.debug("New metadata:\n%s", utils.prettyprint_dict(newmeta))
     assert newmeta["fmu"]["aggregation"]["id"] == aggregation_uuid
-    assert newmeta["fmu"]["context"]["stage"] == "iteration"
+    assert newmeta["fmu"]["context"]["stage"] == "ensemble"
 
 
 def test_regsurf_aggregated_content_seismic(
@@ -60,7 +60,7 @@ def test_regsurf_aggregated_content_seismic(
     newmeta = aggdata.generate_metadata(aggr_mean)
     logger.debug("New metadata:\n%s", utils.prettyprint_dict(newmeta))
     assert newmeta["fmu"]["aggregation"]["id"] == aggregation_uuid
-    assert newmeta["fmu"]["context"]["stage"] == "iteration"
+    assert newmeta["fmu"]["context"]["stage"] == "ensemble"
 
 
 def test_regsurf_aggregated_export(fmurun_w_casemetadata, aggr_surfs_mean):