示例#1
0
def test_run_by_setting_attributes():
    """Test running a HydroTrend simulation."""
    d = Dakota(method="vector_parameter_study", plugin="hydrotrend")
    d.template_file = os.path.join(data_dir, "HYDRO.IN.dtmpl")
    d.auxiliary_files = os.path.join(data_dir, "HYDRO0.HYPS")
    d.variables.descriptors = [
        "starting_mean_annual_temperature",
        "total_annual_precipitation",
    ]
    d.variables.initial_point = [10.0, 1.5]
    d.method.final_point = [20.0, 2.5]
    d.method.n_steps = 5
    d.responses.response_descriptors = ["Qs_median", "Q_mean"]
    d.responses.response_files = ["HYDROASCII.QS", "HYDROASCII.Q"]
    d.responses.response_statistics = ["median", "mean"]
    d.setup()
    assert_true(os.path.exists(d.input_file))
    if is_dakota_installed() and is_hydrotrend_installed():
        d.run()
        assert_true(os.path.exists(d.output_file))
示例#2
0
def test_set_template_file():
    """Test setting the template_file property."""
    k = Dakota()
    template_file = "foo.tmpl"
    k.template_file = template_file
    assert_equal(os.path.basename(k.template_file), template_file)