Esempio n. 1
0
def test_fence():
    """Return a resampled fence."""

    mywell = Well(WFILE)
    pline = mywell.get_fence_polyline(nextend=10, tvdmin=1000)

    logger.debug(pline)
Esempio n. 2
0
def test_remove_parallel_parts():
    """Remove the part of the well thst is parallel with some other"""

    well1 = Well(WELL1)
    well2 = Well(WELL2)

    well1.truncate_parallel_path(well2)

    print(well1.dataframe)
Esempio n. 3
0
def test_wellzone_to_isopoints():
    """Import well from file and find thicknesses"""

    mywell = Well(WFILE, zonelogname="Zone_model2", mdlogname="M_MDEPTH")
    # get the zpoints which is a Pandas
    zpoints = mywell.get_zonation_points(use_undef=False, tops=True)

    zisos = mywell.get_zonation_points(use_undef=False, tops=False)
    assert zisos.iat[10, 8] == 4
Esempio n. 4
0
def test_get_zonation_holes():
    """get a report of holes in the zonation, some samples with -999"""

    mywell = Well(WFILE_HOLES, zonelogname="Zonelog")
    report = mywell.report_zonation_holes()

    logger.info("\n%s", report)

    tsetup.assert_equal(report.iat[0, 0], 4193)  # first value for INDEX
    tsetup.assert_equal(report.iat[1, 3], 1609.5800)  # second value for Z
Esempio n. 5
0
def test_fence_as_polygons():
    """Return a resampled fence as Polygons."""

    mywell = Well(WFILE)
    pline = mywell.get_fence_polyline(nextend=3, tvdmin=1000, asnumpy=False)

    assert isinstance(pline, Polygons)
    dfr = pline.dataframe
    print(dfr)
    tsetup.assert_almostequal(dfr["X_UTME"][5], 462569.00, 2.0)
Esempio n. 6
0
def test_fence_as_polygons_drogon():
    """Return a resampled fence as Polygons for a 100% vertical."""

    mywell = Well(WELL4)
    pline = mywell.get_fence_polyline(
        nextend=3, tvdmin=1000, sampling=20, asnumpy=False
    )

    assert isinstance(pline, Polygons)
    dfr = pline.dataframe
    assert dfr.H_CUMLEN.max() == pytest.approx(60, 0.01)
Esempio n. 7
0
def test_wellzone_to_points():
    """Import well from file and put zone boundaries to a Pandas object."""

    wfile = "../xtgeo-testdata/wells/reek/1/OP_1.w"

    mywell = Well(wfile, zonelogname="Zonelog")
    logger.info("Imported %s", wfile)

    # get the zpoints which is a Pandas
    zpoints = mywell.get_zonation_points()

    print(zpoints)
Esempio n. 8
0
def test_import_export_many():
    """Import and export many wells (test speed)."""
    logger.debug(WFILES)

    for filename in sorted(glob.glob(WFILES)):
        mywell = Well(filename)
        logger.info(mywell.nrow)
        logger.info(mywell.ncol)
        logger.info(mywell.lognames)

        wname = join(TMPD, mywell.xwellname + ".w")
        mywell.to_file(wname)
Esempio n. 9
0
def test_get_zone_interval():
    """Get zonations points (zone tops)"""

    mywell = Well(WFILE, zonelogname="Zonelog")
    line = mywell.get_zone_interval(3)

    print(line)

    logger.info(type(line))

    tsetup.assert_almostequal(line.iat[0, 0], 462698.33299, 0.001)
    tsetup.assert_almostequal(line.iat[-1, 2], 1643.1618, 0.001)
Esempio n. 10
0
def test_shortwellname():
    """Test that shortwellname gives wanted result."""
    mywell = Well()

    mywell._wname = "31/2-A-14 2H"
    short = mywell.shortwellname

    assert short == "A-142H"

    mywell._wname = "6412_2-A-14_2H"
    short = mywell.shortwellname

    assert short == "A-142H"
Esempio n. 11
0
def test_get_filled_dataframe():
    """Get a filled DataFrame"""

    mywell = Well(WFILE)

    df1 = mywell.dataframe

    df2 = mywell.get_filled_dataframe(fill_value=-999, fill_value_int=-888)

    logger.info(df1)
    logger.info(df2)

    assert np.isnan(df1.iat[4860, 6])
    assert df2.iat[4860, 6] == -888
Esempio n. 12
0
def test_shortwellname():
    """Test that shortwellname gives wanted result"""

    mywell = Well()

    mywell._wname = '31/2-A-14 2H'
    short = mywell.shortwellname

    assert short == 'A-142H'

    mywell._wname = '6412_2-A-14_2H'
    short = mywell.shortwellname

    assert short == 'A-142H'
