Skip to content

ENH: Add ResInsight interface to regular surface - #1

Draft
alifbe wants to merge 1 commit into
mainfrom
ri-surfaces
Draft

ENH: Add ResInsight interface to regular surface#1
alifbe wants to merge 1 commit into
mainfrom
ri-surfaces

Conversation

@alifbe

@alifbe alifbe commented Sep 4, 2026

Copy link
Copy Markdown
Owner

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 requires replace=True since view settings are lost.

Implementation

  • New interfaces/resinsight/_regular_surface.py: RegularSurfaceDataResInsight container plus RegularSurfaceReader / RegularSurfaceWriter, following the _grid_property.py pattern.
  • _resinsight_base.py: shared select_by_name() and resolve_folder() helpers (reusable for polygons / triangulated surfaces) and ReplaceRequiredError; resolve_case() now reuses select_by_name().
  • _rips_package.py: expose NameConflictPolicy.
  • Docs: docs/getting_started.rst usage examples, docs/api-surface.rst autofunction 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.
  • Full tests/test_interfaces/test_resinsight suite: 98 passed against a live ResInsight instance; ruff check/format clean.

Draft PR on the fork for experimentation before proposing upstream.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant