Skip to content

Commit

Permalink
BUG: Fix data.spec not resolved properly by pydantic (#651)
Browse files Browse the repository at this point in the history
  • Loading branch information
tnatt authored May 16, 2024
1 parent 9a08f4e commit 8cac8d0
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 90 deletions.
4 changes: 1 addition & 3 deletions schema/definitions/0.8.0/examples/table_inplace.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions schema/definitions/0.8.0/examples/table_wellpicks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
80 changes: 0 additions & 80 deletions schema/definitions/0.8.0/schema/fmu_meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -713,9 +713,6 @@
{
"$ref": "#/$defs/TableSpecification"
},
{
"$ref": "#/$defs/WellPointsDictionaryCaseSpecification"
},
{
"type": "null"
}
Expand Down Expand Up @@ -1393,9 +1390,6 @@
{
"$ref": "#/$defs/TableSpecification"
},
{
"$ref": "#/$defs/WellPointsDictionaryCaseSpecification"
},
{
"type": "null"
}
Expand Down Expand Up @@ -1678,9 +1672,6 @@
{
"$ref": "#/$defs/TableSpecification"
},
{
"$ref": "#/$defs/WellPointsDictionaryCaseSpecification"
},
{
"type": "null"
}
Expand Down Expand Up @@ -1963,9 +1954,6 @@
{
"$ref": "#/$defs/TableSpecification"
},
{
"$ref": "#/$defs/WellPointsDictionaryCaseSpecification"
},
{
"type": "null"
}
Expand Down Expand Up @@ -2349,9 +2337,6 @@
{
"$ref": "#/$defs/TableSpecification"
},
{
"$ref": "#/$defs/WellPointsDictionaryCaseSpecification"
},
{
"type": "null"
}
Expand Down Expand Up @@ -2653,9 +2638,6 @@
{
"$ref": "#/$defs/TableSpecification"
},
{
"$ref": "#/$defs/WellPointsDictionaryCaseSpecification"
},
{
"type": "null"
}
Expand Down Expand Up @@ -3058,9 +3040,6 @@
{
"$ref": "#/$defs/TableSpecification"
},
{
"$ref": "#/$defs/WellPointsDictionaryCaseSpecification"
},
{
"type": "null"
}
Expand Down Expand Up @@ -3416,9 +3395,6 @@
{
"$ref": "#/$defs/TableSpecification"
},
{
"$ref": "#/$defs/WellPointsDictionaryCaseSpecification"
},
{
"type": "null"
}
Expand Down Expand Up @@ -3729,9 +3705,6 @@
{
"$ref": "#/$defs/TableSpecification"
},
{
"$ref": "#/$defs/WellPointsDictionaryCaseSpecification"
},
{
"type": "null"
}
Expand Down Expand Up @@ -4026,9 +3999,6 @@
{
"$ref": "#/$defs/TableSpecification"
},
{
"$ref": "#/$defs/WellPointsDictionaryCaseSpecification"
},
{
"type": "null"
}
Expand Down Expand Up @@ -4311,9 +4281,6 @@
{
"$ref": "#/$defs/TableSpecification"
},
{
"$ref": "#/$defs/WellPointsDictionaryCaseSpecification"
},
{
"type": "null"
}
Expand Down Expand Up @@ -4616,9 +4583,6 @@
{
"$ref": "#/$defs/TableSpecification"
},
{
"$ref": "#/$defs/WellPointsDictionaryCaseSpecification"
},
{
"type": "null"
}
Expand Down Expand Up @@ -4901,9 +4865,6 @@
{
"$ref": "#/$defs/TableSpecification"
},
{
"$ref": "#/$defs/WellPointsDictionaryCaseSpecification"
},
{
"type": "null"
}
Expand Down Expand Up @@ -5234,9 +5195,6 @@
{
"$ref": "#/$defs/TableSpecification"
},
{
"$ref": "#/$defs/WellPointsDictionaryCaseSpecification"
},
{
"type": "null"
}
Expand Down Expand Up @@ -5519,9 +5477,6 @@
{
"$ref": "#/$defs/TableSpecification"
},
{
"$ref": "#/$defs/WellPointsDictionaryCaseSpecification"
},
{
"type": "null"
}
Expand Down Expand Up @@ -5859,9 +5814,6 @@
{
"$ref": "#/$defs/TableSpecification"
},
{
"$ref": "#/$defs/WellPointsDictionaryCaseSpecification"
},
{
"type": "null"
}
Expand Down Expand Up @@ -6144,9 +6096,6 @@
{
"$ref": "#/$defs/TableSpecification"
},
{
"$ref": "#/$defs/WellPointsDictionaryCaseSpecification"
},
{
"type": "null"
}
Expand Down Expand Up @@ -6520,9 +6469,6 @@
{
"$ref": "#/$defs/TableSpecification"
},
{
"$ref": "#/$defs/WellPointsDictionaryCaseSpecification"
},
{
"type": "null"
}
Expand Down Expand Up @@ -6916,9 +6862,6 @@
{
"$ref": "#/$defs/TableSpecification"
},
{
"$ref": "#/$defs/WellPointsDictionaryCaseSpecification"
},
{
"type": "null"
}
Expand Down Expand Up @@ -7392,9 +7335,6 @@
{
"$ref": "#/$defs/TableSpecification"
},
{
"$ref": "#/$defs/WellPointsDictionaryCaseSpecification"
},
{
"type": "null"
}
Expand Down Expand Up @@ -7705,9 +7645,6 @@
{
"$ref": "#/$defs/TableSpecification"
},
{
"$ref": "#/$defs/WellPointsDictionaryCaseSpecification"
},
{
"type": "null"
}
Expand Down Expand Up @@ -7990,9 +7927,6 @@
{
"$ref": "#/$defs/TableSpecification"
},
{
"$ref": "#/$defs/WellPointsDictionaryCaseSpecification"
},
{
"type": "null"
}
Expand Down Expand Up @@ -8333,9 +8267,6 @@
{
"$ref": "#/$defs/TableSpecification"
},
{
"$ref": "#/$defs/WellPointsDictionaryCaseSpecification"
},
{
"type": "null"
}
Expand Down Expand Up @@ -8631,9 +8562,6 @@
{
"$ref": "#/$defs/TableSpecification"
},
{
"$ref": "#/$defs/WellPointsDictionaryCaseSpecification"
},
{
"type": "null"
}
Expand Down Expand Up @@ -8916,9 +8844,6 @@
{
"$ref": "#/$defs/TableSpecification"
},
{
"$ref": "#/$defs/WellPointsDictionaryCaseSpecification"
},
{
"type": "null"
}
Expand Down Expand Up @@ -9059,11 +8984,6 @@
"title": "WellPicksContent",
"type": "object"
},
"WellPointsDictionaryCaseSpecification": {
"properties": {},
"title": "WellPointsDictionaryCaseSpecification",
"type": "object"
},
"Workflow": {
"properties": {
"reference": {
Expand Down
4 changes: 0 additions & 4 deletions src/fmu/dataio/datastructure/meta/specification.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,6 @@ class CubeSpecification(SurfaceSpecification):
)


class WellPointsDictionaryCaseSpecification(BaseModel): ...


AnySpecification = Union[
CPGridPropertySpecification,
CPGridSpecification,
Expand All @@ -194,5 +191,4 @@ class WellPointsDictionaryCaseSpecification(BaseModel): ...
PolygonsSpecification,
SurfaceSpecification,
TableSpecification,
WellPointsDictionaryCaseSpecification,
]
5 changes: 5 additions & 0 deletions tests/test_units/test_metadata_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 8cac8d0

Please sign in to comment.