Esempio n. 13
0
def test_hdf_io_single():
    """Test HDF io, single well."""
    mywell = Well(WELL1)

    wname = (TMPDX / "hdfwell").with_suffix(".hdf")
    mywell.to_hdf(wname)
    mywell2 = Well()
    mywell2.from_hdf(wname)
Esempio n. 14
0
def fixture_loadwells1():
    logger.info("Load well 1")
    wlist = []
    for wfile in glob.glob(WFILES):
        wlist.append(Well(wfile))

    return wlist
Esempio n. 15
0
def test_get_faciesfraction_some_wells():
    """Import some wells and get the facies fractions per zone, for
    wells < 70 degrees inclination.
    """

    wlist = []
    for w in sorted(glob.glob(wfiles2)):
        wlist.append(Well(w, zonelogname='Zonelog'))
        logger.info('Imported well {}'.format(w))

    mypoints = Points()
    facname = 'Facies'
    fcode = [1]

    nwell = mypoints.dfrac_from_wells(wlist,
                                      facname,
                                      fcode,
                                      zonelist=None,
                                      incl_limit=70)

    # rename column
    mypoints.zname = 'FACFRAC'

    logger.info('Number of wells is %s, DATAFRAME:\n, %s', nwell,
                mypoints.dataframe)

    myquery = 'WELLNAME == "OP_1" and ZONE == 1'
    usedf = mypoints.dataframe.query(myquery)

    assert abs(usedf[mypoints.zname].values[0] - 0.86957) < 0.001

    mypoints.to_file('TMP/ffrac_per_zone.rmsasc',
                     fformat='rms_attr',
                     attributes=['WELLNAME', 'ZONE'],
                     pfilter={'ZONE': [1]})
def test_get_zone_thickness_some_wells():
    """Import some wells and get the zone thicknesses"""

    wlist = []
    for w in glob.glob(str(WFILES2)):
        wlist.append(Well(w, zonelogname="Zonelog"))
        logger.info("Imported well {}".format(w))

    mypoints = Points()
    nwell = mypoints.from_wells(wlist, tops=False, zonelist=(1, 22))

    print(nwell, "\n", mypoints.dataframe)

    mypoints.to_file(
        "TMP/zpoints_w_so622.rmsasc",
        fformat="rms_attr",
        attributes=["WellName", "ZoneName"],
        pfilter={"ZoneName": ["SO622"]},
    )

    # filter, for backwards compatibility
    mypoints.to_file(
        "TMP/zpoints_w_so622_again.rmsasc",
        fformat="rms_attr",
        attributes=["WellName", "ZoneName"],
        filter={"ZoneName": ["SO622"]},
    )

    logger.info("Number of well made to tops: {}".format(nwell))
def test_get_faciesfraction_some_wells():
    """Import some wells and get the facies fractions per zone, for
    wells < 70 degrees inclination.
    """

    wlist = []
    for w in sorted(glob.glob(str(WFILES2))):
        wlist.append(Well(w, zonelogname="Zonelog"))
        logger.info("Imported well {}".format(w))

    mypoints = Points()
    facname = "Facies"
    fcode = [1]

    nwell = mypoints.dfrac_from_wells(
        wlist, facname, fcode, zonelist=None, incl_limit=70
    )

    # rename column
    mypoints.zname = "FACFRAC"

    logger.info("Number of wells is %s, DATAFRAME:\n, %s", nwell, mypoints.dataframe)

    myquery = 'WELLNAME == "OP_1" and ZONE == 1'
    usedf = mypoints.dataframe.query(myquery)

    assert abs(usedf[mypoints.zname].values[0] - 0.86957) < 0.001

    mypoints.to_file(
        "TMP/ffrac_per_zone.rmsasc",
        fformat="rms_attr",
        attributes=["WELLNAME", "ZONE"],
        pfilter={"ZONE": [1]},
    )
def test_get_zone_tops_some_wells():
    """Import some well and get the zone tops"""

    wlist = []
    for w in glob.glob(str(WFILES2)):
        wlist.append(Well(w, zonelogname="Zonelog"))
        logger.info("Imported well {}".format(w))

    mypoints = Points()
    nwell = mypoints.from_wells(wlist)

    print(mypoints.dataframe)

    logger.info("Number of well made to tops: {}".format(nwell))

    mypoints.to_file(
        "TMP/points_w1_many.rmsasc",
        fformat="rms_attr",
        attributes=["WellName", "TopName"],
    )

    mypoints.to_file(
        "TMP/points_w1_many.rmswpicks",
        fformat="rms_wellpicks",
        wcolumn="WellName",
        hcolumn="TopName",
    )
