def test_refet_hourly_func_values(hourly_params): """Test hourly RefET calculation at a single point and time""" # If I don't copy, the pop changes the test values in hourly_data() inputs = hourly_params.copy() surface = inputs.pop('surface') expected = inputs.pop('expected') # print('ETr: {}'.format(expected)) if surface.lower() == 'etr': assert float(Hourly(**inputs).etr()) == pytest.approx(expected, abs=0.01) elif surface.lower() == 'eto': assert float(Hourly(**inputs).eto()) == pytest.approx(expected, abs=0.01)
def test_refet_hourly_default_method_eto(): etr = Hourly(tmean=h_args['tmean'], ea=h_args['ea'], rs=h_args['rs'], uz=h_args['uz'], zw=s_args['zw'], elev=s_args['elev'], lat=s_args['lat'], lon=s_args['lon'], doy=h_args['doy'], time=h_args['time']).eto() assert float(etr) == pytest.approx(h_args['eto_asce'])
def test_refet_daily_etsz(surface, expected): etsz = Hourly(tmean=h_args['tmean'], ea=h_args['ea'], rs=h_args['rs'], uz=h_args['uz'], zw=s_args['zw'], elev=s_args['elev'], lat=s_args['lat'], lon=s_args['lon'], doy=h_args['doy'], time=h_args['time'], method='refet').etsz(surface) assert float(etsz) == pytest.approx(expected)
def test_refet_hourly_asce_method_eto(method, expected): eto = Hourly(tmean=h_args['tmean'], ea=h_args['ea'], rs=h_args['rs'], uz=h_args['uz'], zw=s_args['zw'], elev=s_args['elev'], lat=s_args['lat'], lon=s_args['lon'], doy=h_args['doy'], time=h_args['time'], method=method).eto() assert float(eto) == pytest.approx(expected)
def test_refet_hourly_lon_deg(): etr = Hourly(tmean=h_args['tmean'], ea=h_args['ea'], rs=h_args['rs'], uz=h_args['uz'], zw=s_args['zw'], elev=s_args['elev'], lat=s_args['lat'], lon=s_args['lon'] * math.pi / 180, doy=h_args['doy'], time=h_args['time'], input_units={ 'lon': 'rad' }).etr() assert float(etr) == pytest.approx(h_args['etr_asce'])
def test_refet_hourly_elev_ft(): etr = Hourly(tmean=h_args['tmean'], ea=h_args['ea'], rs=h_args['rs'], uz=h_args['uz'], zw=s_args['zw'], elev=s_args['elev'] / 0.3048, lat=s_args['lat'], lon=s_args['lon'], doy=h_args['doy'], time=h_args['time'], input_units={ 'elev': 'ft' }).etr() assert float(etr) == pytest.approx(h_args['etr_asce'])
def test_refet_hourly_rs_langleys(): etr = Hourly(tmean=h_args['tmean'], ea=h_args['ea'], rs=h_args['rs'] / 0.041868, uz=h_args['uz'], zw=s_args['zw'], elev=s_args['elev'], lat=s_args['lat'], lon=s_args['lon'], doy=h_args['doy'], time=h_args['time'], input_units={ 'rs': 'Langleys' }).etr() assert float(etr) == pytest.approx(h_args['etr_asce'])
def test_refet_hourly_tmean_f(): etr = Hourly(tmean=h_args['tmean'] * (9.0 / 5) + 32, ea=h_args['ea'], rs=h_args['rs'], uz=h_args['uz'], zw=s_args['zw'], elev=s_args['elev'], lat=s_args['lat'], lon=s_args['lon'], doy=h_args['doy'], time=h_args['time'], input_units={ 'tmean': 'F' }).etr() assert float(etr) == pytest.approx(h_args['etr_asce'])
def test_refet_hourly_input_positions(): etr = Hourly(h_args['tmean'], h_args['ea'], h_args['rs'], h_args['uz'], s_args['zw'], s_args['elev'], s_args['lat'], s_args['lon'], h_args['doy'], h_args['time'], 'asce').etr() assert float(etr) == pytest.approx(h_args['etr_asce'])