From 0fd91cca9b08511f2c391ccdb8af78fd533d76f0 Mon Sep 17 00:00:00 2001 From: mferrera Date: Fri, 6 Dec 2024 08:46:07 +0100 Subject: [PATCH] ENH: Add 'simulationtimeseries' content type --- .../definitions/0.8.0/schema/fmu_results.json | 308 ++++++++++++++++++ src/fmu/dataio/_model/data.py | 12 + src/fmu/dataio/_model/enums.py | 1 + tests/test_units/test_contents.py | 11 + 4 files changed, 332 insertions(+) diff --git a/schema/definitions/0.8.0/schema/fmu_results.json b/schema/definitions/0.8.0/schema/fmu_results.json index 9a38509e0..0717e7d09 100644 --- a/schema/definitions/0.8.0/schema/fmu_results.json +++ b/schema/definitions/0.8.0/schema/fmu_results.json @@ -180,6 +180,9 @@ { "$ref": "#/$defs/SeismicData" }, + { + "$ref": "#/$defs/SimulationTimeSeriesData" + }, { "$ref": "#/$defs/SubcropData" }, @@ -7307,6 +7310,311 @@ "title": "SeismicData", "type": "object" }, + "SimulationTimeSeriesData": { + "description": "The ``data`` block contains information about the data contained in this object.\nThis class contains metadata for simulation time series. This is a time series\nresult derived from some simulator like OPM Flow.", + "properties": { + "alias": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Alias" + }, + "base": { + "anyOf": [ + { + "$ref": "#/$defs/Layer" + }, + { + "type": "null" + } + ], + "default": null + }, + "bbox": { + "anyOf": [ + { + "$ref": "#/$defs/BoundingBox3D" + }, + { + "$ref": "#/$defs/BoundingBox2D" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Bbox" + }, + "content": { + "const": "simulationtimeseries", + "enum": [ + "simulationtimeseries" + ], + "title": "Content", + "type": "string" + }, + "description": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Description" + }, + "domain_reference": { + "anyOf": [ + { + "$ref": "#/$defs/DomainReference" + }, + { + "type": "null" + } + ], + "default": null, + "examples": [ + "msl", + "sb", + "rkb" + ] + }, + "format": { + "examples": [ + "irap_binary" + ], + "title": "Format", + "type": "string" + }, + "geometry": { + "anyOf": [ + { + "$ref": "#/$defs/Geometry" + }, + { + "type": "null" + } + ], + "default": null + }, + "grid_model": { + "anyOf": [ + { + "$ref": "#/$defs/GridModel" + }, + { + "type": "null" + } + ], + "default": null + }, + "is_observation": { + "title": "Is Observation", + "type": "boolean" + }, + "is_prediction": { + "title": "Is Prediction", + "type": "boolean" + }, + "layout": { + "anyOf": [ + { + "$ref": "#/$defs/Layout" + }, + { + "type": "null" + } + ], + "default": null, + "examples": [ + "regular", + "cornerpoint" + ] + }, + "name": { + "examples": [ + "VIKING GP. Top" + ], + "title": "Name", + "type": "string" + }, + "offset": { + "default": 0.0, + "title": "Offset", + "type": "number" + }, + "spec": { + "anyOf": [ + { + "$ref": "#/$defs/CPGridPropertySpecification" + }, + { + "$ref": "#/$defs/CPGridSpecification" + }, + { + "$ref": "#/$defs/FaultRoomSurfaceSpecification" + }, + { + "$ref": "#/$defs/PointSpecification" + }, + { + "$ref": "#/$defs/CubeSpecification" + }, + { + "$ref": "#/$defs/PolygonsSpecification" + }, + { + "$ref": "#/$defs/SurfaceSpecification" + }, + { + "$ref": "#/$defs/TableSpecification" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Spec" + }, + "stratigraphic": { + "title": "Stratigraphic", + "type": "boolean" + }, + "stratigraphic_alias": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Stratigraphic Alias" + }, + "table_index": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "examples": [ + [ + "ZONE", + "REGION" + ] + ], + "title": "Table Index" + }, + "tagname": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "examples": [ + "ds_extract_geogrid", + "ds_post_strucmod" + ], + "title": "Tagname" + }, + "time": { + "anyOf": [ + { + "$ref": "#/$defs/Time" + }, + { + "type": "null" + } + ], + "default": null + }, + "top": { + "anyOf": [ + { + "$ref": "#/$defs/Layer" + }, + { + "type": "null" + } + ], + "default": null + }, + "undef_is_zero": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Undef Is Zero" + }, + "unit": { + "default": "", + "examples": [ + "m" + ], + "title": "Unit", + "type": "string" + }, + "vertical_domain": { + "anyOf": [ + { + "$ref": "#/$defs/VerticalDomain" + }, + { + "type": "null" + } + ], + "default": null, + "examples": [ + "depth", + "time" + ] + } + }, + "required": [ + "content", + "name", + "stratigraphic", + "format", + "is_observation", + "is_prediction" + ], + "title": "SimulationTimeSeriesData", + "type": "object" + }, "Smda": { "description": "The ``masterdata.smda`` block contains SMDA-related attributes.", "properties": { diff --git a/src/fmu/dataio/_model/data.py b/src/fmu/dataio/_model/data.py index e9002835c..0e444ad77 100644 --- a/src/fmu/dataio/_model/data.py +++ b/src/fmu/dataio/_model/data.py @@ -524,6 +524,17 @@ class SeismicData(Data): """A block describing seismic data. See :class:`Seismic`.""" +class SimulationTimeSeriesData(Data): + """ + The ``data`` block contains information about the data contained in this object. + This class contains metadata for simulation time series. This is a time series + result derived from some simulator like OPM Flow. + """ + + content: Literal[enums.Content.simulationtimeseries] + """The type of content these data represent.""" + + class SubcropData(Data): """ The ``data`` block contains information about the data contained in this object. @@ -650,6 +661,7 @@ class AnyData(RootModel): RelpermData, RFTData, SeismicData, + SimulationTimeSeriesData, SubcropData, ThicknessData, TimeData, diff --git a/src/fmu/dataio/_model/enums.py b/src/fmu/dataio/_model/enums.py index 0c16569b4..b3a9d9754 100644 --- a/src/fmu/dataio/_model/enums.py +++ b/src/fmu/dataio/_model/enums.py @@ -40,6 +40,7 @@ class Content(str, Enum): relperm = "relperm" rft = "rft" seismic = "seismic" + simulationtimeseries = "simulationtimeseries" subcrop = "subcrop" thickness = "thickness" time = "time" diff --git a/tests/test_units/test_contents.py b/tests/test_units/test_contents.py index 3e8753380..149d0a342 100644 --- a/tests/test_units/test_contents.py +++ b/tests/test_units/test_contents.py @@ -241,6 +241,17 @@ def test_content_seismic(polygons, globalconfig2): # tested various other places +def test_content_simulationtimeseries(dataframe, globalconfig2): + """Test export of the simulationtimeseries content.""" + meta = ExportData( + config=globalconfig2, + name="MyName", + content="simulationtimeseries", + ).generate_metadata(dataframe) + + assert meta["data"]["content"] == "simulationtimeseries" + + def test_content_subcrop(polygons, globalconfig2): """Test export of the subcrop content.""" meta = ExportData(