Esempio n. 19
0
def test_get_zone_thickness_some_wells():
    """Import some wells and get the zone thicknesses"""

    wlist = []
    for w in glob.glob(wfiles2):
        wlist.append(Well(w, zonelogname='Zonelog'))
        logger.info('Imported well {}'.format(w))

    mypoints = Points()
    nwell = mypoints.from_wells(wlist, tops=False, zonelist=(1, 22))

    print(nwell, '\n', mypoints.dataframe)

    mypoints.to_file('TMP/zpoints_w_so622.rmsasc',
                     fformat='rms_attr',
                     attributes=['WellName', 'ZoneName'],
                     pfilter={'ZoneName': ['SO622']})

    # filter, for backwards compatibility
    mypoints.to_file('TMP/zpoints_w_so622_again.rmsasc',
                     fformat='rms_attr',
                     attributes=['WellName', 'ZoneName'],
                     filter={'ZoneName': ['SO622']})

    logger.info('Number of well made to tops: {}'.format(nwell))
Esempio n. 20
0
def test_get_zone_thickness_some_wells(testpath, tmp_path):
    """Import some wells and get the zone thicknesses"""

    wlist = [
        Well(wpath, zonelogname="Zonelog")
        for wpath in glob.glob(str(testpath / WFILES2))
    ]

    mypoints = Points()
    mypoints.from_wells(wlist, tops=False, zonelist=(1, 22))

    mypoints.to_file(
        tmp_path / "zpoints_w_so622.rmsasc",
        fformat="rms_attr",
        attributes=["WellName", "ZoneName"],
        pfilter={"ZoneName": ["SO622"]},
    )

    # filter, for backwards compatibility
    mypoints.to_file(
        tmp_path / "zpoints_w_so622_again.rmsasc",
        fformat="rms_attr",
        attributes=["WellName", "ZoneName"],
        filter={"ZoneName": ["SO622"]},
    )
Esempio n. 21
0
def test_get_zone_thickness_one_well(testpath):
    """Import a well and get the zone thicknesses"""

    wlist = [Well((testpath / WFILES1), zonelogname="Zonelog")]

    mypoints = Points()
    mypoints.from_wells(wlist, tops=False, zonelist=[12, 13, 14])
Esempio n. 22
0
def test_get_faciesfraction_some_wells(testpath, tmp_path):
    """Import some wells and get the facies fractions per zone, for
    wells < 70 degrees inclination.
    """

    wlist = [
        Well(wpath, zonelogname="Zonelog")
        for wpath in glob.glob(str(testpath / WFILES2))
    ]

    mypoints = Points()
    facname = "Facies"
    fcode = [1]

    mypoints.dfrac_from_wells(wlist,
                              facname,
                              fcode,
                              zonelist=None,
                              incl_limit=70)

    # rename column
    mypoints.zname = "FACFRAC"

    myquery = 'WELLNAME == "OP_1" and ZONE == 1'
    usedf = mypoints.dataframe.query(myquery)

    assert abs(usedf[mypoints.zname].values[0] - 0.86957) < 0.001

    mypoints.to_file(
        tmp_path / "ffrac_per_zone.rmsasc",
        fformat="rms_attr",
        attributes=["WELLNAME", "ZONE"],
        pfilter={"ZONE": [1]},
    )
Esempio n. 23
0
def test_make_ijk_gf_geogrid():
    """Import well from and a large geogrid and make I J K logs"""

    logger.info("Running test... %s", __name__)
    mywell = Well(WGULLFILE)
    mygrid = Grid(GGULLFILE)

    logger.info("Number of cells in grid is %s", mygrid.ntotal)

    mywell.make_ijk_from_grid(mygrid)

    df = mywell.dataframe

    assert int(df.iloc[16120]["ICELL"]) == 68
    assert int(df.iloc[16120]["JCELL"]) == 204
    assert int(df.iloc[16120]["KCELL"]) == 15
Esempio n. 24
0
def test_get_zone_tops_one_well_w_undef():
    """Import a well and get the zone tops, include undef transition"""

    wlist = []
    for w in glob.glob(wfiles1):
        wlist.append(Well(w, zonelogname="Zonelog"))
        logger.info("Imported well {}".format(w))

    mypoints = Points()
    nwell = mypoints.from_wells(wlist, use_undef=True)

    print(mypoints.dataframe)

    logger.info("Number of well made to tops: {}".format(nwell))

    mypoints.to_file(
        "TMP/points_w1_w_undef.rmsasc",
        fformat="rms_attr",
        attributes=["WellName", "TopName"],
    )

    mypoints.to_file(
        "TMP/points_w1_w_undef.rmswpicks",
        fformat="rms_wellpicks",
        wcolumn="WellName",
        hcolumn="TopName",
    )
