Ejemplo n.º 1
0
def test_deposit_with_no_rock_id():
    """Test that adding a deposit to Lithology with no id raises an error."""
    mg = RasterModelGrid(3, 3)
    mg.add_zeros("node", "topographic__elevation")
    thicknesses = [1, 2, 4, 1, 5]
    ids = [1, 2, 1, 2, 1]
    attrs = {"K_sp": {1: 0.001, 2: 0.0001}}
    lith = Lithology(mg, thicknesses, ids, attrs)
    with pytest.raises(ValueError):
        lith.add_layer(100)
Ejemplo n.º 2
0
def test_erode_to_zero_thickness():
    """Test that eroding Lithology to zero thickness raises an error."""
    mg = RasterModelGrid(3, 3)
    mg.add_zeros("node", "topographic__elevation")
    thicknesses = [1, 2, 4, 1, 5]
    ids = [1, 2, 1, 2, 1]
    attrs = {"K_sp": {1: 0.001, 2: 0.0001}}
    lith = Lithology(mg, thicknesses, ids, attrs)
    with pytest.raises(ValueError):
        lith.add_layer(-100)
Ejemplo n.º 3
0
def test_deposit_with_no_rock_id():
    """Test that adding a deposit to Lithology with no id raises an error."""
    mg = RasterModelGrid((3, 3))
    mg.add_zeros("node", "topographic__elevation")
    thicknesses = [1, 2, 4, 1, 5]
    ids = [1, 2, 1, 2, 1]
    attrs = {"K_sp": {1: 0.001, 2: 0.0001}}
    lith = Lithology(mg, thicknesses, ids, attrs)
    with pytest.raises(ValueError):
        lith.add_layer(100)
Ejemplo n.º 4
0
def test_erode_to_zero_thickness():
    """Test that eroding Lithology to zero thickness raises an error."""
    mg = RasterModelGrid((3, 3))
    mg.add_zeros("node", "topographic__elevation")
    thicknesses = [1, 2, 4, 1, 5]
    ids = [1, 2, 1, 2, 1]
    attrs = {"K_sp": {1: 0.001, 2: 0.0001}}
    lith = Lithology(mg, thicknesses, ids, attrs)
    with pytest.raises(ValueError):
        lith.add_layer(-100)
Ejemplo n.º 5
0
def test_deposit_with_bad_rock_id():
    """Test that adding a deposit to Lithology with no id raises an error."""
    mg = RasterModelGrid((3, 3))
    mg.add_zeros("topographic__elevation", at="node")
    thicknesses = [1, 2, 4, 1, 5]
    ids = [1, 2, 1, 2, 1]
    attrs = {"K_sp": {1: 0.001, 2: 0.0001}}
    lith = Lithology(mg, thicknesses, ids, attrs)
    with pytest.raises(ValueError):
        lith.add_layer(100, rock_id=3)

    ones = np.ones(mg.number_of_nodes)
    new_ids = [0, 1, 3, 4, 0, 1, 0, 1, 5]
    with pytest.raises(ValueError):
        lith.add_layer(ones, rock_id=new_ids)
Ejemplo n.º 6
0
def test_deposit_with_bad_rock_id():
    """Test that adding a deposit to Lithology with no id raises an error."""
    mg = RasterModelGrid(3, 3)
    mg.add_zeros("node", "topographic__elevation")
    thicknesses = [1, 2, 4, 1, 5]
    ids = [1, 2, 1, 2, 1]
    attrs = {"K_sp": {1: 0.001, 2: 0.0001}}
    lith = Lithology(mg, thicknesses, ids, attrs)
    with pytest.raises(ValueError):
        lith.add_layer(100, rock_id=3)

    ones = np.ones(mg.number_of_nodes)
    new_ids = [0, 1, 3, 4, 0, 1, 0, 1, 5]
    with pytest.raises(ValueError):
        lith.add_layer(ones, rock_id=new_ids)