def import_irap_ascii(self, mfile): """Import Irap ascii format.""" # version using swig type mapping logger.debug("Enter function...") # need to call the C function... _cxtgeo.xtg_verbose_file("NONE") # read with mode 0, scan to get mx my xlist = _cxtgeo.surf_import_irap_ascii(mfile, 0, 1, 0, DEBUG) nvn = xlist[1] * xlist[2] # mx * my xlist = _cxtgeo.surf_import_irap_ascii(mfile, 1, nvn, 0, DEBUG) ier, ncol, nrow, _ndef, xori, yori, xinc, yinc, rot, val = xlist if ier != 0: raise RuntimeError("Problem in {}, code {}".format(__name__, ier)) val = np.reshape(val, (ncol, nrow), order="C") val = ma.masked_greater(val, _cxtgeo.UNDEF_LIMIT) if np.isnan(val).any(): logger.info("NaN values are found, will mask...") val = ma.masked_invalid(val) yflip = 1 if yinc < 0.0: yinc = yinc * -1 yflip = -1 self._ncol = ncol self._nrow = nrow self._xori = xori self._yori = yori self._xinc = xinc self._yinc = yinc self._yflip = yflip self._rotation = rot self._values = val self._filesrc = mfile self._ilines = np.array(range(1, ncol + 1), dtype=np.int32) self._xlines = np.array(range(1, nrow + 1), dtype=np.int32)
def vectorinfo2(x1, x2, y1, y2, option=1): """ Get length and angles from 2 points in space (2D plane). Option = 1 gives normal school angle (counterclock from X) """ _cxtgeo.xtg_verbose_file("NONE") lenp = _cxtgeo.new_doublepointer() radp = _cxtgeo.new_doublepointer() degp = _cxtgeo.new_doublepointer() _cxtgeo.x_vector_info2(x1, x2, y1, y2, lenp, radp, degp, option, DBG) llen = _cxtgeo.doublepointer_value(lenp) rad = _cxtgeo.doublepointer_value(radp) deg = _cxtgeo.doublepointer_value(degp) return llen, rad, deg
"""Regular surface vs Grid3D""" 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):