Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
# -*- coding: utf-8 -*-
from os.path import join
import pytest
import xtgeo
xtg = xtgeo.common.XTGeoDialog()
logger = xtg.basiclogger(__name__)
if not xtg.testsetup():
raise SystemExit("Cannot find test setup")
TMD = xtg.tmpdir
TPATH = xtg.testpath
SFILE1 = join(TPATH, "cubes/etc/ib_synth_iainb.segy")
# ======================================================================================
# This is a a set of tests towards a synthetic small cube made by I Bush in order to
# test all attributes in detail
# ======================================================================================
# coding: utf-8
from __future__ import division, absolute_import
from __future__ import print_function
import math
from os.path import join
import numpy as np
import xtgeo
import test_common.test_xtg as tsetup
xtg = xtgeo.common.XTGeoDialog()
logger = xtg.basiclogger(__name__)
if not xtg.testsetup():
raise SystemExit
TMPD = xtg.tmpdir
TESTPATH = xtg.testpath
# =============================================================================
# Do tests
# =============================================================================
TESTSET1A = "../xtgeo-testdata/surfaces/reek/1/topreek_rota.gri"
TESTSET1B = "../xtgeo-testdata/surfaces/reek/1/basereek_rota.gri"
TESTSETG1 = "../xtgeo-testdata/3dgrids/reek/reek_geo_grid.roff"
# coding: utf-8
from __future__ import division, absolute_import
from __future__ import print_function
import os
import xtgeo
import test_common.test_xtg as tsetup
xtg = xtgeo.common.XTGeoDialog()
logger = xtg.basiclogger(__name__)
if not xtg.testsetup():
raise SystemExit
TMPDIR = xtg.tmpdir
TESTPATH = xtg.testpath
XTGSHOW = False
if "XTG_SHOW" in os.environ:
XTGSHOW = True
REEKROOT = "../xtgeo-testdata/3dgrids/reek/REEK"
WELL1 = "../xtgeo-testdata/wells/reek/1/OP_1.w"
FENCE1 = "../xtgeo-testdata/polygons/reek/1/fence.pol"
FENCE2 = "../xtgeo-testdata/polygons/reek/1/minifence.pol"
"""GridProperty (not GridProperies) some etc functions"""
# from ._gridprop_import_eclrun import import_eclbinary
# --> INIT, UNRST
#
# from ._gridprop_import_grdecl import import_grdecl_prop, import_bgrdecl_prop
# --> ASCII and BINARY GRDECL format
# from ._gridprop_import_roff import import_roff
# --> BINARY ROFF format
from __future__ import print_function, absolute_import
import numpy as np
import xtgeo
xtg = xtgeo.common.XTGeoDialog()
logger = xtg.functionlogger(__name__)
def gridproperty_fromgrid(self, grid, linkgeometry=False):
"""Make an simple GridProperty instance directly based on an existing grid.
Args:
grid (Grid): The grid geometry instance
linkgeometry (bool): If True, connect the property.geometry to the input grid
Example::
import xtgeo
grd = xtgeo.grid_from_file("my.roff")
myporo = xtgeo.GridProperty(grd, name="PORO")
# -*- coding: utf-8 -*-
"""The surfaces module, which has the Surfaces class (collection of surface objects)"""
from __future__ import division, absolute_import
from __future__ import print_function
import numpy as np
import xtgeo
from . import _surfs_import
xtg = xtgeo.common.XTGeoDialog()
logger = xtg.functionlogger(__name__)
class Surfaces(object):
"""Class for a collection of Surface objects, for operations that involves
a number of surfaces, such as statistical numbers.
A collection of surfaces can be different things:
* A list if surfaces in stratigraphic order
* A collection of different realisations of the same surface
* A collection of isochores
Args:
input (list, optional): A list of XTGeo objects and/or file names)
subtype (str): "tops", "isochores", or None (default)
import copy
from types import FunctionType
import numpy as np
import xtgeo
from ._grid3d import Grid3D
from . import _gridprop_etc
from . import _gridprop_op1
from . import _gridprop_import
from . import _gridprop_roxapi
from . import _gridprop_export
from . import _gridprop_lowlevel
xtg = xtgeo.common.XTGeoDialog()
logger = xtg.functionlogger(__name__)
# -----------------------------------------------------------------------------
# Comment on 'asmasked' vs 'activeonly:
#
# 'asmasked'=True will return a np.ma array, while 'asmasked' = False will
# return a np.ndarray
#
# The 'activeonly' will filter out masked entries, or use None or np.nan
# if 'activeonly' is False.
#
# Use word 'zerobased' for a bool regrading startcell basis is 1 or 0
#
# For functions with mask=... ,they should be replaced with asmasked=...
# -----------------------------------------------------------------------------
"""Private module, Grid Import private functions for ROFF format"""
from __future__ import print_function, absolute_import
from collections import OrderedDict
import numpy as np
import xtgeo.cxtgeo._cxtgeo as _cxtgeo
import xtgeo
from ._gridprop_import_roff import _rkwquery, _rkwxlist, _rkwxvec
from . import _grid3d_utils as utils
xtg = xtgeo.common.XTGeoDialog()
logger = xtg.functionlogger(__name__)
def import_roff(self, gfile):
gfile.get_cfhandle()
_import_roff(self, gfile)
gfile.cfclose()
def _import_roff(self, gfile):
"""Import ROFF format, version 2 (improved version)"""
"""Private module for grid vs well zonelog checks"""
from __future__ import print_function, absolute_import, division
import numpy as np
import xtgeo
xtg = xtgeo.common.XTGeoDialog()
logger = xtg.functionlogger(__name__)
def report_zone_mismatch(
self,
well=None,
zonelogname="ZONELOG",
zoneprop=None,
onelayergrid=None, # redundant; will be computed internally
zonelogrange=(0, 9999),
zonelogshift=0,
depthrange=None,
perflogname=None,
filterlogname=None,
resultformat=1,
"""Generic function to import ECL binary records for EGRID, INIT etc"""
from __future__ import print_function, absolute_import
import numpy as np
import xtgeo
import xtgeo.cxtgeo._cxtgeo as _cxtgeo
xtg = xtgeo.common.XTGeoDialog()
logger = xtg.functionlogger(__name__)
def eclbin_record(gfile, kwname, kwlen, kwtype, kwbyte):
# generic: read a single binary Eclipse record via cxtgeo
ilen = flen = dlen = 1
if kwtype == "INTE":
ilen = kwlen
kwntype = 1
elif kwtype == "REAL":
flen = kwlen
kwntype = 2
elif kwtype == "DOUB":