def get_evap_i(lat, elev, wind, srad, tmin, tmax, tavg, month): if month == 1: J = 15 else: J = 15 + (month - 1) * 30 latitude = pyeto.deg2rad(lat) atmosphericVapourPressure = pyeto.avp_from_tmin(tmin) saturationVapourPressure = pyeto.svp_from_t(tavg) ird = pyeto.inv_rel_dist_earth_sun(J) solarDeclination = pyeto.sol_dec(J) sha = [pyeto.sunset_hour_angle(l, solarDeclination) for l in latitude] extraterrestrialRad = [ pyeto.et_rad(x, solarDeclination, y, ird) for x, y in zip(latitude, sha) ] clearSkyRad = pyeto.cs_rad(elev, extraterrestrialRad) netInSolRadnet = pyeto.net_in_sol_rad(srad * 0.001, albedo=0.23) netOutSolRadnet = pyeto.net_out_lw_rad(tmin, tmax, srad * 0.001, clearSkyRad, atmosphericVapourPressure) netRadiation = pyeto.net_rad(netInSolRadnet, netOutSolRadnet) tempKelvin = pyeto.celsius2kelvin(tavg) windSpeed2m = pyeto.wind_speed_2m(wind, 10) slopeSvp = pyeto.delta_svp(tavg) atmPressure = pyeto.atm_pressure(elev) psyConstant = pyeto.psy_const(atmPressure) return pyeto.fao56_penman_monteith(netRadiation, tempKelvin, windSpeed2m, saturationVapourPressure, atmosphericVapourPressure, slopeSvp, psyConstant, shf=0.0)
tmin=[] tmax=[] t=[] rh_mean=[] ws=[] lat=pyeto.deg2rad(lat) day=1 sunshine_hours=[] ETO=[] #Completar los valores de ETo for j in range(0,len(Tmean["0"])): tmin=(Tmin["0"][j]) tmink=pyeto.celsius2kelvin(tmin) tmax=(Tmax["0"][j]) tmaxk=pyeto.celsius2kelvin(tmax) t=(Tmean["0"][j]) tk=pyeto.celsius2kelvin(t) rh_mean=(HR["0"][j]) ws=(VV["0"][j]) lat=pyeto.deg2rad(lat) day=day+1 sunshine_hours=(BS["0"][j]) #Radiacion neta sol_dec=pyeto.sol_dec(day) sha=pyeto.sunset_hour_angle(lat,sol_dec) daylight_hours=pyeto.daylight_hours(sha) ird=pyeto.inv_rel_dist_earth_sun(day) et_rad=pyeto.et_rad(lat, sol_dec, sha, ird)
def test_celsius2kelvin(self): self.assertEqual(pyeto.celsius2kelvin(0), 273.15)
coastal = True altitude = 147 rh_min = 13 rh_max = 88 ws = 1.3 tmean = pyeto.daily_mean_t(tmin, tmax) atmos_pres = pyeto.atm_pressure(altitude) psy = pyeto.psy_const(atmos_pres) # Humidity svp_tmin = pyeto.svp_from_t(tmin) svp_tmax = pyeto.svp_from_t(tmax) delta_svp = pyeto.delta_svp(tmean) svp = pyeto.mean_svp(tmin, tmax) avp = pyeto.avp_from_rhmin_rhmax(svp_tmin, svp_tmax, rh_min, rh_max) # Radiation sol_dec = pyeto.sol_dec(day_of_year) sha = pyeto.sunset_hour_angle(latitude, sol_dec) ird = pyeto.inv_rel_dist_earth_sun(day_of_year) et_rad = pyeto.et_rad(latitude, sol_dec, sha, ird) cs_rad = pyeto.cs_rad(altitude, et_rad) sol_rad = pyeto.sol_rad_from_t(et_rad, cs_rad, tmin, tmax, coastal) ni_sw_rad = pyeto.net_in_sol_rad(sol_rad) no_lw_rad = pyeto.net_out_lw_rad(pyeto.celsius2kelvin(tmin), pyeto.celsius2kelvin(tmax), sol_rad, cs_rad, avp) net_rad = pyeto.net_rad(ni_sw_rad, no_lw_rad) eto = pyeto.fao56_penman_monteith(net_rad, pyeto.celsius2kelvin(tmean), ws, svp, avp, delta_svp, psy) print eto
# Humidity svp_tmin = pyeto.svp_from_t(tmin) svp_tmax = pyeto.svp_from_t(tmax) delta_svp = pyeto.delta_svp(tmean) svp = pyeto.mean_svp(tmin, tmax) avp = pyeto.avp_from_rhmin_rhmax(svp_tmin, svp_tmax, rh_min, rh_max) # Radiation sol_dec = pyeto.sol_dec(day_of_year) sha = pyeto.sunset_hour_angle(latitude, sol_dec) ird = pyeto.inv_rel_dist_earth_sun(day_of_year) et_rad = pyeto.et_rad(latitude, sol_dec, sha, ird) cs_rad = pyeto.cs_rad(altitude, et_rad) sol_rad = pyeto.sol_rad_from_t(et_rad, cs_rad, tmin, tmax, coastal) ni_sw_rad = pyeto.net_in_sol_rad(sol_rad) no_lw_rad = pyeto.net_out_lw_rad(pyeto.celsius2kelvin(tmin), pyeto.celsius2kelvin(tmax), sol_rad, cs_rad, avp) net_rad = pyeto.net_rad(ni_sw_rad, no_lw_rad) eto = pyeto.fao56_penman_monteith(net_rad, pyeto.celsius2kelvin(tmean), ws, svp, avp, delta_svp, psy) print eto Forever check the time if not running if eto is <0 then turn on water var ontime = time.time() else time running = ontime - time.time() if time running > eto then turn off water