Beispiel #1
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_image(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.z == 75
Beispiel #2
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_image(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.read_at(260).primary.lithology == 'siltstone'
    assert striplog.to_las3() != ''
    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].data['Log'] == 2.0

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

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

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

    striplog = striplog.merge_neighbours()
    assert len(striplog) == 11

    rock = striplog.find('sandstone')[1].components[0]
    assert rock in striplog

    # Anneal up or down
    s = striplog[[1, 3]]
    assert s.anneal(mode='up')[1].top.z == s[0].base.z
    assert s.anneal(mode='down')[0].base.z == s[1].top.z
Beispiel #3
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_image(imgfile, 14.3, 135.9, legend=legend)

    fig = striplog.thickest(n=5).plot(legend=legend,
                                      ladder=True,
                                      return_fig=True)
    return fig
Beispiel #4
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_image(imgfile, 14.3, 135.9, legend=legend)

    fig = striplog.thickest(n=5).plot(legend=legend,
                                      ladder=True,
                                      return_fig=True)
    return fig
Beispiel #5
0
def test_striplog_colour_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_image(imgfile, 14.3, 135.9, legend=legend)

    for iv in striplog:
        iv.data['porosity'] = iv.top.z / 100

    fig = striplog.plot(colour='porosity', aspect=3, return_fig=True)

    return fig
Beispiel #6
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_image(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].data['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
Beispiel #7
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_image(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.z == 75