Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def fixture_loadwells1():
logger.info("Load well 1")
wlist = []
for wfile in glob.glob(WFILES):
wlist.append(Well(wfile))
return wlist
def test_report_zlog_mismatch():
"""Report zone log mismatch grid and well."""
g1 = Grid()
g1.from_file(GRIDFILE)
zo = GridProperty()
zo.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)
wells = [w1, w2, w3, w4, w5, w6, w7]
for wll in wells:
response = g1.report_zone_mismatch(
well=wll,
zonelogname="Zonelog",
zoneprop=zo,
zonelogrange=(1, 3),
depthrange=[1300, 9999],
def test_get_polygons_one_well():
"""Import a well and get the polygon segments"""
wlist = []
for w in glob.glob(wfiles1):
wlist.append(Well(w, zonelogname='Zonelog'))
logger.info('Imported well {}'.format(w))
mypoly = Polygons()
nwell = mypoly.from_wells(wlist, 2)
print(mypoly.dataframe)
logger.info('Number of well made to tops: {}'.format(nwell))
mypoly.to_file('TMP/poly_w1.irapasc')
g2 = Grid()
g2.from_file('../xtgeo-testdata/3dgrids/gfb/gullfaks2.roff')
g2.reduce_to_one_layer()
z = GridProperty()
z.from_file('../xtgeo-testdata/3dgrids/gfb/gullfaks2_zone.roff',
name='Zone')
# w1 = Well()
# w1.from_file('../xtgeo-testdata/wells/gfb/1/34_10-A-42.w')
w2 = Well('../xtgeo-testdata/wells/gfb/1/34_10-1.w')
w3 = Well('../xtgeo-testdata/wells/gfb/1/34_10-B-21_B.w')
wells = [w2, w3]
for w in wells:
response = g1.report_zone_mismatch(
well=w, zonelogname='ZONELOG', mode=0, zoneprop=z,
onelayergrid=g2, zonelogrange=[0, 19], option=0,
depthrange=[1700, 9999])
if response is None:
continue
else:
logger.info(response)
# if w.wellname == w1.wellname:
# match = float("{0:.2f}".format(response[0]))
# .logger.info(match)
def test_import_well_selected_logs():
"""Import a well but restrict on lognames"""
mywell = Well()
mywell.from_file(WELL1, lognames="all")
assert "ZONELOG" in mywell.dataframe
mywell.from_file(WELL1, lognames="GR")
assert "ZONELOG" not in mywell.dataframe
mywell.from_file(WELL1, lognames=["GR"])
assert "ZONELOG" not in mywell.dataframe
mywell.from_file(WELL1, lognames=["DUMMY"])
assert "ZONELOG" not in mywell.dataframe
assert "GR" not in mywell.dataframe
with pytest.raises(ValueError) as msg:
logger.info(msg)
mywell.from_file(WELL1, lognames=["DUMMY"], lognames_strict=True)
def test_getwell_all_logs():
"""Get a well from a RMS project, reading all logs present."""
print(roxv)
if not os.path.isdir(PROJ[roxv]):
raise RuntimeError('RMS test project is missing for roxar version {}'
.format(roxv))
logger.info('Simple case, reading a well from RMS well folder')
xwell = xtgeo.well.Well()
xwell.from_roxar(PROJ[roxv], 'WI_3_RKB2',
trajectory='Drilled trajectory',
logrun='LOG', lognames='all')
logger.info('Dataframe\n %s ', xwell.dataframe)
df = xwell.dataframe
tsetup.assert_almostequal(df.Poro.mean(), 0.191911, 0.001)
tsetup.assert_equal(xwell.nrow, 10081, 'NROW of well')
tsetup.assert_equal(xwell.rkb, -10, 'RKB of well')
xwell.to_file(join(TMPD, 'roxwell_export.rmswell'))
def test_remove_parallel_parts():
"""Remove the part of the well thst is parallel with some other"""
well1 = Well(WELL1)
well2 = Well(WELL2)
well1.truncate_parallel_path(well2)
print(well1.dataframe)
wells.
Example:
Here the from_file method is used to initiate the object
directly::
>>> mywells = Wells(['31_2-6.w', '31_2-7.w', '31_2-8.w'])
"""
if not append:
self._wells = []
# file checks are done within the Well() class
for wfile in filelist:
try:
wll = xtgeo.well.Well(wfile, fformat=fformat,
mdlogname=mdlogname,
zonelogname=zonelogname,
strict=strict)
self._wells.append(wll)
except ValueError as err:
xtg.warn('SKIP this well: {}'.format(err))
continue
if not self._wells:
xtg.warn('No wells imported!')
def load_well(well_name):
return xtgeo.well.Well(well_name)