Exemplo n.º 1
0
def test_cube_export_import_many():
    """Test exporting etc to xtgregcube format."""
    cube1 = xtgeo.Cube(TESTSET1)

    nrange = 50

    fformat = "xtgregcube"

    fnames = []

    # timing of writer
    t1 = xtg.timer()
    for num in range(nrange):
        fname = uuid.uuid4().hex + "." + fformat

        fname = pathlib.Path(TMPD) / fname
        fnames.append(fname)
        cube1.to_file(fname, fformat=fformat)

    logger.info("Timing export %s cubes with %s: %s", nrange, fformat,
                xtg.timer(t1))

    # timing of reader
    t1 = xtg.timer()
    for fname in fnames:
        cube2 = xtgeo.Cube()
        cube2.from_file(fname, fformat=fformat)

    logger.info("Timing import %s cubes with %s: %s", nrange, fformat,
                xtg.timer(t1))

    assert cube1.values.mean() == pytest.approx(cube2.values.mean())
Exemplo n.º 2
0
def test_benchmark_cube_import(benchmark, testpath, tmp_path):
    cube1 = xtgeo.Cube(
        join(testpath, "cubes/reek/syntseis_20030101_seismic_depth_stack.segy")
    )

    fname = join(tmp_path, "syntseis_20030101_seismic_depth_stack.xtgrecube")
    cube1.to_file(fname, fformat="xtgregcube")

    cube2 = xtgeo.Cube()

    @benchmark
    def read():
        cube2.from_file(fname, fformat="xtgregcube")

    assert_allclose(cube1.values, cube2.values)
Exemplo n.º 3
0
def fixture_cube():
    """Create an xtgeo cube instance."""
    logger.info("Ran %s", inspect.currentframe().f_code.co_name)
    return xtgeo.Cube(ncol=3,
                      nrow=4,
                      nlay=5,
                      xinc=12,
                      yinc=12,
                      zinc=4,
                      rotation=30)
Exemplo n.º 4
0
def test_benchmark_cube_export(benchmark, tmp_path, testpath):
    cube1 = xtgeo.Cube(
        join(testpath, "cubes/reek/syntseis_20030101_seismic_depth_stack.segy")
    )

    fname = join(tmp_path, "syntseis_20030101_seismic_depth_stack.xtgrecube")

    @benchmark
    def write():
        cube1.to_file(fname, fformat="xtgregcube")
Exemplo n.º 5
0
def test_simple_plot_with_seismics(tmpdir, show_plot, generate_plot):
    """Test as simple XSECT plot with seismic backdrop."""

    mywell = xtgeo.Well(USEFILE7)
    mycube = xtgeo.Cube(USEFILE6)

    mysurfaces = []
    mysurf = xtgeo.RegularSurface()
    mysurf.from_file(USEFILE2)

    for i in range(10):
        xsurf = mysurf.copy()
        xsurf.values = xsurf.values + i * 20
        xsurf.name = "Surface_{}".format(i)
        mysurfaces.append(xsurf)

    myplot = XSection(
        zmin=1000,
        zmax=1900,
        well=mywell,
        surfaces=mysurfaces,
        cube=mycube,
        sampling=10,
        nextend=2,
    )

    # set the color table, from file
    clist = [0, 1, 222, 3, 5, 7, 3, 12, 11, 10, 9, 8]
    cfil1 = "xtgeo"
    cfil2 = TPATH / "etc/colortables/colfacies.txt"

    assert 222 in clist
    assert "xtgeo" in cfil1
    assert "colfacies" in str(cfil2)

    myplot.set_colortable(cfil1, colorlist=None)

    myplot.canvas(title="Plot with seismics", subtitle="Some well")

    myplot.plot_cube()
    myplot.plot_surfaces(fill=False)

    myplot.plot_well()

    myplot.plot_map()

    if generate_plot:
        myplot.savefig(join(tmpdir, "xsect_wcube.png"), last=False)

    if show_plot:
        myplot.show()
Exemplo n.º 6
0
def test_avg_surface_large_cube():

    logger.info("Make cube...")
    cube1 = xtgeo.Cube(ncol=1200, nrow=1200, nlay=1000, zori=2000, zinc=4)

    cube1.values[400:800, 400:800, :] = 12

    logger.info("Make cube... done")
    surf1 = xtgeo.surface_from_cube(cube1, 2040.0)
    surf2 = xtgeo.surface_from_cube(cube1, 2880.0)

    t1 = xtg.timer()

    _ = surf1.slice_cube_window(
        cube1,
        other=surf2,
        other_position="below",
        attribute="all",
        sampling="cube",
        snapxy=True,
        ndiv=None,
        algorithm=2,
        showprogress=True,
    )
    print("Algorithm 2: ", xtg.timer(t1))

    t1 = xtg.timer()
    _ = surf1.slice_cube_window(
        cube1,
        other=surf2,
        other_position="below",
        attribute="all",
        sampling="discrete",
        snapxy=True,
        ndiv=None,
        algorithm=1,
        showprogress=True,
    )
    print("Algorithm 1: ", xtg.timer(t1))

    logger.info("Testing done")
Exemplo n.º 7
0
def load_cube_data(cube_path: str) -> xtgeo.Cube:
    return xtgeo.Cube(cube_path)
Exemplo n.º 8
0
def fixture_loadsfile2():
    """Fixture for loading a SFILE2"""
    logger.info("Load seismic file 2")
    return xtgeo.Cube(SFILE2)
Exemplo n.º 9
0
def load_cube_data(cube_path):
    return xtgeo.Cube(cube_path)