ENH: Add ResInsight interface to regular surface - #1
Draft
alifbe wants to merge 1 commit into
Draft
Conversation
Add xtgeo.regular_surface_from_resinsight() and RegularSurface.to_resinsight() so regular surfaces can be read from and written to a running ResInsight session over rips, mirroring the existing grid and grid property interfaces. The interface targets rips 2026.06, where surface and folder names are unique within their parent folder. Folders are addressed by a '/'-separated path and created on demand, and name conflicts are delegated to ResInsight through on_name_conflict. Writing to an existing surface updates the property in place when the geometry matches, which keeps view settings intact and allows several properties to be written to the same surface; recreating a surface whose geometry differs is destructive and therefore requires replace=True. The generic folder lookup, named item selection and the replace error live in _resinsight_base so the upcoming polygon interface can reuse them.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a ResInsight (rips) interface for
RegularSurface, mirroring the existing grid and grid-property interfaces.Public API
xtgeo.regular_surface_from_resinsight(instance_or_port, surface_name, property_name=None, folder_name="")RegularSurface.to_resinsight(instance_or_port, surface_name, folder_name="", property_name="Depth", set_as_depth=True, replace=False)Surface names are unique per ResInsight folder, so name +
/-separated folder path identify exactly one surface (lookup is not recursive). Missing folders are created on write. An existing surface with matching geometry is updated in place; a differing geometry must be deleted and recreated, which requiresreplace=Truesince view settings are lost.Implementation
interfaces/resinsight/_regular_surface.py:RegularSurfaceDataResInsightcontainer plusRegularSurfaceReader/RegularSurfaceWriter, following the_grid_property.pypattern._resinsight_base.py: sharedselect_by_name()andresolve_folder()helpers (reusable for polygons / triangulated surfaces) andReplaceRequiredError;resolve_case()now reusesselect_by_name()._rips_package.py: exposeNameConflictPolicy.docs/getting_started.rstusage examples,docs/api-surface.rstautofunction entry.Triangulated-surface support is intentionally left out and will follow separately.
Testing
tests/test_interfaces/test_resinsight/test_resinsight_regular_surface.py— reader/writer and data-container unit tests.tests/test_interfaces/test_resinsight/test_regular_surface_public_api.py— end-to-end public API tests.tests/test_interfaces/test_resinsightsuite: 98 passed against a live ResInsight instance; ruff check/format clean.Draft PR on the fork for experimentation before proposing upstream.