Exemple #1
0
def test_snowpack_dimension():

    m = Model("dmrt_qcacp_shortrange", DORT)

    temperatures = [200, 250, 270]

    sensor = amsre()
    snowpacks = [
        make_snowpack([2000],
                      StickyHardSpheres,
                      density=[250],
                      temperature=t,
                      radius=0.3e-3,
                      stickiness=0.2) for t in temperatures
    ]

    res = m.run(sensor,
                snowpacks,
                snowpack_dimension=('temperature', temperatures))

    assert np.allclose(res.temperature, temperatures)

    with pytest.raises(SMRTError):
        m.run(sensor,
              snowpacks,
              snowpack_dimension=(temperatures, 'temperature'))
Exemple #2
0
def setup_snowpack():
    # ### Make a snow layer
    sp = make_snowpack([2000],
                       StickyHardSpheres,
                       density=[250],
                       temperature=265,
                       radius=0.3e-3,
                       stickiness=0.2)
    return sp
Exemple #3
0
def test_joblib_parallel_run():

    m = Model("dmrt_qcacp_shortrange", DORT)

    sensor = amsre()
    snowpacks = [
        make_snowpack([2000],
                      StickyHardSpheres,
                      density=[250],
                      temperature=t,
                      radius=0.3e-3,
                      stickiness=0.2) for t in [200, 250, 270]
    ]

    m.run(sensor, snowpacks, parallel_computation=True)