コード例 #1
0
def test_parameters(clock_simple):
    params = {
        "grid": {
            "HexModelGrid": [
                {"base_num_rows": 8, "base_num_cols": 5, "dx": 10},
                {
                    "fields": {
                        "node": {
                            "topographic__elevation": {
                                "constant": [{"value": 0}]
                            }
                        }
                    }
                },
            ]
        },
        "clock": {"step": 1, "stop": 10},
        "output_interval": 2,
    }

    em = ErosionModel.from_dict(params)
    assert isinstance(em.grid, HexModelGrid)
    assert em.grid.number_of_nodes == 56
    for field in at_node_fields:
        assert field in em.grid.at_node
    assert isinstance(em.flow_accumulator, FlowAccumulator) is True
    assert em.flow_accumulator.flow_director._name == "FlowDirectorSteepest"
    assert em.boundary_handlers == {}
    assert em.output_writers == {}
    assert em.save_first_timestep is True
    assert em._out_file_name == "terrainbento_output"
    assert em._model_time == 0.0
コード例 #2
0
def test_parameters(clock_simple):
    params = {
        "grid": {
            "HexModelGrid": [
                {
                    "shape": (8, 5),
                    "spacing": 10
                },
                {
                    "fields": {
                        "node": {
                            "topographic__elevation": {
                                "constant": [{
                                    "value": 0.0
                                }]
                            }
                        }
                    }
                },
            ]
        },
        "clock": {
            "step": 1,
            "stop": 10
        },
        "output_interval": 2,
        "output_default_netcdf": False,
    }

    em = ErosionModel.from_dict(params)
    assert isinstance(em.grid, HexModelGrid)
    assert em.grid.number_of_nodes == 56
    for field in at_node_fields:
        assert field in em.grid.at_node
    assert isinstance(em.flow_accumulator, FlowAccumulator) is True
    assert em.flow_accumulator.flow_director._name == "FlowDirectorSteepest"
    assert em.boundary_handlers == {}
    assert em.all_output_writers == []
    assert em.save_first_timestep is True
    assert em.output_prefix == "terrainbento-output"
    assert em._model_time == 0.0