Example #1
0
def test_refet_daily_surface_etr():
    refet = Daily(tmax=ee.Image.constant(d_args['tmax']),
                  tmin=ee.Image.constant(d_args['tmin']),
                  ea=ee.Image.constant(d_args['ea']),
                  rs=ee.Image.constant(d_args['rs']),
                  uz=ee.Image.constant(d_args['uz']),
                  zw=ee.Number(s_args['zw']),
                  elev=ee.Number(s_args['elev']),
                  lat=ee.Number(s_args['lat']),
                  doy=ee.Number(d_args['doy']),
                  method='refet')
    output = refet.etr()\
        .reduceRegion(ee.Reducer.first(), geometry=constant_geom, scale=1)\
        .getInfo()
    assert float(output['etr']) == pytest.approx(d_args['etr_refet'])
Example #2
0
def test_refet_daily_asce():
    refet = Daily(tmax=ee.Image.constant(d_args['tmax']),
                  tmin=ee.Image.constant(d_args['tmin']),
                  ea=ee.Image.constant(d_args['ea']),
                  rs=ee.Image.constant(d_args['rs']),
                  uz=ee.Image.constant(d_args['uz']),
                  zw=ee.Number(s_args['zw']),
                  elev=ee.Number(s_args['elev']),
                  lat=ee.Number(s_args['lat']),
                  doy=ee.Number(d_args['doy']),
                  method='asce')
    output = refet.etr().reduceRegion(reducer=ee.Reducer.first(),
                                      geometry=ee.Geometry.Rectangle(
                                          [0, 0, 10, 10], 'EPSG:32613', False),
                                      scale=1).getInfo()
    assert float(output['etr']) == pytest.approx(d_args['etr_asce'])