Пример #1
0
def test_adding_new_attribute_extra_rock_id():
    """Test adding an new attribute with an extra rock id."""
    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)

    new_attr = {"D": {1: 0.001, 2: 0.0001, 3: 5.3}}

    with pytest.raises(ValueError):
        lith.add_property(new_attr)
Пример #2
0
def test_adding_existing_attribute():
    """Test adding an existing attribute."""
    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)

    new_attr = {"K_sp": {1: 0.001, 2: 0.0001}}

    with pytest.raises(ValueError):
        lith.add_property(new_attr)
Пример #3
0
def test_adding_new_attribute_extra_rock_id():
    """Test adding an new attribute with an extra rock id."""
    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)

    new_attr = {"D": {1: 0.001, 2: 0.0001, 3: 5.3}}

    with pytest.raises(ValueError):
        lith.add_property(new_attr)
Пример #4
0
def test_adding_existing_attribute():
    """Test adding an existing attribute."""
    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)

    new_attr = {"K_sp": {1: 0.001, 2: 0.0001}}

    with pytest.raises(ValueError):
        lith.add_property(new_attr)
Пример #5
0
def test_adding_new_attribute_missing_rock_id():
    """Test adding an new attribute missing an existing rock id."""
    mg = RasterModelGrid(3, 3)
    z = 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)

    new_attr = {'D': {2: 0.0001}}

    with pytest.raises(ValueError):
        lith.add_property(new_attr)
Пример #6
0
def test_adding_new_attribute_missing_rock_id():
    """Test adding an new attribute missing an existing rock id."""
    mg = RasterModelGrid(3, 3)
    z = 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)

    new_attr = {'D': {2: 0.0001}}

    with pytest.raises(ValueError):
        lith.add_property(new_attr)