示例#1
0
def test_from_image():
    legend = Legend.builtin('NSDOE')
    imgfile = "tutorial/M-MG-70_14.3_135.9.png"
    striplog = Striplog.from_img(imgfile, 200, 300, legend=legend)
    assert len(striplog) == 26
    assert striplog[-1].primary.summary() == 'Volcanic'
    assert np.floor(striplog.find('sandstone').cum) == 15
    assert striplog.depth(260).primary.lithology == 'siltstone'
    assert striplog.to_las3() is not ''
    assert striplog.to_log()[5] == 2.0
    assert striplog.cum == 100.0
    assert striplog.thickest().primary.lithology == 'anhydrite'
    assert striplog.thickest(n=7)[1].primary.lithology == 'sandstone'
    assert striplog.thinnest().primary.lithology == 'dolomite'
    assert striplog.thinnest(n=7)[1].primary.lithology == 'siltstone'

    indices = [2, 7, 20]
    del striplog[indices]
    assert len(striplog.find_gaps()) == len(indices)

    striplog.prune(limit=1.0)
    assert len(striplog) == 14

    striplog.anneal()
    assert not striplog.find_gaps()  # Should be None

    rock = striplog.find('sandstone')[1].components[0]
    assert rock in striplog
示例#2
0
def test_from_image():
    legend = Legend.builtin("NSDOE")
    imgfile = "tutorial/M-MG-70_14.3_135.9.png"
    striplog = Striplog.from_img(imgfile, 200, 300, legend=legend)
    assert len(striplog) == 26
    assert striplog[-1].primary.summary() == "Volcanic"
    assert np.floor(striplog.find("sandstone").cum) == 15
    assert striplog.depth(260).primary.lithology == "siltstone"
    assert striplog.to_las3() is not ""
    assert striplog.to_log()[5] == 2.0
    assert striplog.cum == 100.0
    assert striplog.thickest().primary.lithology == "anhydrite"
    assert striplog.thickest(n=7)[1].primary.lithology == "sandstone"
    assert striplog.thinnest().primary.lithology == "dolomite"
    assert striplog.thinnest(n=7)[1].primary.lithology == "siltstone"

    indices = [2, 7, 20]
    del striplog[indices]
    assert len(striplog.find_gaps()) == len(indices)

    striplog.prune(limit=1.0)
    assert len(striplog) == 14

    striplog.anneal()
    assert not striplog.find_gaps()  # Should be None

    rock = striplog.find("sandstone")[1].components[0]
    assert rock in striplog
示例#3
0
def test_striplog_plot():
    """
    Tests mpl image of striplog
    """
    legend = Legend.default()

    imgfile = "tutorial/M-MG-70_14.3_135.9.png"

    striplog = Striplog.from_img(imgfile, 14.3, 135.9, legend=legend)

    fig = striplog.thickest(n=5).plot(legend=legend)
    return fig
示例#4
0
def test_striplog_plot():
    """
    Tests mpl image of striplog.
    """
    legend = Legend.builtin('NSDOE')

    imgfile = "tutorial/M-MG-70_14.3_135.9.png"

    striplog = Striplog.from_img(imgfile, 14.3, 135.9, legend=legend)

    fig = striplog.thickest(n=5).plot(legend=legend, return_fig=True)
    return fig
示例#5
0
def test_striplog_plot():
    """
    Tests mpl image of striplog
    """
    legend = Legend.builtin("NSDOE")

    imgfile = "tutorial/M-MG-70_14.3_135.9.png"

    striplog = Striplog.from_img(imgfile, 14.3, 135.9, legend=legend)

    fig = striplog.thickest(n=5).plot(legend=legend, return_fig=True)
    return fig
示例#6
0
def test_striplog_ladder_plot():
    """
    Tests mpl image of striplog with the ladder option.
    """
    legend = Legend.builtin('NSDOE')

    imgfile = "tutorial/M-MG-70_14.3_135.9.png"

    striplog = Striplog.from_img(imgfile, 14.3, 135.9, legend=legend)

    fig = striplog.thickest(n=5).plot(legend=legend,
                                      ladder=True,
                                      return_fig=True)
    return fig
