def get_xyz_cell_corners(self, ijk=(1, 1, 1), activeonly=True, zerobased=False): """Get X Y Z cell corners for one cell.""" i, j, k = ijk shift = 0 if zerobased: shift = 1 if activeonly: actnum = self.get_actnum() iact = actnum.values3d[i - 1 + shift, j - 1 + shift, k - 1 + shift] if iact == 0: return None pcorners = _cxtgeo.new_doublearray(24) _cxtgeo.grd3d_corners( i + shift, j + shift, k + shift, self.ncol, self.nrow, self.nlay, self._p_coord_v, self._p_zcorn_v, pcorners, XTGDEBUG, ) cornerlist = [] for i in range(24): cornerlist.append(_cxtgeo.doublearray_getitem(pcorners, i)) clist = tuple(cornerlist) return clist
def get_cell_volume(self, ijk=(1, 1, 1), activeonly=True, zerobased=False, precision=2): """Get bulk cell volume for one cell.""" self._xtgformat1() i, j, k = ijk if precision not in (1, 2, 4): raise ValueError( "The precision key has an invalid entry, use 1, 2, or 4") shift = 0 if zerobased: shift = 1 if activeonly: actnum = self.get_actnum() iact = actnum.values3d[i - 1 + shift, j - 1 + shift, k - 1 + shift] if iact == 0: return None pcorners = _cxtgeo.new_doublearray(24) if self._xtgformat == 1: logger.info("Use xtgformat 1...") _cxtgeo.grd3d_corners( i + shift, j + shift, k + shift, self.ncol, self.nrow, self.nlay, self._coordsv, self._zcornsv, pcorners, ) else: logger.info("Use xtgformat 2...") _cxtgeo.grdcp3d_corners( i + shift - 1, j + shift - 1, k + shift - 1, self.ncol, self.nrow, self.nlay, self._coordsv, self._zcornsv, pcorners, ) cellvol = _cxtgeo.x_hexahedron_volume(pcorners, 24, precision) return cellvol
def get_xyz_cell_corners(self, ijk=(1, 1, 1), activeonly=True, zerobased=False): """Get X Y Z cell corners for one cell.""" self._xtgformat1() i, j, k = ijk shift = 0 if zerobased: shift = 1 if activeonly: actnum = self.get_actnum() iact = actnum.values3d[i - 1 + shift, j - 1 + shift, k - 1 + shift] if iact == 0: return None pcorners = _cxtgeo.new_doublearray(24) if self._xtgformat == 1: logger.info("Use xtgformat 1...") _cxtgeo.grd3d_corners( i + shift, j + shift, k + shift, self.ncol, self.nrow, self.nlay, self._coordsv, self._zcornsv, pcorners, ) else: logger.info("Use xtgformat 2...") _cxtgeo.grdcp3d_corners( i + shift - 1, j + shift - 1, k + shift - 1, self.ncol, self.nrow, self.nlay, self._coordsv, self._zcornsv, pcorners, ) cornerlist = [] for i in range(24): cornerlist.append(_cxtgeo.doublearray_getitem(pcorners, i)) clist = tuple(cornerlist) return clist