예제 #1
0
def get_dxdy(self, names=("dX", "dY"), asmasked=False):
    """Get dX, dY as properties"""
    ntot = self._ncol * self._nrow * self._nlay
    dx = GridProperty(
        ncol=self._ncol,
        nrow=self._nrow,
        nlay=self._nlay,
        values=np.zeros(ntot, dtype=np.float64),
        name=names[0],
        discrete=False,
    )
    dy = GridProperty(
        ncol=self._ncol,
        nrow=self._nrow,
        nlay=self._nlay,
        values=np.zeros(ntot, dtype=np.float64),
        name=names[1],
        discrete=False,
    )

    ptr_dx_v = _cxtgeo.new_doublearray(self.ntotal)
    ptr_dy_v = _cxtgeo.new_doublearray(self.ntotal)

    option1 = 0
    option2 = 0

    if asmasked:
        option1 = 1

    _cxtgeo.grd3d_calc_dxdy(
        self._ncol,
        self._nrow,
        self._nlay,
        self._p_coord_v,
        self._p_zcorn_v,
        self._p_actnum_v,
        ptr_dx_v,
        ptr_dy_v,
        option1,
        option2,
        XTGDEBUG,
    )

    _gridprop_lowlevel.update_values_from_carray(dx, ptr_dx_v, np.float64, delete=True)
    _gridprop_lowlevel.update_values_from_carray(dy, ptr_dy_v, np.float64, delete=True)

    # return the property objects
    return dx, dy
예제 #2
0
def get_dxdy(self, names=("dX", "dY"), asmasked=False):
    """Get dX, dY as properties."""
    self._xtgformat1()

    ntot = self._ncol * self._nrow * self._nlay

    dxval = np.zeros(ntot, dtype=np.float64)
    dyval = np.zeros(ntot, dtype=np.float64)

    dx = GridProperty(
        ncol=self._ncol,
        nrow=self._nrow,
        nlay=self._nlay,
        name=names[0],
        discrete=False,
    )
    dy = GridProperty(
        ncol=self._ncol,
        nrow=self._nrow,
        nlay=self._nlay,
        name=names[1],
        discrete=False,
    )

    option1 = 0
    option2 = 0

    if asmasked:
        option1 = 1

    _cxtgeo.grd3d_calc_dxdy(
        self._ncol,
        self._nrow,
        self._nlay,
        self._coordsv,
        self._zcornsv,
        self._actnumsv,
        dxval,
        dyval,
        option1,
        option2,
    )

    dx.values = np.ma.masked_greater(dxval, xtgeo.UNDEF_LIMIT)
    dy.values = np.ma.masked_greater(dyval, xtgeo.UNDEF_LIMIT)

    # return the property objects
    return dx, dy
예제 #3
0
def test_grd3d_calc_dxdy():
    with pytest.raises(
            xtgeo.XTGeoCLibError,
            match="Errors in array lengths checks in grd3d_calc_dxdy",
    ):
        _cxtgeo.grd3d_calc_dxdy(
            1,
            1,
            1,
            np.array([0.0]),
            np.array([1.0]),
            np.array([1], dtype=np.int32),
            np.array([0.0]),
            np.array([0.0]),
            0,
            0,
        )