diff --git a/docs/explorer.rst b/docs/explorer.rst index 133421c3..66072079 100644 --- a/docs/explorer.rst +++ b/docs/explorer.rst @@ -223,6 +223,12 @@ The `SurfaceCollection` object has a filter method and properties for getting fi surfaces = case.surfaces.filter(iteration="iter-0") + contents = surfaces.contents + + surfaces = surfaces.filter( + content=contents[0] + ) + names = surfaces.names surfaces = surfaces.filter( @@ -243,7 +249,8 @@ The `SurfaceCollection.filter` method takes the following parameters: * uuid * name -* tagname +* tagname +* content * dataformat * iteration * realization @@ -280,7 +287,8 @@ Example: get aggregated surfaces We can get list of filter values for the following properties: * names -* tagnames +* contents +* tagnames * dataformats * iterations * realizations @@ -304,6 +312,7 @@ Once we have a `Surface` object we can get surface metadata using properties: surface = case.surfaces[0] + print(surface.content) print(surface.uuid) print(surface.name) print(surface.tagname) @@ -485,6 +494,7 @@ The `SurfaceCollection` class can be used to do on-demand surface aggregations. surfaces = case.surfaces.filter( stage="realization", + content="depth", iteration="iter-0", name="Valysar Fm.", tagname="FACIES_Fraction_Channel" diff --git a/examples/explorer.ipynb b/examples/explorer.ipynb index 2d4680ce..bf88811f 100644 --- a/examples/explorer.ipynb +++ b/examples/explorer.ipynb @@ -112,6 +112,12 @@ "# Filter on iteration\n", "surfs = surfs.filter(iteration=\"iter-0\")\n", "\n", + "# Get available contents\n", + "print(\"Contents:\", surfs.contents)\n", + "\n", + "# Filter on content\n", + "surfs = surfs.filter(content=\"depth\")\n", + "\n", "# Get available names\n", "print(\"Names:\", surfs.names)\n", "\n", @@ -136,18 +142,18 @@ " print(\"Format:\", surf.dataformat)\n", " print(\"Realization:\", surf.realization)\n", "\n", - "# Select surface instance\n", + "# Select one surface instance\n", "surf = surfs[0]\n", "\n", "print(\"\\nSelected surface:\")\n", - "print(\"ID:\", surf.uuid)\n", + "print(\"Uuid:\", surf.uuid)\n", "print(\"Name:\", surf.name)\n", + "print(\"Content:\", surf.content)\n", "print(\"Tagname:\", surf.tagname)\n", "print(\"Format:\", surf.dataformat)\n", "print(\"Iteration:\", surf.iteration)\n", "print(\"Realization:\", surf.realization)\n", - "print(\"stratigraphic\", surf.stratigraphic)\n", - "print(\"vertical domain\", surf.vertical_domain)\n", + "print(\"vertical domain:\", surf.vertical_domain)\n", "\n", "# xtgeo.RegularSurface\n", "reg_surf = surf.to_regular_surface()\n", diff --git a/src/fmu/sumo/explorer/objects/_child.py b/src/fmu/sumo/explorer/objects/_child.py index 40d944f7..9d55b3ff 100644 --- a/src/fmu/sumo/explorer/objects/_child.py +++ b/src/fmu/sumo/explorer/objects/_child.py @@ -24,6 +24,11 @@ def name(self) -> str: """Object name""" return self._get_property(["data", "name"]) + @property + def content(self) -> str: + """Content""" + return self._get_property(["data", "content"]) + @property def tagname(self) -> str: """Object tagname""" diff --git a/tests/test_explorer.py b/tests/test_explorer.py index d786fe10..984ca6fa 100644 --- a/tests/test_explorer.py +++ b/tests/test_explorer.py @@ -238,6 +238,13 @@ def test_case_surfaces_filter(test_case: Case): assert surf.iteration == "iter-0" assert surf.name == "Valysar Fm." + # filter on content + non_valid_content_surfs = real_surfs.filter(content="___not_valid") + assert len(non_valid_content_surfs) == 0 + + real_surfs = real_surfs.filter(content="depth") + assert len(real_surfs) == 56 + # filter on tagname non_valid_tagname_surfs = real_surfs.filter(tagname="___not_valid") assert len(non_valid_tagname_surfs) == 0