Skip to content

Commit

Permalink
CLN: minor linting and code improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
jcrivenaes committed Oct 11, 2023
1 parent e347375 commit 5412611
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/xtgeo/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ def _xprint(msg):
#
_xprint("Import matplotlib etc...DONE")

from xtgeo.common import XTGeoDialog
from xtgeo.common.constants import UNDEF, UNDEF_INT, UNDEF_INT_LIMIT, UNDEF_LIMIT
from xtgeo.common.exceptions import (
BlockedWellsNotFoundError,
Expand All @@ -89,7 +90,6 @@ def _xprint(msg):
WellNotFoundError,
)
from xtgeo.common.sys import _XTGeoFile
from xtgeo.common.xtgeo_dialog import XTGeoDialog
from xtgeo.cxtgeo._cxtgeo import XTGeoCLibError

_xprint("Import common... done")
Expand Down
3 changes: 2 additions & 1 deletion src/xtgeo/grid3d/_grid_etc1.py
Original file line number Diff line number Diff line change
Expand Up @@ -839,7 +839,8 @@ def _get_geometrics_v2(self, allcells=False, cellcenter=True, return_dict=False)
y1 = ycor.values[self.ncol - 1, midcol, midlay]
glist.append(degrees(atan2(y1 - y0, x1 - x0)))

dx, dy = self.get_dxdy(asmasked=False)
dx = self.get_dx(asmasked=False)
dy = self.get_dy(asmasked=False)
dz = self.get_dz(asmasked=False)
glist.append(dx.values.mean())
glist.append(dy.values.mean())
Expand Down
8 changes: 5 additions & 3 deletions src/xtgeo/grid3d/_grid_wellzone.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,19 @@ def report_zone_mismatch(

# get the IJK along the well as logs; use a copy of the well instance
wll = well.copy()
wll._df[zonelogname] += zonelogshift
wll.dataframe[zonelogname] += zonelogshift

if depthrange:
d1, d2 = depthrange
wll._df = wll._df[(d1 < wll._df.Z_TVDSS) & (wll._df.Z_TVDSS < d2)]
wll.dataframe = wll.dataframe[
(d1 < wll.dataframe.Z_TVDSS) & (wll.dataframe.Z_TVDSS < d2)
]

wll.get_gridproperties(zoneprop, self)
zmodel = zoneprop.name + "_model"

# from here, work with the dataframe only
df = wll._df
df = wll.dataframe

# zonelogrange
z1, z2 = zonelogrange
Expand Down
4 changes: 2 additions & 2 deletions tests/test_grid3d/test_grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def test_create_shoebox(tmp_path):
)
logger.info("Making a a 1,8 mill cell grid took %5.3f secs", xtg.timer(timer1))

dx, dy = grd.get_dxdy()
dx, dy = (grd.get_dx(), grd.get_dy())

assert dx.values.mean() == pytest.approx(20.0, abs=0.0001)
assert dy.values.mean() == pytest.approx(20.0, abs=0.0001)
Expand Down Expand Up @@ -139,7 +139,7 @@ def test_emerald_grid_values(emerald_grid):
dzval = dzv.values
mydz = float(dzval[31:32, 72:73, 0:1])
assert mydz == pytest.approx(2.761, abs=0.001), "Grid DZ Emerald"
dxv, dyv = emerald_grid.get_dxdy()
dxv, dyv = (emerald_grid.get_dx(), emerald_grid.get_dy())

mydx = float(dxv.values3d[31:32, 72:73, 0:1])
mydy = float(dyv.values3d[31:32, 72:73, 0:1])
Expand Down
15 changes: 7 additions & 8 deletions tests/test_grid3d/test_grid_vs_well.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

import xtgeo
from xtgeo.common import XTGeoDialog
from xtgeo.well import Well

xtg = XTGeoDialog()
logger = xtg.basiclogger(__name__)
Expand Down Expand Up @@ -66,13 +65,13 @@ def test_report_zlog_mismatch():

zo = xtgeo.gridproperty_from_file(ZONEFILE, name="Zone")

w1 = Well(WELL1)
w2 = Well(WELL2)
w3 = Well(WELL3)
w4 = Well(WELL4)
w5 = Well(WELL5)
w6 = Well(WELL6)
w7 = Well(WELL7)
w1 = xtgeo.well_from_file(WELL1)
w2 = xtgeo.well_from_file(WELL2)
w3 = xtgeo.well_from_file(WELL3)
w4 = xtgeo.well_from_file(WELL4)
w5 = xtgeo.well_from_file(WELL5)
w6 = xtgeo.well_from_file(WELL6)
w7 = xtgeo.well_from_file(WELL7)

wells = [w1, w2, w3, w4, w5, w6, w7]

Expand Down

0 comments on commit 5412611

Please sign in to comment.