예제 #1
0
파일: test_ots.py 프로젝트: eivindsm/semeio
def test_eval(setUp):
    spec, actnum, parms = setUp
    grid = EclGridGenerator.createRectangular(
        dims=(2, 2, 2), dV=(100, 100, 100), actnum=actnum
    )

    grid.save_EGRID("TEST.EGRID")
    create_init(grid, "TEST")
    create_restart(grid, "TEST")

    parms.velocity_model = "TEST.segy"
    create_segy_file(parms.velocity_model, spec)

    ots = OverburdenTimeshift(
        parms.eclbase,
        parms.mapaxes,
        parms.seabed,
        parms.youngs,
        parms.poisson,
        parms.rfactor,
        parms.convention,
        parms.above,
        parms.velocity_model,
    )
    with pytest.raises(ValueError):
        ots.add_survey("S1", datetime.date(2000, 1, 15))

    vintage_pairs = [(datetime.date(1900, 1, 1), datetime.date(2010, 1, 1))]

    with pytest.raises(ValueError):
        ots.geertsma_ts_simple(vintage_pairs)

    vintage_pairs = [(datetime.date(2010, 1, 1), datetime.date(1900, 1, 1))]

    with pytest.raises(ValueError):
        ots.geertsma_ts_simple(vintage_pairs)

    vintage_pairs = [(datetime.date(2000, 1, 1), datetime.date(2010, 1, 1))]

    ots.geertsma_ts_simple(vintage_pairs)
예제 #2
0
파일: test_ots.py 프로젝트: eivindsm/semeio
def test_geertsma_TS(setUp):
    spec, actnum, parms = setUp
    grid = EclGridGenerator.createRectangular(
        dims=(2, 2, 2), dV=(100, 100, 100), actnum=actnum
    )

    create_restart(grid, "TEST")
    create_init(grid, "TEST")
    grid.save_EGRID("TEST.EGRID")

    parms.velocity_model = "TEST.segy"

    int_val = [50, 150]
    create_segy_file(
        parms.velocity_model, spec, xl=int_val, il=int_val, cdp_x=int_val, cdp_y=int_val
    )

    ots = OverburdenTimeshift(
        parms.eclbase,
        parms.mapaxes,
        parms.seabed,
        parms.youngs,
        parms.poisson,
        parms.rfactor,
        parms.convention,
        parms.above,
        parms.velocity_model,
    )

    vintage_pairs = [
        (datetime.date(2000, 1, 1), datetime.date(2010, 1, 1)),
        (datetime.date(2010, 1, 1), datetime.date(2011, 1, 1)),
    ]

    tshift = ots.geertsma_ts(vintage_pairs)

    assert tshift[0][0] == pytest.approx(-0.00104, abs=0.0001)

    parms.convention = -1

    ots = OverburdenTimeshift(
        parms.eclbase,
        parms.mapaxes,
        parms.seabed,
        parms.youngs,
        parms.poisson,
        parms.rfactor,
        parms.convention,
        parms.above,
        parms.velocity_model,
    )

    vintage_pairs = [
        (datetime.date(2000, 1, 1), datetime.date(2010, 1, 1)),
        (datetime.date(2010, 1, 1), datetime.date(2011, 1, 1)),
    ]

    tshift = ots.geertsma_ts(vintage_pairs)
    assert tshift[0][0] == pytest.approx(0.00104, abs=0.0001)
예제 #3
0
파일: test_ots.py 프로젝트: eivindsm/semeio
def test_irap_surface(setUp):
    spec, actnum, parms = setUp
    grid = EclGridGenerator.createRectangular(
        dims=(2, 2, 2), dV=(100, 100, 100), actnum=actnum
    )

    # with TestAreaContext("test_irap_surface"):
    create_restart(grid, "TEST")
    create_init(grid, "TEST")
    grid.save_EGRID("TEST.EGRID")

    parms.velocity_model = "TEST.segy"
    create_segy_file(parms.velocity_model, spec)

    ots = OverburdenTimeshift(
        parms.eclbase,
        parms.mapaxes,
        parms.seabed,
        parms.youngs,
        parms.poisson,
        parms.rfactor,
        parms.convention,
        parms.above,
        parms.velocity_model,
    )

    f_name = "irap.txt"
    s = ots._create_surface()
    s.write(f_name)
    s = Surface(f_name)

    assert s.getNX() == 2
    assert s.getNY() == 2

    for val in s:
        assert val == 90
예제 #4
0
파일: test_ots.py 프로젝트: eivindsm/semeio
def test_dPV(setUp):
    spec, actnum, parms = setUp
    grid = EclGridGenerator.createRectangular(
        dims=(2, 2, 2), dV=(100, 100, 100), actnum=actnum
    )

    grid.save_EGRID("TEST.EGRID")
    create_restart(grid, "TEST")
    create_init(grid, "TEST")

    ots = OverburdenTimeshift(
        parms.eclbase,
        parms.mapaxes,
        parms.seabed,
        parms.youngs,
        parms.poisson,
        parms.rfactor,
        parms.convention,
        parms.above,
        parms.velocity_model,
    )

    vintage_pairs = [
        (datetime.date(2000, 1, 1), datetime.date(2010, 1, 1)),
        (datetime.date(2010, 1, 1), datetime.date(2011, 1, 1)),
    ]

    tshift = ots.dpv(vintage_pairs)
    assert tshift[0][0] == pytest.approx(((20 - 10) * 1e6 + (0 - 0) * 1e6) / 1e9)
    assert tshift[0][2] == pytest.approx(((20 - 10) * 1e6 + (0 - 0) * 1e6) / 1e9)

    assert tshift[1][0] == pytest.approx(((25 - 20) * 1e6 + (0 - 0) * 1e6) / 1e9)
    assert tshift[1][2] == pytest.approx(((25 - 20) * 1e6 + (0 - 0) * 1e6) / 1e9)

    parms.convention = -1

    ots = OverburdenTimeshift(
        parms.eclbase,
        parms.mapaxes,
        parms.seabed,
        parms.youngs,
        parms.poisson,
        parms.rfactor,
        parms.convention,
        parms.above,
        parms.velocity_model,
    )
    tshift_b_m = ots.dpv(vintage_pairs)
    assert tshift[0][0] == pytest.approx(-tshift_b_m[0][0])
