def test_Image_et_fraction_elr_param(lst, dt, elev, tcorr, tmax, elr_flag,
                                     expected, tol=0.0001):
    """Test that elr_flag works and changes ETf values"""
    output_img = model.et_fraction(
        lst=ee.Image.constant(lst), tmax=ee.Image.constant(tmax),
        tcorr=tcorr, dt=dt, elr_flag=elr_flag, elev=elev)
    output = utils.constant_image_value(ee.Image(output_img))
    assert abs(output['et_fraction'] - expected) <= tol
def test_Image_et_fraction_clamp_nodata(lst, dt, tcorr, tmax, expected):
    """Test that ETf is set to nodata for ETf > 1.3"""
    output_img = model.et_fraction(lst=ee.Image.constant(lst),
                                   tmax=ee.Image.constant(tmax),
                                   tcorr=tcorr,
                                   dt=dt)
    output = utils.constant_image_value(ee.Image(output_img))
    assert output['et_fraction'] is None and expected is None
def test_Model_et_fraction_clamp_nodata(lst, dt, tcorr, tmax, expected):
    """Test that ETf is set to nodata for ETf > 2.0"""
    output_img = model.et_fraction(lst=ee.Image.constant(lst),
                                   tmax=ee.Image.constant(tmax),
                                   tcorr=tcorr,
                                   dt=dt)
    output = utils.constant_image_value(ee.Image(output_img))
    if expected is None:
        assert output['et_fraction'] is None
    else:
        assert abs(output['et_fraction'] - expected) <= 0.000001
Beispiel #4
0
def test_Model_et_fraction_values(lst,
                                  ndvi,
                                  dt,
                                  tcorr,
                                  tmax,
                                  expected,
                                  tol=0.0001):
    output = utils.constant_image_value(
        model.et_fraction(lst=ee.Image.constant(lst),
                          tmax=ee.Image.constant(tmax),
                          tcorr=tcorr,
                          dt=dt))
    assert abs(output['et_fraction'] - expected) <= tol