Skip to content

Commit

Permalink
BUG, TST: smaller fixes wrt Roxar API
Browse files Browse the repository at this point in the history
  • Loading branch information
jcrivenaes committed Oct 14, 2024
1 parent 96fb83a commit 15716e5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
10 changes: 5 additions & 5 deletions src/xtgeo/xyz/_xyz_roxapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)"
)

Expand All @@ -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(
Expand All @@ -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":
Expand Down
7 changes: 5 additions & 2 deletions tests/test_roxarapi/test_roxarapi_reek.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 15716e5

Please sign in to comment.