예제 #5
0
def test_create_missing_ecl_file(set_up, missing_file, expected_error):
    spec, actnum, params = set_up
    grid = EclGridGenerator.createRectangular(dims=(10, 10, 10), dV=(1, 1, 1))

    grid.save_EGRID("TEST.EGRID")
    create_init(grid, "TEST")
    create_restart(grid, "TEST")

    os.remove(missing_file)
    with pytest.raises(IOError, match=expected_error):
        OverburdenTimeshift(
            params.eclbase,
            params.mapaxes,
            params.seabed,
            params.youngs,
            params.poisson,
            params.rfactor,
            params.convention,
            params.above,
            params.velocity_model,
        )
예제 #6
0
def test_create_invalid_input_missing_segy(set_up):
    spec, actnum, parms = set_up

    grid = EclGridGenerator.createRectangular(dims=(10, 10, 10), dV=(1, 1, 1))
    grid.save_EGRID("TEST.EGRID")

    create_init(grid, "TEST")
    create_restart(grid, "TEST")

    parms.velocity_model = "missing.segy"

    with pytest.raises(IOError, match="No such file or directory"):
        OverburdenTimeshift(
            parms.eclbase,
            parms.mapaxes,
            parms.seabed,
            parms.youngs,
            parms.poisson,
            parms.rfactor,
            parms.convention,
            parms.above,
            parms.velocity_model,
        )
예제 #7
0
def test_create_valid(set_up, config_item, value):
    spec, actnum, params = set_up
    grid = EclGridGenerator.createRectangular(dims=(10, 10, 10), dV=(1, 1, 1))

    grid.save_EGRID("TEST.EGRID")
    create_init(grid, "TEST")
    create_restart(grid, "TEST")

    # Testing individual items in config, so setting that value here:
    setattr(params, config_item, value)
    if params.velocity_model:
        create_segy_file(params.velocity_model, spec)

    OverburdenTimeshift(
        params.eclbase,
        params.mapaxes,
        params.seabed,
        params.youngs,
        params.poisson,
        params.rfactor,
        params.convention,
        params.above,
        params.velocity_model,
    )
예제 #8
0
파일: test_ots.py 프로젝트: eivindsm/semeio
def test_create(setUp):
    spec, actnum, parms = setUp
    grid = EclGridGenerator.createRectangular(dims=(10, 10, 10), dV=(1, 1, 1))

    create_init(grid, "TEST")

    with pytest.raises(IOError):
        OverburdenTimeshift(
            parms.eclbase,
            parms.mapaxes,
            parms.seabed,
            parms.youngs,
            parms.poisson,
            parms.rfactor,
            parms.convention,
            parms.above,
            parms.velocity_model,
        )

    with pytest.raises(IOError):
        OverburdenTimeshift(
            parms.eclbase,
            parms.mapaxes,
            parms.seabed,
            parms.youngs,
            parms.poisson,
            parms.rfactor,
            parms.convention,
            parms.above,
            parms.velocity_model,
        )

    grid = EclGridGenerator.createRectangular(dims=(10, 10, 10), dV=(1, 1, 1))

    create_init(grid, "TEST")
    create_restart(grid, "TEST")

    with pytest.raises(IOError):
        OverburdenTimeshift(
            parms.eclbase,
            parms.mapaxes,
            parms.seabed,
            parms.youngs,
            parms.poisson,
            parms.rfactor,
            parms.convention,
            parms.above,
            parms.velocity_model,
        )

    grid = EclGridGenerator.createRectangular(dims=(10, 10, 10), dV=(1, 1, 1))
    grid.save_EGRID("TEST.EGRID")

    create_init(grid, "TEST")
    create_restart(grid, "TEST")

    parms.velocity_model = "missing.segy"

    with pytest.raises(IOError):
        OverburdenTimeshift(
            parms.eclbase,
            parms.mapaxes,
            parms.seabed,
            parms.youngs,
            parms.poisson,
            parms.rfactor,
            parms.convention,
            parms.above,
            parms.velocity_model,
        )

    grid = EclGridGenerator.createRectangular(dims=(10, 10, 10), dV=(1, 1, 1))

    grid.save_EGRID("TEST.EGRID")
    create_init(grid, "TEST")
    create_restart(grid, "TEST")

    parms.velocity_model = "TEST.segy"
    create_segy_file(parms.velocity_model, spec)

    OverburdenTimeshift(
        parms.eclbase,
        parms.mapaxes,
        parms.seabed,
        parms.youngs,
        parms.poisson,
        parms.rfactor,
        parms.convention,
        parms.above,
        parms.velocity_model,
    )