From 8cac8d071e17233867335444a7c88c9401aa97ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Therese=20Natter=C3=B8y?= <61694854+tnatt@users.noreply.github.com> Date: Thu, 16 May 2024 14:45:33 +0200 Subject: [PATCH] BUG: Fix data.spec not resolved properly by pydantic (#651) --- .../0.8.0/examples/table_inplace.yml | 4 +- .../0.8.0/examples/table_wellpicks.yml | 4 +- schema/definitions/0.8.0/schema/fmu_meta.json | 80 ------------------- .../datastructure/meta/specification.py | 4 - tests/test_units/test_metadata_class.py | 5 ++ 5 files changed, 7 insertions(+), 90 deletions(-) diff --git a/schema/definitions/0.8.0/examples/table_inplace.yml b/schema/definitions/0.8.0/examples/table_inplace.yml index 1fecb57db..a4d50e8a4 100644 --- a/schema/definitions/0.8.0/examples/table_inplace.yml +++ b/schema/definitions/0.8.0/examples/table_inplace.yml @@ -112,9 +112,7 @@ data: # The data block describes the actual data (e.g. surface). Only present in grid_model: # Making this an object to allow for expanding in the future name: MyGrid # important for data identification, also important for other data types spec: # class/layout dependent, optional? Can spec be expanded to work for all data types? - ncol: 281 - nrow: 441 - undef: -999.25 # Allow both number and string + size: 123921 columns: - BULK_OIL - NET_OIL diff --git a/schema/definitions/0.8.0/examples/table_wellpicks.yml b/schema/definitions/0.8.0/examples/table_wellpicks.yml index 27660a6f0..375b0cabd 100644 --- a/schema/definitions/0.8.0/examples/table_wellpicks.yml +++ b/schema/definitions/0.8.0/examples/table_wellpicks.yml @@ -77,9 +77,7 @@ data: # The data block describes the actual data (e.g. surface). Only present in vertical_domain: depth # / time / null depth_reference: msl # / seabed / etc spec: # class/layout dependent, optional? Can spec be expanded to work for all data types? - ncol: 281 - nrow: 441 - undef: -999.25 # Allow both number and string + size: 123921 columns: - X_UTME - Y_UTMN diff --git a/schema/definitions/0.8.0/schema/fmu_meta.json b/schema/definitions/0.8.0/schema/fmu_meta.json index a52d8af96..6d49ae780 100644 --- a/schema/definitions/0.8.0/schema/fmu_meta.json +++ b/schema/definitions/0.8.0/schema/fmu_meta.json @@ -713,9 +713,6 @@ { "$ref": "#/$defs/TableSpecification" }, - { - "$ref": "#/$defs/WellPointsDictionaryCaseSpecification" - }, { "type": "null" } @@ -1393,9 +1390,6 @@ { "$ref": "#/$defs/TableSpecification" }, - { - "$ref": "#/$defs/WellPointsDictionaryCaseSpecification" - }, { "type": "null" } @@ -1678,9 +1672,6 @@ { "$ref": "#/$defs/TableSpecification" }, - { - "$ref": "#/$defs/WellPointsDictionaryCaseSpecification" - }, { "type": "null" } @@ -1963,9 +1954,6 @@ { "$ref": "#/$defs/TableSpecification" }, - { - "$ref": "#/$defs/WellPointsDictionaryCaseSpecification" - }, { "type": "null" } @@ -2349,9 +2337,6 @@ { "$ref": "#/$defs/TableSpecification" }, - { - "$ref": "#/$defs/WellPointsDictionaryCaseSpecification" - }, { "type": "null" } @@ -2653,9 +2638,6 @@ { "$ref": "#/$defs/TableSpecification" }, - { - "$ref": "#/$defs/WellPointsDictionaryCaseSpecification" - }, { "type": "null" } @@ -3058,9 +3040,6 @@ { "$ref": "#/$defs/TableSpecification" }, - { - "$ref": "#/$defs/WellPointsDictionaryCaseSpecification" - }, { "type": "null" } @@ -3416,9 +3395,6 @@ { "$ref": "#/$defs/TableSpecification" }, - { - "$ref": "#/$defs/WellPointsDictionaryCaseSpecification" - }, { "type": "null" } @@ -3729,9 +3705,6 @@ { "$ref": "#/$defs/TableSpecification" }, - { - "$ref": "#/$defs/WellPointsDictionaryCaseSpecification" - }, { "type": "null" } @@ -4026,9 +3999,6 @@ { "$ref": "#/$defs/TableSpecification" }, - { - "$ref": "#/$defs/WellPointsDictionaryCaseSpecification" - }, { "type": "null" } @@ -4311,9 +4281,6 @@ { "$ref": "#/$defs/TableSpecification" }, - { - "$ref": "#/$defs/WellPointsDictionaryCaseSpecification" - }, { "type": "null" } @@ -4616,9 +4583,6 @@ { "$ref": "#/$defs/TableSpecification" }, - { - "$ref": "#/$defs/WellPointsDictionaryCaseSpecification" - }, { "type": "null" } @@ -4901,9 +4865,6 @@ { "$ref": "#/$defs/TableSpecification" }, - { - "$ref": "#/$defs/WellPointsDictionaryCaseSpecification" - }, { "type": "null" } @@ -5234,9 +5195,6 @@ { "$ref": "#/$defs/TableSpecification" }, - { - "$ref": "#/$defs/WellPointsDictionaryCaseSpecification" - }, { "type": "null" } @@ -5519,9 +5477,6 @@ { "$ref": "#/$defs/TableSpecification" }, - { - "$ref": "#/$defs/WellPointsDictionaryCaseSpecification" - }, { "type": "null" } @@ -5859,9 +5814,6 @@ { "$ref": "#/$defs/TableSpecification" }, - { - "$ref": "#/$defs/WellPointsDictionaryCaseSpecification" - }, { "type": "null" } @@ -6144,9 +6096,6 @@ { "$ref": "#/$defs/TableSpecification" }, - { - "$ref": "#/$defs/WellPointsDictionaryCaseSpecification" - }, { "type": "null" } @@ -6520,9 +6469,6 @@ { "$ref": "#/$defs/TableSpecification" }, - { - "$ref": "#/$defs/WellPointsDictionaryCaseSpecification" - }, { "type": "null" } @@ -6916,9 +6862,6 @@ { "$ref": "#/$defs/TableSpecification" }, - { - "$ref": "#/$defs/WellPointsDictionaryCaseSpecification" - }, { "type": "null" } @@ -7392,9 +7335,6 @@ { "$ref": "#/$defs/TableSpecification" }, - { - "$ref": "#/$defs/WellPointsDictionaryCaseSpecification" - }, { "type": "null" } @@ -7705,9 +7645,6 @@ { "$ref": "#/$defs/TableSpecification" }, - { - "$ref": "#/$defs/WellPointsDictionaryCaseSpecification" - }, { "type": "null" } @@ -7990,9 +7927,6 @@ { "$ref": "#/$defs/TableSpecification" }, - { - "$ref": "#/$defs/WellPointsDictionaryCaseSpecification" - }, { "type": "null" } @@ -8333,9 +8267,6 @@ { "$ref": "#/$defs/TableSpecification" }, - { - "$ref": "#/$defs/WellPointsDictionaryCaseSpecification" - }, { "type": "null" } @@ -8631,9 +8562,6 @@ { "$ref": "#/$defs/TableSpecification" }, - { - "$ref": "#/$defs/WellPointsDictionaryCaseSpecification" - }, { "type": "null" } @@ -8916,9 +8844,6 @@ { "$ref": "#/$defs/TableSpecification" }, - { - "$ref": "#/$defs/WellPointsDictionaryCaseSpecification" - }, { "type": "null" } @@ -9059,11 +8984,6 @@ "title": "WellPicksContent", "type": "object" }, - "WellPointsDictionaryCaseSpecification": { - "properties": {}, - "title": "WellPointsDictionaryCaseSpecification", - "type": "object" - }, "Workflow": { "properties": { "reference": { diff --git a/src/fmu/dataio/datastructure/meta/specification.py b/src/fmu/dataio/datastructure/meta/specification.py index 627d5c30c..b6baf8bbb 100644 --- a/src/fmu/dataio/datastructure/meta/specification.py +++ b/src/fmu/dataio/datastructure/meta/specification.py @@ -182,9 +182,6 @@ class CubeSpecification(SurfaceSpecification): ) -class WellPointsDictionaryCaseSpecification(BaseModel): ... - - AnySpecification = Union[ CPGridPropertySpecification, CPGridSpecification, @@ -194,5 +191,4 @@ class WellPointsDictionaryCaseSpecification(BaseModel): ... PolygonsSpecification, SurfaceSpecification, TableSpecification, - WellPointsDictionaryCaseSpecification, ] diff --git a/tests/test_units/test_metadata_class.py b/tests/test_units/test_metadata_class.py index 45cd11f1a..bba10bfe0 100644 --- a/tests/test_units/test_metadata_class.py +++ b/tests/test_units/test_metadata_class.py @@ -112,6 +112,11 @@ def test_populate_meta_objectdata(regsurf, edataobj2): assert mymeta["display"]["name"] == objdata.name assert edataobj2.name == "TopVolantis" + # surfaces shall have data.spec + assert mymeta["data"] + assert mymeta["data"]["spec"] + assert mymeta["data"]["spec"] == objdata.get_spec() + def test_populate_meta_undef_is_zero(regsurf, globalconfig2): eobj1 = dio.ExportData(