Exemplo n.º 1
0
def empty3d_twt(request):
    iln, xln, n, dom = request.param
    return create3d_dataset((iln, xln, n),
                            sample_rate=1,
                            first_iline=1,
                            first_xline=1,
                            vert_domain=dom)
Exemplo n.º 2
0
    def test_full_stack_dataset_xysel(self, d, translate, scale, shear, rotate,
                                      samp):
        dataset = create3d_dataset(dims=d)
        xlines_, ilines_ = np.meshgrid(dataset.xline, dataset.iline)
        ix_pairs = np.dstack([ilines_, xlines_])
        tr = Affine.translation(*translate)
        sc = Affine.scale(scale)
        sh = Affine.shear(*shear)
        rt = Affine.rotation(rotate)
        trsfm = lambda x: tr * sc * sh * rt * x
        ix_pairs = np.apply_along_axis(trsfm, 1, ix_pairs.reshape(
            -1, 2)).reshape(ix_pairs.shape)
        dataset["cdp_x"] = (DimensionKeyField.cdp_3d, ix_pairs[:, :, 0])
        dataset["cdp_y"] = (DimensionKeyField.cdp_3d, ix_pairs[:, :, 1])

        dataset["data"] = (DimensionKeyField.threed_twt, np.random.rand(*d))

        test_points = np.dstack([
            np.random.random(samp) * (d[0] - 0.1) + 0.1,
            np.random.random(samp) * (d[1] - 0.1) + 0.1,
        ])[0]
        # make sure at least one point is in the box
        test_points[0, :] = d[0] / 2, d[1] / 2

        xys = np.apply_along_axis(trsfm, 1, test_points)

        res = dataset.seis.xysel(xys[:, 0], xys[:, 1], method="linear")
        assert isinstance(res, xr.Dataset)
        res = dataset.seis.xysel(xys[:, 0], xys[:, 1], method="nearest")
        assert isinstance(res, xr.Dataset)
Exemplo n.º 3
0
def zeros3d(request):
    iln, xln, n, dom = request.param
    seisnc = create3d_dataset((iln, xln, n),
                              sample_rate=1,
                              first_iline=1,
                              first_xline=1,
                              vert_domain=dom)
    seisnc = seisnc.seis.zeros_like()
    return seisnc
Exemplo n.º 4
0
def empty3d_gath(request):
    iln, xln, n, off, dom = request.param
    return create3d_dataset(
        (iln, xln, n, off),
        sample_rate=1,
        first_iline=1,
        first_xline=1,
        vert_domain=dom,
        first_offset=2,
        offset_step=2,
    )
Exemplo n.º 5
0
    def test_angle_stack_dataset_xysel(self, o, f, s, translate, scale, shear,
                                       rotate, samp):
        dims = (50, 30, 5, o)
        dataset = create3d_dataset(dims, first_offset=f, offset_step=s)
        xlines_, ilines_ = np.meshgrid(dataset.xline, dataset.iline)
        ix_pairs = np.dstack([ilines_, xlines_])
        tr = Affine.translation(*translate)
        sc = Affine.scale(scale)
        sh = Affine.shear(*shear)
        rt = Affine.rotation(rotate)
        trsfm = lambda x: tr * sc * sh * rt * x
        ix_pairs = np.apply_along_axis(trsfm, 1, ix_pairs.reshape(
            -1, 2)).reshape(ix_pairs.shape)
        dataset['cdp_x'] = (DimensionKeyField.cdp_3d, ix_pairs[:, :, 0])
        dataset['cdp_y'] = (DimensionKeyField.cdp_3d, ix_pairs[:, :, 1])

        if dataset.seis.is_depth():
            dataset['data'] = (DimensionKeyField.threed_ps_depth,
                               np.random.rand(*dims))
        else:
            dataset['data'] = (DimensionKeyField.threed_ps_twt,
                               np.random.rand(*dims))

        test_points = np.dstack([
            np.random.random(samp) * (dims[0] - 0.1) + 0.1,
            np.random.random(samp) * (dims[1] - 0.1) + 0.1
        ])[0]
        # make sure at least one point is in the box
        test_points[0, :] = dims[0] / 2, dims[1] / 2

        xys = np.apply_along_axis(trsfm, 1, test_points)

        res = dataset.seis.xysel(xys[:, 0], xys[:, 1], method='linear')
        assert isinstance(res, xr.Dataset)
        res = dataset.seis.xysel(xys[:, 0], xys[:, 1], method='nearest')
        assert isinstance(res, xr.Dataset)