Exemple #1
0
def get_interval_list(bh):
    """create a list of interval from a list of boreholeORM ojects
    
    Parameters
    ----------
    bh: list
        list of boreholeORM object
         
    
    Returns
    -------
    interval_list: list
                   list of Interval objects
                   
    """
    interval_list = []
    for i in bh.intervals.values():
        top = Position(upper=i.top.upper,
                       middle=i.top.middle,
                       lower=i.top.lower,
                       x=i.top.x,
                       y=i.top.y)
        base = Position(upper=i.base.upper,
                        middle=i.base.middle,
                        lower=i.base.lower,
                        x=i.top.x,
                        y=i.top.y)
        comp = Component.from_text(i.description)
        interval_list.append(
            Interval(top=top,
                     base=base,
                     description=i.description,
                     components=[comp]))
    return interval_list
Exemple #2
0
def test_position():
    """ Test intervals.
    """
    meta = {'character': 'erosive',
            'rugosity': '3 m',
            }
    position = Position(middle=None,
                        upper=1,
                        lower=2,
                        x=1000,
                        y=2000,
                        meta=meta)
    assert position.z == 1.5
    assert position.span == (2, 1)
    assert position.uncertainty == 1.0
    position.invert()
    assert position.span == (1, 2)
Exemple #3
0
def test_position():
    """ Test intervals.
    """
    meta = {
        'character': 'erosive',
        'rugosity': '3 m',
    }
    position = Position(middle=None,
                        upper=1,
                        lower=2,
                        x=1000,
                        y=2000,
                        meta=meta)
    assert position.z == 1.5
    assert position.span == (2, 1)
    assert position.uncertainty == 1.0
    position.invert()
    assert position.span == (1, 2)
Exemple #4
0
def test_position_html():
    """For jupyter notebook
    """
    position = Position(**{'upper': 75, 'lower': 85})
    html = """<table><tr><td><strong>upper</strong></td><td>75.0</td></tr><tr><td><strong>middle</strong></td><td></td></tr><tr><td><strong>lower</strong></td><td>85.0</td></tr></table>"""
    assert position._repr_html_() == html
Exemple #5
0
def test_incomplete_coords_error():
    """ Test the PositionError.
    """
    with pytest.raises(PositionError):
        Position(middle=1, x=1000)
Exemple #6
0
def test_incomplete_error():
    """ Test the PositionError.
    """
    with pytest.raises(PositionError):
        Position(middle=None, upper=1)
Exemple #7
0
def test_position_html():
    """For jupyter notebook
    """
    position = Position(**{'upper': 75, 'lower': 85})
    html = """<table><tr><td><strong>upper</strong></td><td>75.0</td></tr><tr><td><strong>middle</strong></td><td></td></tr><tr><td><strong>lower</strong></td><td>85.0</td></tr></table>"""
    assert position._repr_html_() == html