From 15716e560ef2c886abd8cab97c8951d69d9f98f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20C=2E=20Riven=C3=A6s?= Date: Mon, 14 Oct 2024 08:53:00 +0200 Subject: [PATCH] BUG, TST: smaller fixes wrt Roxar API --- src/xtgeo/xyz/_xyz_roxapi.py | 10 +++++----- tests/test_roxarapi/test_roxarapi_reek.py | 7 +++++-- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/xtgeo/xyz/_xyz_roxapi.py b/src/xtgeo/xyz/_xyz_roxapi.py index 4ba7c431b..3f8a7376e 100644 --- a/src/xtgeo/xyz/_xyz_roxapi.py +++ b/src/xtgeo/xyz/_xyz_roxapi.py @@ -70,7 +70,7 @@ def _check_input_and_version_requirement( STYPE.WELL_PICKS, ) and not roxutils.version_required("1.6"): raise NotImplementedError( - f"API Support for {stype} is missing in this RMS version " + f"API Support for {stype.value} is missing in this RMS version " f"(current API version is {roxutils.roxversion} - required is 1.6)" ) @@ -80,7 +80,7 @@ def _check_input_and_version_requirement( f"Invalid {category=}. Valid entries are {VALID_WELL_PICK_TYPES}" ) if is_polygons: - raise ValueError(f"Polygons does not support {stype=}.") + raise ValueError(f"Polygons does not support stype={stype.value}.") def _check_presence_in_project( @@ -99,13 +99,13 @@ def _check_presence_in_project( if stype in [STYPE.HORIZONS, STYPE.ZONES, STYPE.FAULTS]: if name not in project_attr: - raise ValueError(f"Cannot access {name=} in {stype}") + raise ValueError(f"Cannot access {name=} in {stype.value}") if category is None: raise ValueError("Need to specify category for horizons, zones and faults") if isinstance(category, list) or category not in project_attr.representations: - raise ValueError(f"Cannot access {category=} in {stype}") + raise ValueError(f"Cannot access {category=} in {stype.value}") if mode == "get" and project_attr[name][category].is_empty(): - raise RuntimeError(f"'{name}' is empty for {stype} {category=}") + raise RuntimeError(f"'{name}' is empty for {stype.value} {category=}") # only need to check presence in clipboard/general2d_data/well_picks if mode = get. if mode == "get": diff --git a/tests/test_roxarapi/test_roxarapi_reek.py b/tests/test_roxarapi/test_roxarapi_reek.py index fb17ca311..14e29b57c 100644 --- a/tests/test_roxarapi/test_roxarapi_reek.py +++ b/tests/test_roxarapi/test_roxarapi_reek.py @@ -454,14 +454,17 @@ def test_rox_get_gridproperty(rms_project_path): def test_rox_get_modify_set_gridproperty(rms_project_path): """Get and set a grid property from a RMS project.""" poro = xtgeo.gridproperty_from_roxar(rms_project_path, GRIDNAME1, PORONAME1) + cell_value = poro.values[1, 0, 0] adder = 0.9 poro.values = poro.values + adder poro.to_roxar(rms_project_path, GRIDNAME1, PORONAME1 + "_NEW") - poro.from_roxar(rms_project_path, GRIDNAME1, PORONAME1 + "_NEW") - assert poro.values[1, 0, 0] == pytest.approx(0.14942 + adder, abs=0.0001) + poronew = xtgeo.gridproperty_from_roxar( + rms_project_path, GRIDNAME1, PORONAME1 + "_NEW" + ) + assert poronew.values[1, 0, 0] == pytest.approx(cell_value + adder, abs=0.0001) @pytest.mark.requires_roxar