From 835dea35e46ca7af71127eaf1cfa8ea2c265703f Mon Sep 17 00:00:00 2001 From: Erich Suter Date: Tue, 10 Sep 2024 14:09:02 +0200 Subject: [PATCH] ENH: Validate uuids against pydantic.UUID4 (#759) --- docs/src/example_surface.yml | 10 ++++---- docs/src/example_surface_v070.yml | 10 ++++---- docs/src/preparations.rst | 10 ++++---- .../fmuconfig/output/global_variables.yml | 10 ++++---- .../fmuconfig/output/global_variables.yml | 10 ++++---- .../fmuconfig/output/global_variables.yml | 10 ++++---- .../s/d/nn/xcase/share/metadata/fmu_case.yml | 10 ++++---- .../examples/aggregated_surface_depth.yml | 10 ++++---- schema/definitions/0.8.0/examples/case.yml | 10 ++++---- .../0.8.0/examples/dictionary_parameters.yml | 14 +++++------ .../0.8.0/examples/polygons_field_outline.yml | 10 ++++---- .../0.8.0/examples/polygons_field_region.yml | 10 ++++---- .../examples/preprocessed_surface_depth.yml | 10 ++++---- .../0.8.0/examples/summary_table.yml | 14 +++++------ .../0.8.0/examples/surface_depth.yml | 10 ++++---- .../0.8.0/examples/surface_faultroom_data.yml | 10 ++++---- .../0.8.0/examples/surface_fluid_contact.yml | 10 ++++---- .../examples/surface_seismic_amplitude.yml | 10 ++++---- .../0.8.0/examples/table_inplace.yml | 10 ++++---- .../0.8.0/examples/table_wellpicks.yml | 10 ++++---- .../definitions/0.8.0/schema/fmu_results.json | 22 ++++++++--------- src/fmu/dataio/_model/fields.py | 24 +++++++++---------- src/fmu/dataio/_utils.py | 7 +++--- src/fmu/dataio/case.py | 4 ++-- src/fmu/dataio/providers/_fmu.py | 17 +++++++------ tests/conftest.py | 2 +- .../ertrun1/share/metadata/fmu_case.yml | 10 ++++---- .../share/metadata/fmu_case.yml | 10 ++++---- .../global_config2/global_variables.yml | 10 ++++---- .../global_variables_norw_letters.yml | 10 ++++---- 30 files changed, 162 insertions(+), 162 deletions(-) diff --git a/docs/src/example_surface.yml b/docs/src/example_surface.yml index 9b70a23a2..995a74257 100644 --- a/docs/src/example_surface.yml +++ b/docs/src/example_surface.yml @@ -157,16 +157,16 @@ masterdata: smda: country: - identifier: Norway - uuid: ad214d85-8a1d-19da-e053-c918a4889309 + uuid: 2951acd3-28da-4d87-a067-f760a5802ee5 discovery: - short_identifier: DROGON - uuid: ad214d85-8a1d-19da-e053-c918a4889309 + uuid: 2951acd3-28da-4d87-a067-f760a5802ee5 field: - identifier: DROGON - uuid: 00000000-0000-0000-0000-000000000000 + uuid: 2951acd3-28da-4d87-a067-f760a5802ee5 coordinate_system: # changing from "coordinates" to clarify this is not content identifier: ST_WGS84_UTM37N_P32637 - uuid: ad214d85-dac7-19da-e053-c918a4889309 + uuid: c5d1511a-98f5-4343-9335-613e1842fa15 stratigraphic_column: identifier: DROGON_2020 - uuid: ad214d85-8a1d-19da-e053-c918a4889310 + uuid: 2951acd3-28da-4d87-a067-f760a5802ee5 diff --git a/docs/src/example_surface_v070.yml b/docs/src/example_surface_v070.yml index a22bb31ed..63dc9a2d6 100644 --- a/docs/src/example_surface_v070.yml +++ b/docs/src/example_surface_v070.yml @@ -215,16 +215,16 @@ masterdata: smda: country: - identifier: Norway - uuid: ad214d85-8a1d-19da-e053-c918a4889309 + uuid: 2951acd3-28da-4d87-a067-f760a5802ee5 discovery: - short_identifier: DROGON - uuid: ad214d85-8a1d-19da-e053-c918a4889309 + uuid: 2951acd3-28da-4d87-a067-f760a5802ee5 field: - identifier: DROGON - uuid: 00000000-0000-0000-0000-000000000000 + uuid: 2951acd3-28da-4d87-a067-f760a5802ee5 coordinate_system: # changing from "coordinates" to clarify this is not content identifier: ST_WGS84_UTM37N_P32637 - uuid: ad214d85-dac7-19da-e053-c918a4889309 + uuid: c5d1511a-98f5-4343-9335-613e1842fa15 stratigraphic_column: identifier: DROGON_2020 - uuid: ad214d85-8a1d-19da-e053-c918a4889310 + uuid: 2951acd3-28da-4d87-a067-f760a5802ee5 diff --git a/docs/src/preparations.rst b/docs/src/preparations.rst index 64977be67..31273e4b2 100644 --- a/docs/src/preparations.rst +++ b/docs/src/preparations.rst @@ -46,19 +46,19 @@ This is an example of ``_masterdata.yml`` from Drogon. Adjust to your needs: smda: country: - identifier: Westeros - uuid: 00000000-0000-0000-0000-000000000000 + uuid: 2951acd3-28da-4d87-a067-f760a5802ee5 discovery: - short_identifier: DROGON - uuid: 00000000-0000-0000-0000-000000000000 + uuid: 2951acd3-28da-4d87-a067-f760a5802ee5 field: - identifier: DROGON - uuid: 00000000-0000-0000-0000-000000000000 + uuid: 2951acd3-28da-4d87-a067-f760a5802ee5 coordinate_system: identifier: ST_WGS84_UTM37N_P12345 - uuid: 00000000-0000-0000-0000-000000000000 + uuid: 2951acd3-28da-4d87-a067-f760a5802ee5 stratigraphic_column: identifier: DROGON_2008 - uuid: 00000000-0000-0000-0000-000000000000 + uuid: 2951acd3-28da-4d87-a067-f760a5802ee5 Note that ``country``, ``discovery`` and ``field`` are lists (can have more than one), while ``coordinate_system`` and ``stratigraphic_column`` are not. diff --git a/examples/s/d/nn/xcase/realization-0/iter-0/fmuconfig/output/global_variables.yml b/examples/s/d/nn/xcase/realization-0/iter-0/fmuconfig/output/global_variables.yml index d09f27ec3..e85f7880d 100644 --- a/examples/s/d/nn/xcase/realization-0/iter-0/fmuconfig/output/global_variables.yml +++ b/examples/s/d/nn/xcase/realization-0/iter-0/fmuconfig/output/global_variables.yml @@ -5,19 +5,19 @@ masterdata: smda: country: - identifier: Norway - uuid: ad214d85-8a1d-19da-e053-c918a4889309 + uuid: 2951acd3-28da-4d87-a067-f760a5802ee5 discovery: - short_identifier: DROGON - uuid: ad214d85-8a1d-19da-e053-c918a4889309 + uuid: 2951acd3-28da-4d87-a067-f760a5802ee5 field: - identifier: DROGON - uuid: 00000000-0000-0000-0000-000000000000 + uuid: 2951acd3-28da-4d87-a067-f760a5802ee5 coordinate_system: identifier: ST_WGS84_UTM37N_P32637 - uuid: ad214d85-dac7-19da-e053-c918a4889309 + uuid: c5d1511a-98f5-4343-9335-613e1842fa15 stratigraphic_column: identifier: DROGON_2020 - uuid: ad214d85-8a1d-19da-e053-c918a4889310 + uuid: 2951acd3-28da-4d87-a067-f760a5802ee5 access: asset: name: Drogon diff --git a/examples/s/d/nn/xcase/realization-1/iter-0/fmuconfig/output/global_variables.yml b/examples/s/d/nn/xcase/realization-1/iter-0/fmuconfig/output/global_variables.yml index d09f27ec3..e85f7880d 100644 --- a/examples/s/d/nn/xcase/realization-1/iter-0/fmuconfig/output/global_variables.yml +++ b/examples/s/d/nn/xcase/realization-1/iter-0/fmuconfig/output/global_variables.yml @@ -5,19 +5,19 @@ masterdata: smda: country: - identifier: Norway - uuid: ad214d85-8a1d-19da-e053-c918a4889309 + uuid: 2951acd3-28da-4d87-a067-f760a5802ee5 discovery: - short_identifier: DROGON - uuid: ad214d85-8a1d-19da-e053-c918a4889309 + uuid: 2951acd3-28da-4d87-a067-f760a5802ee5 field: - identifier: DROGON - uuid: 00000000-0000-0000-0000-000000000000 + uuid: 2951acd3-28da-4d87-a067-f760a5802ee5 coordinate_system: identifier: ST_WGS84_UTM37N_P32637 - uuid: ad214d85-dac7-19da-e053-c918a4889309 + uuid: c5d1511a-98f5-4343-9335-613e1842fa15 stratigraphic_column: identifier: DROGON_2020 - uuid: ad214d85-8a1d-19da-e053-c918a4889310 + uuid: 2951acd3-28da-4d87-a067-f760a5802ee5 access: asset: name: Drogon diff --git a/examples/s/d/nn/xcase/realization-9/iter-0/fmuconfig/output/global_variables.yml b/examples/s/d/nn/xcase/realization-9/iter-0/fmuconfig/output/global_variables.yml index d09f27ec3..e85f7880d 100644 --- a/examples/s/d/nn/xcase/realization-9/iter-0/fmuconfig/output/global_variables.yml +++ b/examples/s/d/nn/xcase/realization-9/iter-0/fmuconfig/output/global_variables.yml @@ -5,19 +5,19 @@ masterdata: smda: country: - identifier: Norway - uuid: ad214d85-8a1d-19da-e053-c918a4889309 + uuid: 2951acd3-28da-4d87-a067-f760a5802ee5 discovery: - short_identifier: DROGON - uuid: ad214d85-8a1d-19da-e053-c918a4889309 + uuid: 2951acd3-28da-4d87-a067-f760a5802ee5 field: - identifier: DROGON - uuid: 00000000-0000-0000-0000-000000000000 + uuid: 2951acd3-28da-4d87-a067-f760a5802ee5 coordinate_system: identifier: ST_WGS84_UTM37N_P32637 - uuid: ad214d85-dac7-19da-e053-c918a4889309 + uuid: c5d1511a-98f5-4343-9335-613e1842fa15 stratigraphic_column: identifier: DROGON_2020 - uuid: ad214d85-8a1d-19da-e053-c918a4889310 + uuid: 2951acd3-28da-4d87-a067-f760a5802ee5 access: asset: name: Drogon diff --git a/examples/s/d/nn/xcase/share/metadata/fmu_case.yml b/examples/s/d/nn/xcase/share/metadata/fmu_case.yml index 3863a53d6..b7059fb07 100644 --- a/examples/s/d/nn/xcase/share/metadata/fmu_case.yml +++ b/examples/s/d/nn/xcase/share/metadata/fmu_case.yml @@ -20,19 +20,19 @@ masterdata: smda: country: - identifier: Norway - uuid: ad214d85-8a1d-19da-e053-c918a4889309 + uuid: 2951acd3-28da-4d87-a067-f760a5802ee5 discovery: - short_identifier: DROGON - uuid: bd214d85-8a1d-19da-e053-c918a4889309 + uuid: 576790fe-d5a9-428a-8303-4013f4d440fa field: - identifier: DROGON - uuid: cd214d85-8a1d-19da-e053-c918a4889409 + uuid: dbb55b20-7ac5-4704-a6e7-3a9fe43cb213 coordinate_system: identifier: ST_WGS84_UTM37N_P32637 - uuid: ed214d85-dac7-19da-e053-c918a4889509 + uuid: b2fa2a32-f9e1-4c11-adbe-254bbc4a863e stratigraphic_column: identifier: DROGON_2020 - uuid: fd214d85-8a1d-19da-e053-c918a4889609 + uuid: dbb55b20-7ac5-4704-a6e7-3a9fe43cb213 tracklog: - datetime: '2021-06-08T13:17:06.489681' event: created diff --git a/schema/definitions/0.8.0/examples/aggregated_surface_depth.yml b/schema/definitions/0.8.0/examples/aggregated_surface_depth.yml index 71659384d..b4de96c89 100644 --- a/schema/definitions/0.8.0/examples/aggregated_surface_depth.yml +++ b/schema/definitions/0.8.0/examples/aggregated_surface_depth.yml @@ -176,17 +176,17 @@ masterdata: smda: country: - identifier: Norway - uuid: ad214d85-8a1d-19da-e053-c918a4889309 + uuid: 2951acd3-28da-4d87-a067-f760a5802ee5 discovery: - short_identifier: DROGON - uuid: 00000000-0000-0000-0000-000000000000 # mock uuid for Drogon + uuid: 2951acd3-28da-4d87-a067-f760a5802ee5 # mock uuid for Drogon field: - identifier: DROGON - uuid: 00000000-0000-0000-0000-000000000000 # mock uuid for Drogon + uuid: 2951acd3-28da-4d87-a067-f760a5802ee5 # mock uuid for Drogon coordinate_system: identifier: ST_WGS84_UTM37N_P32637 - uuid: ad214d85-dac7-19da-e053-c918a4889309 + uuid: c5d1511a-98f5-4343-9335-613e1842fa15 stratigraphic_column: identifier: DROGON_2020 - uuid: 00000000-0000-0000-0000-000000000000 # mock uuid for Drogon + uuid: 2951acd3-28da-4d87-a067-f760a5802ee5 # mock uuid for Drogon diff --git a/schema/definitions/0.8.0/examples/case.yml b/schema/definitions/0.8.0/examples/case.yml index ee9e62b13..e43b913bb 100644 --- a/schema/definitions/0.8.0/examples/case.yml +++ b/schema/definitions/0.8.0/examples/case.yml @@ -43,16 +43,16 @@ masterdata: smda: country: - identifier: Norway - uuid: ad214d85-8a1d-19da-e053-c918a4889309 + uuid: 2951acd3-28da-4d87-a067-f760a5802ee5 discovery: - short_identifier: DROGON - uuid: 00000000-0000-0000-0000-000000000000 # mock uuid for Drogon + uuid: 2951acd3-28da-4d87-a067-f760a5802ee5 # mock uuid for Drogon field: - identifier: DROGON - uuid: 00000000-0000-0000-0000-000000000000 # mock uuid for Drogon + uuid: 2951acd3-28da-4d87-a067-f760a5802ee5 # mock uuid for Drogon coordinate_system: identifier: ST_WGS84_UTM37N_P32637 - uuid: ad214d85-dac7-19da-e053-c918a4889309 + uuid: c5d1511a-98f5-4343-9335-613e1842fa15 stratigraphic_column: identifier: DROGON_2020 - uuid: 00000000-0000-0000-0000-000000000000 # mock uuid for Drogon + uuid: 2951acd3-28da-4d87-a067-f760a5802ee5 # mock uuid for Drogon diff --git a/schema/definitions/0.8.0/examples/dictionary_parameters.yml b/schema/definitions/0.8.0/examples/dictionary_parameters.yml index 90f477199..85fc94e96 100644 --- a/schema/definitions/0.8.0/examples/dictionary_parameters.yml +++ b/schema/definitions/0.8.0/examples/dictionary_parameters.yml @@ -20,11 +20,11 @@ fmu: id: "adnj" iteration: id: 0 - uuid: "dad9a25a-3ad0-0f0a-08f2-c6fe8aae4c45" + uuid: "8d328a0c-a16f-4158-b9a3-a94d0c69d182" name: "iter-0" realization: id: 0 - uuid: "28274007-fd40-29c4-c6ef-10e2414ccdcd" + uuid: "78e0b69b-4e50-4773-b72f-72579e23a764" name: "realization-0" file: relative_path: "realization-0/iter-0/share/results/dictionaries/parameters.json" @@ -56,16 +56,16 @@ masterdata: smda: country: - identifier: "Norway" - uuid: "ad214d85-8a1d-19da-e053-c918a4889309" + uuid: "2951acd3-28da-4d87-a067-f760a5802ee5" discovery: - short_identifier: "DROGON" - uuid: "ad214d85-8a1d-19da-e053-c918a4889309" + uuid: "2951acd3-28da-4d87-a067-f760a5802ee5" field: - identifier: "DROGON" - uuid: "00000000-0000-0000-0000-000000000000" + uuid: "ff30bd79-2185-400d-af91-4a9b72f61bf6" coordinate_system: identifier: "ST_WGS84_UTM37N_P32637" - uuid: "ad214d85-dac7-19da-e053-c918a4889309" + uuid: "c5d1511a-98f5-4343-9335-613e1842fa15" stratigraphic_column: identifier: "DROGON_HAS_NO_STRATCOLUMN" - uuid: "00000000-0000-0000-0000-000000000000" \ No newline at end of file + uuid: "34211f05-7883-41eb-9271-3dc5a848b4d5" \ No newline at end of file diff --git a/schema/definitions/0.8.0/examples/polygons_field_outline.yml b/schema/definitions/0.8.0/examples/polygons_field_outline.yml index 3b14f2d41..481f81675 100644 --- a/schema/definitions/0.8.0/examples/polygons_field_outline.yml +++ b/schema/definitions/0.8.0/examples/polygons_field_outline.yml @@ -129,17 +129,17 @@ masterdata: smda: country: - identifier: Norway - uuid: ad214d85-8a1d-19da-e053-c918a4889309 + uuid: 2951acd3-28da-4d87-a067-f760a5802ee5 discovery: - short_identifier: DROGON - uuid: 00000000-0000-0000-0000-000000000000 # mock uuid for Drogon + uuid: 2951acd3-28da-4d87-a067-f760a5802ee5 # mock uuid for Drogon field: - identifier: DROGON - uuid: 00000000-0000-0000-0000-000000000000 # mock uuid for Drogon + uuid: 2951acd3-28da-4d87-a067-f760a5802ee5 # mock uuid for Drogon coordinate_system: identifier: ST_WGS84_UTM37N_P32637 - uuid: ad214d85-dac7-19da-e053-c918a4889309 + uuid: c5d1511a-98f5-4343-9335-613e1842fa15 stratigraphic_column: identifier: DROGON_2020 - uuid: 00000000-0000-0000-0000-000000000000 # mock uuid for Drogon + uuid: 2951acd3-28da-4d87-a067-f760a5802ee5 # mock uuid for Drogon diff --git a/schema/definitions/0.8.0/examples/polygons_field_region.yml b/schema/definitions/0.8.0/examples/polygons_field_region.yml index 57d3f205d..66407a8bd 100644 --- a/schema/definitions/0.8.0/examples/polygons_field_region.yml +++ b/schema/definitions/0.8.0/examples/polygons_field_region.yml @@ -106,17 +106,17 @@ masterdata: smda: country: - identifier: Norway - uuid: ad214d85-8a1d-19da-e053-c918a4889309 + uuid: 2951acd3-28da-4d87-a067-f760a5802ee5 discovery: - short_identifier: DROGON - uuid: 00000000-0000-0000-0000-000000000000 # mock uuid for Drogon + uuid: 2951acd3-28da-4d87-a067-f760a5802ee5 # mock uuid for Drogon field: - identifier: DROGON - uuid: 00000000-0000-0000-0000-000000000000 # mock uuid for Drogon + uuid: 2951acd3-28da-4d87-a067-f760a5802ee5 # mock uuid for Drogon coordinate_system: identifier: ST_WGS84_UTM37N_P32637 - uuid: ad214d85-dac7-19da-e053-c918a4889309 + uuid: c5d1511a-98f5-4343-9335-613e1842fa15 stratigraphic_column: identifier: DROGON_2020 - uuid: 00000000-0000-0000-0000-000000000000 # mock uuid for Drogon + uuid: 2951acd3-28da-4d87-a067-f760a5802ee5 # mock uuid for Drogon diff --git a/schema/definitions/0.8.0/examples/preprocessed_surface_depth.yml b/schema/definitions/0.8.0/examples/preprocessed_surface_depth.yml index daec3ec5d..50a10aede 100644 --- a/schema/definitions/0.8.0/examples/preprocessed_surface_depth.yml +++ b/schema/definitions/0.8.0/examples/preprocessed_surface_depth.yml @@ -151,17 +151,17 @@ masterdata: smda: country: - identifier: Norway - uuid: ad214d85-8a1d-19da-e053-c918a4889309 + uuid: 2951acd3-28da-4d87-a067-f760a5802ee5 discovery: - short_identifier: DROGON - uuid: 00000000-0000-0000-0000-000000000000 # mock uuid for Drogon + uuid: 2951acd3-28da-4d87-a067-f760a5802ee5 # mock uuid for Drogon field: - identifier: DROGON - uuid: 00000000-0000-0000-0000-000000000000 # mock uuid for Drogon + uuid: 2951acd3-28da-4d87-a067-f760a5802ee5 # mock uuid for Drogon coordinate_system: identifier: ST_WGS84_UTM37N_P32637 - uuid: ad214d85-dac7-19da-e053-c918a4889309 + uuid: c5d1511a-98f5-4343-9335-613e1842fa15 stratigraphic_column: identifier: DROGON_2020 - uuid: 00000000-0000-0000-0000-000000000000 # mock uuid for Drogon + uuid: 2951acd3-28da-4d87-a067-f760a5802ee5 # mock uuid for Drogon diff --git a/schema/definitions/0.8.0/examples/summary_table.yml b/schema/definitions/0.8.0/examples/summary_table.yml index 4b1663863..dbdc4034e 100644 --- a/schema/definitions/0.8.0/examples/summary_table.yml +++ b/schema/definitions/0.8.0/examples/summary_table.yml @@ -20,11 +20,11 @@ fmu: id: dbs iteration: id: 0 - uuid: b6a6507f-0789-d899-7b68-a2e6a7f1f2c4 + uuid: 3b121a35-1019-4160-afb2-d5e1917bf9d7 name: iter-0 realization: id: 0 - uuid: 318edd40-7e59-4a41-dbcc-a2f1aafd814d + uuid: a74e320e-aea5-4364-a542-c3105c4645bd name: realization-0 parameters: GLOBVAR: @@ -86,16 +86,16 @@ masterdata: smda: country: - identifier: Norway - uuid: ad214d85-8a1d-19da-e053-c918a4889309 + uuid: 2951acd3-28da-4d87-a067-f760a5802ee5 discovery: - short_identifier: DROGON - uuid: ad214d85-8a1d-19da-e053-c918a4889309 + uuid: 2951acd3-28da-4d87-a067-f760a5802ee5 field: - identifier: DROGON - uuid: 00000000-0000-0000-0000-000000000000 + uuid: 2951acd3-28da-4d87-a067-f760a5802ee5 coordinate_system: identifier: ST_WGS84_UTM37N_P32637 - uuid: ad214d85-dac7-19da-e053-c918a4889309 + uuid: c5d1511a-98f5-4343-9335-613e1842fa15 stratigraphic_column: identifier: DROGON_HAS_NO_STRATCOLUMN - uuid: 00000000-0000-0000-0000-000000000000 + uuid: 2951acd3-28da-4d87-a067-f760a5802ee5 diff --git a/schema/definitions/0.8.0/examples/surface_depth.yml b/schema/definitions/0.8.0/examples/surface_depth.yml index 392f0e000..614df7a76 100644 --- a/schema/definitions/0.8.0/examples/surface_depth.yml +++ b/schema/definitions/0.8.0/examples/surface_depth.yml @@ -172,17 +172,17 @@ masterdata: smda: country: - identifier: Norway - uuid: ad214d85-8a1d-19da-e053-c918a4889309 + uuid: 2951acd3-28da-4d87-a067-f760a5802ee5 discovery: - short_identifier: DROGON - uuid: 00000000-0000-0000-0000-000000000000 # mock uuid for Drogon + uuid: 2951acd3-28da-4d87-a067-f760a5802ee5 # mock uuid for Drogon field: - identifier: DROGON - uuid: 00000000-0000-0000-0000-000000000000 # mock uuid for Drogon + uuid: 2951acd3-28da-4d87-a067-f760a5802ee5 # mock uuid for Drogon coordinate_system: identifier: ST_WGS84_UTM37N_P32637 - uuid: ad214d85-dac7-19da-e053-c918a4889309 + uuid: c5d1511a-98f5-4343-9335-613e1842fa15 stratigraphic_column: identifier: DROGON_2020 - uuid: 00000000-0000-0000-0000-000000000000 # mock uuid for Drogon + uuid: 2951acd3-28da-4d87-a067-f760a5802ee5 # mock uuid for Drogon diff --git a/schema/definitions/0.8.0/examples/surface_faultroom_data.yml b/schema/definitions/0.8.0/examples/surface_faultroom_data.yml index aa3cdef18..3ee360a12 100644 --- a/schema/definitions/0.8.0/examples/surface_faultroom_data.yml +++ b/schema/definitions/0.8.0/examples/surface_faultroom_data.yml @@ -139,16 +139,16 @@ masterdata: smda: coordinate_system: identifier: ST_WGS84_UTM37N_P32637 - uuid: ad214d85-dac7-19da-e053-c918a4889309 + uuid: c5d1511a-98f5-4343-9335-613e1842fa15 country: - identifier: Norway - uuid: ad214d85-8a1d-19da-e053-c918a4889309 + uuid: 2951acd3-28da-4d87-a067-f760a5802ee5 discovery: - short_identifier: DROGON - uuid: ad214d85-8a1d-19da-e053-c918a4889309 + uuid: 2951acd3-28da-4d87-a067-f760a5802ee5 field: - identifier: DROGON - uuid: 00000000-0000-0000-0000-000000000000 + uuid: 2951acd3-28da-4d87-a067-f760a5802ee5 stratigraphic_column: identifier: DROGON_2020 - uuid: ad214d85-8a1d-19da-e053-c918a4889310 + uuid: 2951acd3-28da-4d87-a067-f760a5802ee5 diff --git a/schema/definitions/0.8.0/examples/surface_fluid_contact.yml b/schema/definitions/0.8.0/examples/surface_fluid_contact.yml index b286b52ec..9e8b7da17 100644 --- a/schema/definitions/0.8.0/examples/surface_fluid_contact.yml +++ b/schema/definitions/0.8.0/examples/surface_fluid_contact.yml @@ -173,16 +173,16 @@ masterdata: smda: country: - identifier: Norway - uuid: ad214d85-8a1d-19da-e053-c918a4889309 + uuid: 2951acd3-28da-4d87-a067-f760a5802ee5 discovery: - short_identifier: DROGON - uuid: 00000000-0000-0000-0000-000000000000 # mock uuid for Drogon + uuid: 2951acd3-28da-4d87-a067-f760a5802ee5 # mock uuid for Drogon field: - identifier: DROGON - uuid: 00000000-0000-0000-0000-000000000000 # mock uuid for Drogon + uuid: 2951acd3-28da-4d87-a067-f760a5802ee5 # mock uuid for Drogon coordinate_system: identifier: ST_WGS84_UTM37N_P32637 - uuid: ad214d85-dac7-19da-e053-c918a4889309 + uuid: c5d1511a-98f5-4343-9335-613e1842fa15 stratigraphic_column: identifier: DROGON_2020 - uuid: 00000000-0000-0000-0000-000000000000 # mock uuid for Drogon \ No newline at end of file + uuid: 2951acd3-28da-4d87-a067-f760a5802ee5 # mock uuid for Drogon \ No newline at end of file diff --git a/schema/definitions/0.8.0/examples/surface_seismic_amplitude.yml b/schema/definitions/0.8.0/examples/surface_seismic_amplitude.yml index 388a2dfdb..2322fcf0f 100644 --- a/schema/definitions/0.8.0/examples/surface_seismic_amplitude.yml +++ b/schema/definitions/0.8.0/examples/surface_seismic_amplitude.yml @@ -183,16 +183,16 @@ masterdata: smda: country: - identifier: Norway - uuid: ad214d85-8a1d-19da-e053-c918a4889309 + uuid: 2951acd3-28da-4d87-a067-f760a5802ee5 discovery: - short_identifier: DROGON - uuid: 00000000-0000-0000-0000-000000000000 # mock uuid for Drogon + uuid: 2951acd3-28da-4d87-a067-f760a5802ee5 # mock uuid for Drogon field: - identifier: DROGON - uuid: 00000000-0000-0000-0000-000000000000 # mock uuid for Drogon + uuid: 2951acd3-28da-4d87-a067-f760a5802ee5 # mock uuid for Drogon coordinate_system: identifier: ST_WGS84_UTM37N_P32637 - uuid: ad214d85-dac7-19da-e053-c918a4889309 + uuid: c5d1511a-98f5-4343-9335-613e1842fa15 stratigraphic_column: identifier: DROGON_2020 - uuid: 00000000-0000-0000-0000-000000000000 # mock uuid for Drogon + uuid: 2951acd3-28da-4d87-a067-f760a5802ee5 # mock uuid for Drogon diff --git a/schema/definitions/0.8.0/examples/table_inplace.yml b/schema/definitions/0.8.0/examples/table_inplace.yml index a4d50e8a4..ec420abda 100644 --- a/schema/definitions/0.8.0/examples/table_inplace.yml +++ b/schema/definitions/0.8.0/examples/table_inplace.yml @@ -137,16 +137,16 @@ masterdata: smda: country: - identifier: Norway - uuid: ad214d85-8a1d-19da-e053-c918a4889309 + uuid: 2951acd3-28da-4d87-a067-f760a5802ee5 discovery: - short_identifier: DROGON - uuid: 00000000-0000-0000-0000-000000000000 # mock uuid for Drogon + uuid: 2951acd3-28da-4d87-a067-f760a5802ee5 # mock uuid for Drogon field: - identifier: DROGON - uuid: 00000000-0000-0000-0000-000000000000 # mock uuid for Drogon + uuid: 2951acd3-28da-4d87-a067-f760a5802ee5 # mock uuid for Drogon coordinate_system: identifier: ST_WGS84_UTM37N_P32637 - uuid: ad214d85-dac7-19da-e053-c918a4889309 + uuid: c5d1511a-98f5-4343-9335-613e1842fa15 stratigraphic_column: identifier: DROGON_2020 - uuid: 00000000-0000-0000-0000-000000000000 # mock uuid for Drogon + uuid: 2951acd3-28da-4d87-a067-f760a5802ee5 # mock uuid for Drogon diff --git a/schema/definitions/0.8.0/examples/table_wellpicks.yml b/schema/definitions/0.8.0/examples/table_wellpicks.yml index 375b0cabd..49d4c70df 100644 --- a/schema/definitions/0.8.0/examples/table_wellpicks.yml +++ b/schema/definitions/0.8.0/examples/table_wellpicks.yml @@ -106,16 +106,16 @@ masterdata: smda: country: - identifier: Norway - uuid: ad214d85-8a1d-19da-e053-c918a4889309 + uuid: 2951acd3-28da-4d87-a067-f760a5802ee5 discovery: - short_identifier: DROGON - uuid: 00000000-0000-0000-0000-000000000000 # mock uuid for Drogon + uuid: 2951acd3-28da-4d87-a067-f760a5802ee5 # mock uuid for Drogon field: - identifier: DROGON - uuid: 00000000-0000-0000-0000-000000000000 # mock uuid for Drogon + uuid: 2951acd3-28da-4d87-a067-f760a5802ee5 # mock uuid for Drogon coordinate_system: identifier: ST_WGS84_UTM37N_P32637 - uuid: ad214d85-dac7-19da-e053-c918a4889309 + uuid: c5d1511a-98f5-4343-9335-613e1842fa15 stratigraphic_column: identifier: DROGON_2020 - uuid: 00000000-0000-0000-0000-000000000000 # mock uuid for Drogon + uuid: 2951acd3-28da-4d87-a067-f760a5802ee5 # mock uuid for Drogon diff --git a/schema/definitions/0.8.0/schema/fmu_results.json b/schema/definitions/0.8.0/schema/fmu_results.json index b9bf169f4..6f73d799c 100644 --- a/schema/definitions/0.8.0/schema/fmu_results.json +++ b/schema/definitions/0.8.0/schema/fmu_results.json @@ -71,7 +71,7 @@ "examples": [ "15ce3b84-766f-4c93-9050-b154861f9100" ], - "format": "uuid", + "format": "uuid4", "title": "Id", "type": "string" }, @@ -406,7 +406,7 @@ "examples": [ "15ce3b84-766f-4c93-9050-b154861f9100" ], - "format": "uuid", + "format": "uuid4", "title": "Uuid", "type": "string" } @@ -508,7 +508,7 @@ "examples": [ "15ce3b84-766f-4c93-9050-b154861f9100" ], - "format": "uuid", + "format": "uuid4", "title": "Uuid", "type": "string" } @@ -534,7 +534,7 @@ "examples": [ "15ce3b84-766f-4c93-9050-b154861f9100" ], - "format": "uuid", + "format": "uuid4", "title": "Uuid", "type": "string" } @@ -931,7 +931,7 @@ "examples": [ "15ce3b84-766f-4c93-9050-b154861f9100" ], - "format": "uuid", + "format": "uuid4", "title": "Uuid", "type": "string" } @@ -995,7 +995,7 @@ "id": { "anyOf": [ { - "format": "uuid", + "format": "uuid4", "type": "string" }, { @@ -2111,7 +2111,7 @@ "examples": [ "15ce3b84-766f-4c93-9050-b154861f9100" ], - "format": "uuid", + "format": "uuid4", "title": "Uuid", "type": "string" } @@ -3257,7 +3257,7 @@ "restart_from": { "anyOf": [ { - "format": "uuid", + "format": "uuid4", "type": "string" }, { @@ -3274,7 +3274,7 @@ "examples": [ "15ce3b84-766f-4c93-9050-b154861f9100" ], - "format": "uuid", + "format": "uuid4", "title": "Uuid", "type": "string" } @@ -6046,7 +6046,7 @@ "examples": [ "15ce3b84-766f-4c93-9050-b154861f9100" ], - "format": "uuid", + "format": "uuid4", "title": "Uuid", "type": "string" } @@ -7167,7 +7167,7 @@ "examples": [ "15ce3b84-766f-4c93-9050-b154861f9100" ], - "format": "uuid", + "format": "uuid4", "title": "Uuid", "type": "string" } diff --git a/src/fmu/dataio/_model/fields.py b/src/fmu/dataio/_model/fields.py index ca2ea29d1..44c12b88c 100644 --- a/src/fmu/dataio/_model/fields.py +++ b/src/fmu/dataio/_model/fields.py @@ -14,9 +14,9 @@ Optional, Union, ) -from uuid import UUID from pydantic import ( + UUID4, AwareDatetime, BaseModel, Field, @@ -149,7 +149,7 @@ class Aggregation(BaseModel): performed over an ensemble. """ - id: UUID = Field(examples=["15ce3b84-766f-4c93-9050-b154861f9100"]) + id: UUID4 = Field(examples=["15ce3b84-766f-4c93-9050-b154861f9100"]) """The unique identifier of an aggregation.""" operation: str @@ -203,7 +203,7 @@ class Case(BaseModel): """A block holding information about the user. See :class:`User`.""" - uuid: UUID = Field(examples=["15ce3b84-766f-4c93-9050-b154861f9100"]) + uuid: UUID4 = Field(examples=["15ce3b84-766f-4c93-9050-b154861f9100"]) """The unique identifier of this case. Currently made by fmu.dataio.""" description: Optional[List[str]] = Field(default=None) @@ -222,7 +222,7 @@ class Experiment(BaseModel): """The ``fmu.ert.experiment`` block contains information about the current ert experiment run.""" - id: Optional[UUID] = Field(default=None) + id: Optional[UUID4] = Field(default=None) """The unique identifier of this ert experiment run.""" @@ -240,10 +240,10 @@ class Iteration(BaseModel): """The name of the iteration. This is typically reflecting the folder name on scratch. In ERT, custom names for iterations are supported, e.g. "pred".""" - uuid: UUID = Field(examples=["15ce3b84-766f-4c93-9050-b154861f9100"]) + uuid: UUID4 = Field(examples=["15ce3b84-766f-4c93-9050-b154861f9100"]) """The unique identifier of this case. Currently made by fmu.dataio.""" - restart_from: Optional[UUID] = Field( + restart_from: Optional[UUID4] = Field( default=None, examples=["15ce3b84-766f-4c93-9050-b154861f9100"], ) @@ -293,7 +293,7 @@ class Realization(BaseModel): jobs: Optional[object] = Field(default=None) """Content directly taken from the ERT jobs.json file for this realization.""" - uuid: UUID = Field(examples=["15ce3b84-766f-4c93-9050-b154861f9100"]) + uuid: UUID4 = Field(examples=["15ce3b84-766f-4c93-9050-b154861f9100"]) """The universally unique identifier for this realization. It is a hash of ``fmu.case.uuid`` and ``fmu.iteration.uuid`` and ``fmu.realization.id``.""" @@ -305,7 +305,7 @@ class CountryItem(BaseModel): identifier: str = Field(examples=["Norway"]) """Identifier known to SMDA.""" - uuid: UUID = Field(examples=["15ce3b84-766f-4c93-9050-b154861f9100"]) + uuid: UUID4 = Field(examples=["15ce3b84-766f-4c93-9050-b154861f9100"]) """Identifier known to SMDA.""" @@ -316,7 +316,7 @@ class DiscoveryItem(BaseModel): short_identifier: str = Field(examples=["SomeDiscovery"]) """Identifier known to SMDA.""" - uuid: UUID = Field(examples=["15ce3b84-766f-4c93-9050-b154861f9100"]) + uuid: UUID4 = Field(examples=["15ce3b84-766f-4c93-9050-b154861f9100"]) """Identifier known to SMDA.""" @@ -327,7 +327,7 @@ class FieldItem(BaseModel): identifier: str = Field(examples=["OseFax"]) """Identifier known to SMDA.""" - uuid: UUID = Field(examples=["15ce3b84-766f-4c93-9050-b154861f9100"]) + uuid: UUID4 = Field(examples=["15ce3b84-766f-4c93-9050-b154861f9100"]) """Identifier known to SMDA.""" @@ -338,7 +338,7 @@ class CoordinateSystem(BaseModel): identifier: str = Field(examples=["ST_WGS84_UTM37N_P32637"]) """Identifier known to SMDA.""" - uuid: UUID = Field(examples=["15ce3b84-766f-4c93-9050-b154861f9100"]) + uuid: UUID4 = Field(examples=["15ce3b84-766f-4c93-9050-b154861f9100"]) """Identifier known to SMDA.""" @@ -349,7 +349,7 @@ class StratigraphicColumn(BaseModel): identifier: str = Field(examples=["DROGON_2020"]) """Identifier known to SMDA.""" - uuid: UUID = Field(examples=["15ce3b84-766f-4c93-9050-b154861f9100"]) + uuid: UUID4 = Field(examples=["15ce3b84-766f-4c93-9050-b154861f9100"]) """Identifier known to SMDA.""" diff --git a/src/fmu/dataio/_utils.py b/src/fmu/dataio/_utils.py index 3c36bdf96..ca9065872 100644 --- a/src/fmu/dataio/_utils.py +++ b/src/fmu/dataio/_utils.py @@ -15,6 +15,7 @@ import pandas as pd import xtgeo import yaml +from pydantic import UUID4 from fmu.config import utilities as ut @@ -195,9 +196,9 @@ def size(fname: str) -> int: return Path(fname).stat().st_size -def uuid_from_string(string: str) -> uuid.UUID: - """Produce valid and repeteable UUID4 as a hash of given string""" - return uuid.UUID(hashlib.md5(string.encode("utf-8")).hexdigest()) +def uuid_from_string(string: str) -> UUID4: + """Produce valid and repeatable UUID4 as a hash of given string""" + return uuid.UUID(hashlib.md5(string.encode("utf-8")).hexdigest(), version=4) def read_parameters_txt(pfile: Path | str) -> types.Parameters: diff --git a/src/fmu/dataio/case.py b/src/fmu/dataio/case.py index 5251be398..293e74e4c 100644 --- a/src/fmu/dataio/case.py +++ b/src/fmu/dataio/case.py @@ -7,7 +7,7 @@ from pathlib import Path from typing import ClassVar, Final, Literal, Optional, Union -from pydantic import ValidationError +from pydantic import UUID4, ValidationError from fmu.dataio._model import fields @@ -86,7 +86,7 @@ def _establish_metadata_files(self) -> bool: logger.info("The requested metafile is %s", self._metafile) return not self._metafile.exists() - def _case_uuid(self) -> uuid.UUID: + def _case_uuid(self) -> UUID4: """ Generates and persists a unique UUID for a new case. diff --git a/src/fmu/dataio/providers/_fmu.py b/src/fmu/dataio/providers/_fmu.py index 6f88d933e..5f4907e68 100644 --- a/src/fmu/dataio/providers/_fmu.py +++ b/src/fmu/dataio/providers/_fmu.py @@ -33,9 +33,11 @@ from dataclasses import dataclass, field from enum import Enum, auto from pathlib import Path -from typing import TYPE_CHECKING, Final, Optional, Union +from typing import Final, Optional, Union from warnings import warn +from pydantic import UUID4 + from fmu.config import utilities as ut from fmu.dataio import _utils from fmu.dataio._logging import null_logger @@ -45,9 +47,6 @@ from ._base import Provider -if TYPE_CHECKING: - from uuid import UUID - # case metadata relative to casepath ERT_RELATIVE_CASE_METADATA_FILE: Final = "share/metadata/fmu_case.yml" RESTART_PATH_ENVNAME: Final = "RESTART_FROM_PATH" @@ -205,7 +204,7 @@ def _get_runpath_from_env() -> Path | None: def _get_ert_meta() -> fields.Ert: return fields.Ert( experiment=fields.Experiment( - id=uuid.UUID(FmuEnv.EXPERIMENT_ID.value) + id=uuid.UUID(FmuEnv.EXPERIMENT_ID.value, version=4) if FmuEnv.EXPERIMENT_ID.value else None ) @@ -244,7 +243,7 @@ def _validate_and_establish_casepath(self) -> Path | None: ) return None - def _get_restart_data_uuid(self) -> UUID | None: + def _get_restart_data_uuid(self) -> UUID4 | None: """Load restart_from information""" assert self._runpath is not None logger.debug("Detected a restart run from environment variable") @@ -283,7 +282,7 @@ def _get_ert_parameters(self) -> fields.Parameters | None: # does contains check, will fail. return fields.Parameters(root=_utils.nested_parameters_dict(params)) # type: ignore - def _get_iteration_and_real_uuid(self, case_uuid: UUID) -> tuple[UUID, UUID]: + def _get_iteration_and_real_uuid(self, case_uuid: UUID4) -> tuple[UUID4, UUID4]: iter_uuid = _utils.uuid_from_string(f"{case_uuid}{self._iter_name}") real_uuid = _utils.uuid_from_string(f"{case_uuid}{iter_uuid}{self._real_id}") return iter_uuid, real_uuid @@ -297,7 +296,7 @@ def _get_case_meta(self) -> schema.InternalCaseMetadata: ut.yaml_load(case_metafile, loader="standard") ) - def _get_realization_meta(self, real_uuid: UUID) -> fields.Realization: + def _get_realization_meta(self, real_uuid: UUID4) -> fields.Realization: return fields.Realization( id=self._real_id, name=self._real_name, @@ -305,7 +304,7 @@ def _get_realization_meta(self, real_uuid: UUID) -> fields.Realization: uuid=real_uuid, ) - def _get_iteration_meta(self, iter_uuid: UUID) -> fields.Iteration: + def _get_iteration_meta(self, iter_uuid: UUID4) -> fields.Iteration: return fields.Iteration( id=self._iter_id, name=self._iter_name, diff --git a/tests/conftest.py b/tests/conftest.py index 90788a045..c6f5308e6 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -304,7 +304,7 @@ def fixture_globalconfig1(): country=[ fields.CountryItem( identifier="Norway", - uuid="ad214d85-8a1d-19da-e053-c918a4889309", + uuid="2951acd3-28da-4d87-a067-f760a5802ee5", ), ], discovery=[ diff --git a/tests/data/drogon/ertrun1/share/metadata/fmu_case.yml b/tests/data/drogon/ertrun1/share/metadata/fmu_case.yml index 04d70cf94..7b35c7d7f 100644 --- a/tests/data/drogon/ertrun1/share/metadata/fmu_case.yml +++ b/tests/data/drogon/ertrun1/share/metadata/fmu_case.yml @@ -26,19 +26,19 @@ masterdata: smda: coordinate_system: identifier: ST_WGS84_UTM37N_P32637 - uuid: ad214d85-dac7-19da-e053-c918a4889309 + uuid: c5d1511a-98f5-4343-9335-613e1842fa15 country: - identifier: Norway - uuid: ad214d85-8a1d-19da-e053-c918a4889309 + uuid: 2951acd3-28da-4d87-a067-f760a5802ee5 discovery: - short_identifier: DROGON - uuid: ad214d85-8a1d-19da-e053-c918a4889309 + uuid: 2951acd3-28da-4d87-a067-f760a5802ee5 field: - identifier: DROGON - uuid: 00000000-0000-0000-0000-000000000000 + uuid: 2951acd3-28da-4d87-a067-f760a5802ee5 stratigraphic_column: identifier: DROGON_2020 - uuid: ad214d85-8a1d-19da-e053-c918a4889310 + uuid: 2951acd3-28da-4d87-a067-f760a5802ee5 access: asset: name: Drogon # adding level to make room for unique ID in the future diff --git a/tests/data/drogon/ertrun1_no_iter/share/metadata/fmu_case.yml b/tests/data/drogon/ertrun1_no_iter/share/metadata/fmu_case.yml index 04d70cf94..7b35c7d7f 100644 --- a/tests/data/drogon/ertrun1_no_iter/share/metadata/fmu_case.yml +++ b/tests/data/drogon/ertrun1_no_iter/share/metadata/fmu_case.yml @@ -26,19 +26,19 @@ masterdata: smda: coordinate_system: identifier: ST_WGS84_UTM37N_P32637 - uuid: ad214d85-dac7-19da-e053-c918a4889309 + uuid: c5d1511a-98f5-4343-9335-613e1842fa15 country: - identifier: Norway - uuid: ad214d85-8a1d-19da-e053-c918a4889309 + uuid: 2951acd3-28da-4d87-a067-f760a5802ee5 discovery: - short_identifier: DROGON - uuid: ad214d85-8a1d-19da-e053-c918a4889309 + uuid: 2951acd3-28da-4d87-a067-f760a5802ee5 field: - identifier: DROGON - uuid: 00000000-0000-0000-0000-000000000000 + uuid: 2951acd3-28da-4d87-a067-f760a5802ee5 stratigraphic_column: identifier: DROGON_2020 - uuid: ad214d85-8a1d-19da-e053-c918a4889310 + uuid: 2951acd3-28da-4d87-a067-f760a5802ee5 access: asset: name: Drogon # adding level to make room for unique ID in the future diff --git a/tests/data/drogon/global_config2/global_variables.yml b/tests/data/drogon/global_config2/global_variables.yml index 99b081260..0e54163f4 100644 --- a/tests/data/drogon/global_config2/global_variables.yml +++ b/tests/data/drogon/global_config2/global_variables.yml @@ -6,19 +6,19 @@ masterdata: smda: country: - identifier: Norway - uuid: ad214d85-8a1d-19da-e053-c918a4889309 + uuid: 2951acd3-28da-4d87-a067-f760a5802ee5 discovery: - short_identifier: DROGON - uuid: ad214d85-8a1d-19da-e053-c918a4889309 + uuid: 2951acd3-28da-4d87-a067-f760a5802ee5 field: - identifier: DROGON - uuid: 00000000-0000-0000-0000-000000000000 + uuid: 2951acd3-28da-4d87-a067-f760a5802ee5 coordinate_system: identifier: ST_WGS84_UTM37N_P32637 - uuid: ad214d85-dac7-19da-e053-c918a4889309 + uuid: c5d1511a-98f5-4343-9335-613e1842fa15 stratigraphic_column: identifier: DROGON_2020 - uuid: ad214d85-8a1d-19da-e053-c918a4889310 + uuid: 2951acd3-28da-4d87-a067-f760a5802ee5 access: asset: name: Drogon diff --git a/tests/data/drogon/global_config2/global_variables_norw_letters.yml b/tests/data/drogon/global_config2/global_variables_norw_letters.yml index 06920a966..bbe3e22e9 100644 --- a/tests/data/drogon/global_config2/global_variables_norw_letters.yml +++ b/tests/data/drogon/global_config2/global_variables_norw_letters.yml @@ -3,19 +3,19 @@ masterdata: smda: country: - identifier: Norway - uuid: ad214d85-8a1d-19da-e053-c918a4889309 + uuid: 2951acd3-28da-4d87-a067-f760a5802ee5 discovery: - short_identifier: DROGON - uuid: ad214d85-8a1d-19da-e053-c918a4889309 + uuid: 2951acd3-28da-4d87-a067-f760a5802ee5 field: - identifier: DRÅGØN - uuid: 00000000-0000-0000-0000-000000000000 + uuid: 2951acd3-28da-4d87-a067-f760a5802ee5 coordinate_system: identifier: ST_WGS84_UTM37N_P32637 - uuid: ad214d85-dac7-19da-e053-c918a4889309 + uuid: c5d1511a-98f5-4343-9335-613e1842fa15 stratigraphic_column: identifier: DROGON_2020 - uuid: ad214d85-8a1d-19da-e053-c918a4889310 + uuid: 2951acd3-28da-4d87-a067-f760a5802ee5 access: asset: name: Drogon