示例#7
0
def test_well():

    fname = 'tutorial/P-129_out.LAS'
    well = Well(fname)
    assert well.well.DATE.data == '10-Oct-2007'
    assert well.data['GR'][0] == 46.69865036

    legend = Legend.default()
    f = 'tutorial/P-129_280_1935.png'
    name, start, stop = f.strip('.png').split('_')
    striplog = Striplog.from_img(f, float(start), float(stop), legend=legend, tolerance=35)
    well.add_striplog(striplog, "striplog")
    assert well.striplog.striplog.source == 'Image'
    assert well.striplog.striplog.start == 280.0
    assert len(well.striplogs_to_las3()) == 14841
示例#8
0
def test_well():

    fname = 'tutorial/P-129_out.LAS'
    well = Well(fname)
    assert well.well.DATE.data == '10-Oct-2007'
    assert well.data['GR'][0] == 46.69865036

    legend = Legend.default()
    f = 'tutorial/P-129_280_1935.png'
    name, start, stop = f.strip('.png').split('_')
    striplog = Striplog.from_img(f,
                                 float(start),
                                 float(stop),
                                 legend=legend,
                                 tolerance=35)
    well.add_striplog(striplog, "striplog")
    assert well.striplog.striplog.source == 'Image'
    assert well.striplog.striplog.start == 280.0
    assert len(well.striplogs_to_las3()) == 14841
示例#9
0
def test_from_image():
    """Test the generation of a striplog from an image.
    """
    legend = Legend.builtin('NSDOE')
    imgfile = "tutorial/M-MG-70_14.3_135.9.png"
    striplog = Striplog.from_img(imgfile, 200, 300, legend=legend)
    assert len(striplog) == 26
    assert striplog[-1].primary.summary() == 'Volcanic'
    assert np.floor(striplog.find('sandstone').cum) == 15
    assert striplog.depth(260).primary.lithology == 'siltstone'
    assert striplog.to_las3() is not ''
    assert striplog.cum == 100.0
    assert striplog.thickest().primary.lithology == 'anhydrite'
    assert striplog.thickest(n=7)[1].primary.lithology == 'sandstone'
    assert striplog.thinnest().primary.lithology == 'dolomite'
    assert striplog.thinnest(n=7)[1].primary.lithology == 'siltstone'

    # To and from log.
    log, basis, table = striplog.to_log(step=0.1524, return_meta=True)
    assert log[5] == 2.0
    strip = Striplog.from_log(log, basis=basis, components=table)
    assert len(strip) == len(striplog)
    strip2 = Striplog.from_log(log, basis=basis, cutoff=3, legend=legend)
    assert len(strip2) == 18

    # Extract log onto striplog.
    striplog.extract(log, basis=basis, name="Log", function=np.mean)
    assert striplog[0].primary.Log == 2.0

    # Indexing.
    indices = [2, 7, 20]
    del striplog[indices]
    assert len(striplog.find_gaps()) == len(indices)

    # Prune and anneal.
    striplog.prune(limit=1.0)
    assert len(striplog) == 14

    striplog.anneal()
    assert not striplog.find_gaps()  # Should be None

    rock = striplog.find('sandstone')[1].components[0]
    assert rock in striplog
示例#10
0
def test_striplog_intersect():
    """Test intersection. This example is from the tutorial.
    """
    chrono = Striplog([Interval(**{'top': 0,
                                   'base': 60,
                                   'components': [Component({'age': 'Holocene'})]
                                   }),
                       Interval(**{'top': 60,
                                   'base': 75,
                                   'components': [Component({'age': 'Palaeogene'})]
                                   }),
                       Interval(**{'top': 75,
                                   'base': 100,
                                   'components': [Component({'age': 'Cretaceous'})]
                                   }),
                       ])
    legend = Legend.builtin('NSDOE')
    imgfile = "tutorial/M-MG-70_14.3_135.9.png"
    strip = Striplog.from_img(imgfile, 14.3, 135.9, legend=legend)
    sands = strip.find('sandstone')
    cretaceous = chrono.find('Palaeogene')
    cret_sand = sands.intersect(cretaceous)
    assert len(cret_sand) == 3
    assert cret_sand.stop == 75