Example #1
0
from __future__ import division, absolute_import
from __future__ import print_function

import numpy as np

import xtgeo
import xtgeo.cxtgeo.cxtgeo as _cxtgeo
from xtgeo.common import XTGeoDialog
from xtgeo.grid3d import _gridprop_lowlevel

xtg = XTGeoDialog()

logger = xtg.functionlogger(__name__)

_cxtgeo.xtg_verbose_file("NONE")
XTGDEBUG = xtg.get_syslevel()

# self = RegularSurface instance!
# pylint: disable=protected-access


def slice_grid3d(self, grid, prop, zsurf=None, sbuffer=1):
    """Private function for the Grid3D slicing."""

    if zsurf is not None:
        other = zsurf
    else:
        logger.info('The current surface is copied as "other"')
        other = self.copy()
    if not self.compare_topology(other, strict=False):
        raise RuntimeError("Topology of maps differ. Stop!")
Example #2
0
"""Some common XTGEO calculation routines."""

import numpy as np
import xtgeo.cxtgeo.cxtgeo as _cxtgeo

from xtgeo.common import XTGeoDialog

xtg = XTGeoDialog()

logger = xtg.functionlogger(__name__)

DBG = xtg.get_syslevel()


def ib_to_ijk(ib, nx, ny, nz, ibbase=0):
    """Convert a 1D index (starting from ibbase) to cell indices I J K.

    Returns I J K as a tuple.
    """

    logger.info("IB to IJK")

    ip = _cxtgeo.new_intpointer()
    jp = _cxtgeo.new_intpointer()
    kp = _cxtgeo.new_intpointer()

    _cxtgeo.x_ib2ijk(ib, ip, jp, kp, nx, ny, nz, ibbase)

    i = _cxtgeo.intpointer_value(ip)
    j = _cxtgeo.intpointer_value(jp)
    k = _cxtgeo.intpointer_value(kp)