예제 #1
0
def resample(self, other):
    """Resample from other surface object to this surf"""

    logger.info("Resampling...")

    svalues = self.get_values1d()

    ier = _cxtgeo.surf_resample(
        other._ncol,
        other._nrow,
        other._xori,
        other._xinc,
        other._yori,
        other._yinc,
        other._yflip,
        other._rotation,
        other.get_values1d(),
        self._ncol,
        self._nrow,
        self._xori,
        self._xinc,
        self._yori,
        self._yinc,
        self._yflip,
        self._rotation,
        svalues,
        0,
    )

    if ier != 0:
        raise RuntimeError("Resampling went wrong, " "code is {}".format(ier))

    self.set_values1d(svalues)
예제 #2
0
def resample(self, other, mask=True):
    """Resample from other surface object to this surf."""

    logger.info("Resampling...")

    # a special case occur of the maps have same topology, but
    # different masks
    if self.compare_topology(other, strict=False):
        self.values = other.values.copy()
        return

    svalues = np.ma.filled(self.values, fill_value=xtgeo.UNDEF)
    ovalues = np.ma.filled(other.values, fill_value=xtgeo.UNDEF)

    _cxtgeo.surf_resample(
        other._ncol,
        other._nrow,
        other._xori,
        other._xinc,
        other._yori,
        other._yinc,
        other._yflip,
        other._rotation,
        ovalues,
        self._ncol,
        self._nrow,
        self._xori,
        self._xinc,
        self._yori,
        self._yinc,
        self._yflip,
        self._rotation,
        svalues,
        0 if not mask else 1,
    )

    self.values = np.ma.masked_greater(svalues, xtgeo.UNDEF_LIMIT)

    self.set_values1d(svalues)
    self._filesrc = "Resampled"
예제 #3
0
def resample(self, other, mask=True):
    """Resample from other surface object to this surf"""

    logger.info("Resampling...")

    # a special case occur of the maps have same topology, but
    # different masks
    if self.compare_topology(other, strict=False):
        self.values = other.values.copy()
        return

    svalues = self.get_values1d()

    optmask = 1
    if not mask:
        optmask = 0

    ier = _cxtgeo.surf_resample(
        other._ncol,
        other._nrow,
        other._xori,
        other._xinc,
        other._yori,
        other._yinc,
        other._yflip,
        other._rotation,
        other.get_values1d(),
        self._ncol,
        self._nrow,
        self._xori,
        self._xinc,
        self._yori,
        self._yinc,
        self._yflip,
        self._rotation,
        svalues,
        optmask,
    )

    if ier != 0:
        raise RuntimeError("Resampling went wrong, " "code is {}".format(ier))

    self.set_values1d(svalues)
    self._filesrc = "Resampled"