equinor/xtgeo

Add functionality to write surfaces to the trends folder in RMS

Opened this issue · 0 comments

From RMS v.14.2 the rmsapi supports writing surfaces to the trends folder.

This enables the removal of the workaround here

elif stype == "trends":
if name not in proj.trends.surfaces:
logger.info("Name %s is not present in trends", name)
raise ValueError(
f"Name {name} is not within Trends (it must exist in advance!)"
)
# here a workound; trends.surfaces are read-only in Roxar API, but is seems
# that load() in RMS is an (undocumented?) workaround...
try:
import roxar
except ImportError as err:
raise ImportError(
"roxar not available, this functionality is not available"
) from err
roxsurf = proj.trends.surfaces[name]
with tempfile.TemporaryDirectory() as tmpdir:
logger.info("Made a tmp folder: %s", tmpdir)
self.to_file(os.path.join(tmpdir, "gxx.gri"), fformat="irap_binary")
roxsurf.load(os.path.join(tmpdir, "gxx.gri"), roxar.FileFormat.ROXAR_BINARY)