Esempio n. 25
0
def test_get_polygons_one_well(testpath, tmp_path):
    """Import a well and get the polygon segments."""
    wlist = [Well((testpath / WFILES1), zonelogname="Zonelog")]

    mypoly = Polygons()
    mypoly.from_wells(wlist, 2)

    mypoly.to_file(tmp_path / "poly_w1.irapasc")
Esempio n. 26
0
def test_report_zlog_mismatch_perflog():
    """Report zone log mismatch grid and well filter on PERF"""
    g1 = Grid()
    g1.from_file(GRIDFILE)

    zo = GridProperty()
    zo.from_file(ZONEFILE, name="Zone")

    w1 = Well(PWELL1)

    w1.dataframe.to_csv("TMP/testw1.csv")

    res = g1.report_zone_mismatch(
        well=w1,
        zonelogname="Zonelog",
        zoneprop=zo,
        zonelogrange=(1, 3),
        depthrange=[1580, 9999],
        perflogname="PERF",
        resultformat=2,
    )
    mywell = res["WELLINTV"]
    logger.info("\n%s", mywell.dataframe.to_string())
    mywell.to_file(join(TMPD, "w1_perf_report.rmswell"))

    assert res["MATCH2"] == pytest.approx(81, 1.5)
    assert res["TCOUNT2"] == 57
    assert res["MCOUNT2"] == 46

    w1 = Well(WELL1)

    # well is missing perflog; hence result shall be None
    res = g1.report_zone_mismatch(
        well=w1,
        zonelogname="Zonelog",
        zoneprop=zo,
        zonelogrange=(1, 3),
        depthrange=[1580, 9999],
        perflogname="PERF",
        resultformat=2,
    )

    # ask for perflogname but no such present
    assert res is None
Esempio n. 27
0
def test_get_polygons_many_wells(testpath, tmp_path):
    """Import some wells and get the polygon segments."""
    wlist = [
        Well(wpath, zonelogname="Zonelog")
        for wpath in glob.glob(str(testpath / WFILES2))
    ]

    mypoly = Polygons()
    mypoly.from_wells(wlist, 2, resample=10)

    mypoly.to_file(tmp_path / "poly_w1_many.irapasc")
Esempio n. 28
0
def test_import_as_rms_export_as_hdf_many():
    """Import RMS and export as HDF5 and RMS asc, many, and compare timings."""
    mywell = Well(WELL1)
    nmax = 50

    t0 = xtg.timer()
    wlist = []
    for _ in range(nmax):
        wname = (TMPDX / "$random").with_suffix(".hdf")
        wuse = mywell.to_hdf(wname, compression=None)
        wlist.append(wuse)
    print("Time for save HDF: ", xtg.timer(t0))

    t0 = xtg.timer()
    for wll in wlist:
        wname = (TMPDX / "$random").with_suffix(".hdf")
        wuse = mywell.from_hdf(wll)
    print("Time for load HDF: ", xtg.timer(t0))

    t0 = xtg.timer()
    wlist = []
    for _ in range(nmax):
        wname = (TMPDX / "$random").with_suffix(".rmsasc")
        wuse = mywell.to_file(wname)
        wlist.append(wuse)
    print("Time for save RMSASC: ", xtg.timer(t0))

    t0 = xtg.timer()
    for wll in wlist:
        wuse = mywell.from_file(wll)
    print("Time for load RMSASC: ", xtg.timer(t0))
Esempio n. 29
0
def test_rescale_well_tvdrange_coarsen_upper():
    """Rescale (resample) a well to a coarser increment in top part"""

    mywell = Well(WELL1)
    mywell.rescale(delta=20, tvdrange=(0, 1200))
    mywell.to_file(join(TMPD, "wll1_rescale_coarsen.w"))
    tsetup.assert_almostequal(mywell.dataframe.iat[10, 3], 365.8254, 0.1)
def test_get_zone_thickness_one_well():
    """Import a well and get the zone thicknesses"""

    wlist = []
    for w in glob.glob(str(WFILES1)):
        wlist.append(Well(w, zonelogname="Zonelog"))
        logger.info("Imported well {}".format(w))

    mypoints = Points()
    nwell = mypoints.from_wells(wlist, tops=False, zonelist=[12, 13, 14])

    print(mypoints.dataframe)

    logger.info("Number of well made to tops: {}".format(nwell))