Skip to content

Commit

Permalink
BUG: add realisation in blockedwell_from_roxar()
Browse files Browse the repository at this point in the history
  • Loading branch information
jcrivenaes committed Aug 24, 2023
1 parent 8b7038e commit 0e2ee18
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 10 deletions.
14 changes: 7 additions & 7 deletions src/xtgeo/well/_blockedwell_roxapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def _roxapi_import_bwell(
else:
raise ValueError(f"No such blocked well set: {bwname}")

if wname in bwset.get_well_names():
if wname in bwset.get_well_names(realisation=realisation):
self._wname = wname
else:
raise WellNotFoundError(f"No such well in blocked well set: {wname}")
Expand All @@ -79,8 +79,8 @@ def _roxapi_import_bwell(
bwprops = [item for item in bwset.properties]
bwnames = [item.name for item in bwset.properties]

bw_cellindices = bwset.get_cell_numbers()
dind = bwset.get_data_indices([wname])
bw_cellindices = bwset.get_cell_numbers(realisation=realisation)
dind = bwset.get_data_indices([wname], realisation=realisation)

cind = bw_cellindices[dind]
xyz = np.transpose(gmodel.get_grid(realisation=realisation).get_cell_centers(cind))
Expand Down Expand Up @@ -154,15 +154,15 @@ def _roxapi_export_bwell(
else:
raise ValueError(f"No such blocked well set: {bwname}")

if wname in bwset.get_well_names():
if wname in bwset.get_well_names(realisation=realisation):
self._wname = wname
else:
raise WellNotFoundError(f"No such well in blocked well set: {wname}")

bwnames = [item.name for item in bwset.properties]

# get the current indices for the well
dind = bwset.get_data_indices([self._wname])
dind = bwset.get_data_indices([self._wname], realisation=realisation)

for lname in self.lognames:
if not ijk and "_INDEX" in lname:
Expand Down Expand Up @@ -190,7 +190,7 @@ def _roxapi_export_bwell(
bwprop = bwlog.get_values(realisation=realisation)

usedtype = bwprop.dtype
dind = bwset.get_data_indices([self._wname])
dind = bwset.get_data_indices([self._wname], realisation=realisation)

if self.dataframe[lname].values.size != dind.size:
raise ValueError(
Expand All @@ -202,4 +202,4 @@ def _roxapi_export_bwell(
)

bwprop[dind] = maskedvalues
bwlog.set_values(bwprop)
bwlog.set_values(bwprop, realisation=realisation)
24 changes: 21 additions & 3 deletions src/xtgeo/well/blocked_well.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@


import deprecation
import pandas as pd

import xtgeo

from . import _blockedwell_roxapi
Expand Down Expand Up @@ -45,7 +47,9 @@ def blockedwell_from_file(
# return obj


def blockedwell_from_roxar(project, gname, bwname, wname, lognames=None, ijk=True):
def blockedwell_from_roxar(
project, gname, bwname, wname, lognames=None, ijk=True, realisation=0
):
"""This makes an instance of a BlockedWell directly from Roxar RMS.
For arguments, see :meth:`BlockedWell.from_roxar`.
Expand All @@ -60,9 +64,23 @@ def blockedwell_from_roxar(project, gname, bwname, wname, lognames=None, ijk=Tru
"""

obj = BlockedWell()
# TODO: replace this with proper class method
obj = BlockedWell(
*([0.0] * 3), "", pd.DataFrame({"X_UTME": [], "Y_UTMN": [], "Z_TVDSS": []})
)

_blockedwell_roxapi.import_bwell_roxapi(
obj,
project,
gname,
bwname,
wname,
lognames=lognames,
ijk=ijk,
realisation=realisation,
)

obj.from_roxar(project, gname, bwname, wname, ijk=ijk, lognames=lognames)
obj._ensure_consistency()

return obj

Expand Down

0 comments on commit 0e2ee18

Please sign in to comment.