def Epm(airtemp = scipy.array([]),\ rh = scipy.array([]),\ airpress = scipy.array([]),\ Rn = scipy.array([]),\ G = scipy.array([]),\ ra = scipy.array([]),\ rs = scipy.array([])): ''' Function to calculate the Penman Monteith evaporation (in mm) Monteith, J.L. (1965) Evaporation and environment. Symp. Soc. Exp. Biol. 19, 205-224 Input (measured at 2 m height): - airtemp: (array of) daily average air temperatures [C] - rh: (array of) daily average relative humidity values[%] - airpress: (array of) daily average air pressure data [hPa] - Rn: (array of) average daily net radiation [J] - G: (array of) average daily soil heat flux [J] - ra: aerodynamic resistance [s/m] - rs: surface resistance [s/m] Output: - Epm: (array of) Penman Monteith evaporation values [mm] Examples: >>> Epm_data = Epm(T,RH,press,Rn,G,ra,rs) ''' # Calculate Delta, gamma and lambda DELTA = meteolib.Delta_calc(airtemp) / 100. # [hPa/K] airpress = airpress * 100. # [Pa] gamma = meteolib.gamma_calc(airtemp, rh, airpress) / 100. # [hPa/K] Lambda = meteolib.L_calc(airtemp) # [J/kg] rho = meteolib.rho_calc(airtemp, rh, airpress) cp = meteolib.cp_calc(airtemp, rh, airpress) # Calculate saturated and actual water vapour pressures es = meteolib.es_calc(airtemp) / 100. # [hPa] ea = meteolib.ea_calc(airtemp, rh) / 100. # [hPa] # Determine length of array l = scipy.size(airtemp) # Check if we have a single value or an array if l < 2: # Dealing with single value... Epm = (DELTA * Rn + rho * cp * (es - ea) * ra / (DELTA + gamma * (1. + rs / ra))) / Lambda else: # Dealing with an array # Initiate output arrays Epm = scipy.zeros(l) for i in range(0, l): Epm = (DELTA[i]*Rn[i]+rho[i]*cp[i]*(es[i]-ea[i])*ra[i]/(DELTA[i] \ + gamma[i]*(1.+rs[i]/ra[i])))/Lambda[i] return Epm # actual ET in mm
def Epm(airtemp = scipy.array([]),\ rh = scipy.array([]),\ airpress = scipy.array([]),\ Rn = scipy.array([]),\ G = scipy.array([]),\ ra = scipy.array([]),\ rs = scipy.array([])): ''' Function to calculate the Penman Monteith evaporation (in mm) Monteith, J.L. (1965) Evaporation and environment. Symp. Soc. Exp. Biol. 19, 205-224 Input (measured at 2 m height): - airtemp: (array of) daily average air temperatures [C] - rh: (array of) daily average relative humidity values[%] - airpress: (array of) daily average air pressure data [hPa] - Rn: (array of) average daily net radiation [J] - G: (array of) average daily soil heat flux [J] - ra: aerodynamic resistance [s/m] - rs: surface resistance [s/m] Output: - Epm: (array of) Penman Monteith evaporation values [mm] Examples: >>> Epm_data = Epm(T,RH,press,Rn,G,ra,rs) ''' # Calculate Delta, gamma and lambda DELTA = meteolib.Delta_calc(airtemp)/100. # [hPa/K] airpress=airpress*100. # [Pa] gamma = meteolib.gamma_calc(airtemp,rh,airpress)/100. # [hPa/K] Lambda = meteolib.L_calc(airtemp) # [J/kg] rho = meteolib.rho_calc(airtemp,rh,airpress) cp = meteolib.cp_calc(airtemp,rh,airpress) # Calculate saturated and actual water vapour pressures es = meteolib.es_calc(airtemp)/100. # [hPa] ea = meteolib.ea_calc(airtemp,rh)/100. # [hPa] # Determine length of array l = scipy.size(airtemp) # Check if we have a single value or an array if l < 2: # Dealing with single value... Epm = (DELTA*Rn+rho*cp*(es-ea)*ra/(DELTA+gamma*(1.+rs/ra)))/Lambda else: # Dealing with an array # Initiate output arrays Epm = scipy.zeros(l) for i in range(0,l): Epm = (DELTA[i]*Rn[i]+rho[i]*cp[i]*(es[i]-ea[i])*ra[i]/(DELTA[i] \ + gamma[i]*(1.+rs[i]/ra[i])))/Lambda[i] return Epm # actual ET in mm
def half_hour_evaporation(airtemp=sp.array([]), rh=sp.array([]), airpress=sp.array([]), rs=sp.array([]), rext=sp.array([]), u=sp.array([]), z=0.0): """ Function to calculate daily Penman open water evaporation (in mm/30min). Equation according to Shuttleworth, W. J. 2007. "Putting the 'Vap' into Evaporation." Hydrology and Earth System Sciences 11 (1): 210-44. doi:10.5194/hess-11-210-2007. :param airtemp: average air temperature [Celsius] :param rh: relative humidity[%] :param airpress: average air pressure[Pa] :param rs: Incoming solar radiation [MJ/m2/30min] :param rext: Extraterrestrial radiation [MJ/m2/30min] :param u: average wind speed at 2 m from ground [m/s] :param z: site elevation, default is zero [metre] :return: Penman open water evaporation values [mm/30min] Examples: >>> half_hour_evaporation = E0(T,RH,press,Rs,N,Rext,u,1000.0) # at 1000 m a.s.l """ # Set constants albedo = 0.06 # open water albedo # Stefan boltzmann constant = 5.670373*10-8 J/m2/k4/s # http://en.wikipedia.org/wiki/Stefan-Boltzmann_constant # sigma = 5.670373*(10**-8) # J/m2/K4/s sigma = (1.02066714 * (10**-10) ) # Stefan Boltzmann constant MJ/m2/K4/30min # Calculate Delta, gamma and lambda delta = delta_calc(airtemp) # [Kpa/C] # Lambda = met.L_calc(airtemp)/(10**6) # [MJ/Kg] # gamma = met.gamma_calc(airtemp, rh, airpress)/1000 # Lambda = 2.501 -(0.002361*airtemp) # [MJ/kg] # gamma = (0.0016286 *(airpress/1000))/Lambda # Calculate saturated and actual water vapour pressure es = met.es_calc(airtemp) # [Pa] ea = met.ea_calc(airtemp, rh) # [Pa] # Determine length of array l = sp.size(airtemp) # Check if we have a single value or an array if l < 2: lambda_mj_kg = 2.501 - (0.002361 * airtemp) # [MJ/kg] gamma = (0.0016286 * (airpress / 1000)) / lambda_mj_kg rns = (1.0 - albedo) * rs # shortwave component [MJ/m2/30min] # calculate clear sky radiation Rs0 rs0 = (0.75 + (2E-5 * z)) * rext f = (1.35 * (rs / rs0)) - 0.35 epsilom = 0.34 - (-0.14 * sp.sqrt(ea / 1000)) rnl = f * epsilom * sigma * ( airtemp + 273.16)**4 # Longwave component [MJ/m2/30min] rnet = rns - rnl Ea = (1 + (0.536 * u)) * ((es / 1000) - (ea / 1000)) E0 = ((delta * rnet) + gamma * (6.43 * Ea)) / (lambda_mj_kg * (delta + gamma)) else: # Inititate output array E0 = sp.zeros(l) rns = sp.zeros(l) rs0 = sp.zeros(l) f = sp.zeros(l) epsilom = sp.zeros(l) rnl = sp.zeros(l) rnet = sp.zeros(l) Ea = sp.zeros(l) lambda_mj_kg = sp.zeros(l) gamma = sp.zeros(l) for i in range(0, l): lambda_mj_kg[i] = 2.501 - (0.002361 * airtemp[i]) gamma[i] = (0.0016286 * (airpress[i] / 1000)) / lambda_mj_kg[i] # calculate longwave radiation (MJ/m2/30min) rns[i] = (1.0 - albedo) * rs[i] # calculate clear sky radiation Rs0 rs0[i] = (0.75 + (2E-5 * z)) f[i] = (1.35 * (rs[i] / rs0[i])) - 0.35 epsilom[i] = 0.34 - (-0.14 * sp.sqrt(ea[i] / 1000)) rnl[i] = f[i] * epsilom[i] * sigma * ( airtemp[i] + 273.16)**4 # Longwave component [MJ/m2/30min] rnet[i] = rns[i] - rnl[i] Ea[i] = (1 + (0.536 * u[i])) * ((es[i] / 1000) - (ea[i] / 1000)) E0[i] = ((delta[i] * rnet[i]) + gamma[i] * (6.43 * Ea[i])) / (lambda_mj_kg[i] * (delta[i] + gamma[i])) return E0
def half_hour_E0( airtemp=sp.array([]), rh=sp.array([]), airpress=sp.array([]), Rs=sp.array([]), Rext=sp.array([]), u=sp.array([]), Z=0.0, ): """ Function to calculate daily Penman open water evaporation (in mm/30min). Equation according to Shuttleworth, W. J. 2007. "Putting the 'Vap' into Evaporation." Hydrology and Earth System Sciences 11 (1): 210-44. doi:10.5194/hess-11-210-2007. :param airtemp: average air temperature [Celsius] :param rh: relative humidity[%] :param airpress: average air pressure[Pa] :param Rs: Incoming solar radiation [MJ/m2/30min] :param Rext: Extraterrestrial radiation [MJ/m2/30min] :param u: average wind speed at 2 m from ground [m/s] :param Z: site elevation, default is zero [metre] :return: Penman open water evaporation values [mm/30min] """ # Set constants albedo = 0.06 # open water albedo # Stefan boltzmann constant = 5.670373*10-8 J/m2/k4/s # http://en.wikipedia.org/wiki/Stefan-Boltzmann_constant # sigma = 5.670373*(10**-8) # J/m2/K4/s sigma = 1.02066714 * (10 ** -10) # Stefan Boltzmann constant MJ/m2/K4/30min # Calculate Delta, gamma and lambda DELTA = delta_calc(airtemp) # [Kpa/C] # Lambda = met.L_calc(airtemp)/(10**6) # [MJ/Kg] # gamma = met.gamma_calc(airtemp, rh, airpress)/1000 # Lambda = 2.501 -(0.002361*airtemp) # [MJ/kg] # gamma = (0.0016286 *(airpress/1000))/Lambda # Calculate saturated and actual water vapour pressure es = met.es_calc(airtemp) # [Pa] ea = met.ea_calc(airtemp, rh) # [Pa] # Determine length of array l = sp.size(airtemp) # Check if we have a single value or an array if l < 2: Lambda = 2.501 - (0.002361 * airtemp) # [MJ/kg] gamma = (0.0016286 * (airpress / 1000)) / Lambda Rns = (1.0 - albedo) * Rs # shortwave component [MJ/m2/30min] # calculate clear sky radiation Rs0 Rs0 = (0.75 + (2e-5 * Z)) * Rext f = (1.35 * (Rs / Rs0)) - 0.35 epsilom = 0.34 - (-0.14 * sp.sqrt(ea / 1000)) Rnl = f * epsilom * sigma * (airtemp + 273.16) ** 4 # Longwave component [MJ/m2/30min] Rnet = Rns - Rnl Ea = (1 + (0.536 * u)) * ((es / 1000) - (ea / 1000)) E0 = ((DELTA * Rnet) + gamma * (6.43 * Ea)) / (Lambda * (DELTA + gamma)) else: # Inititate output array E0 = sp.zeros(l) Rns = sp.zeros(l) Rs0 = sp.zeros(l) f = sp.zeros(l) epsilom = sp.zeros(l) Rnl = sp.zeros(l) Rnet = sp.zeros(l) Ea = sp.zeros(l) Lambda = sp.zeros(l) gamma = sp.zeros(l) for i in range(0, l): Lambda[i] = 2.501 - (0.002361 * airtemp[i]) gamma[i] = (0.0016286 * (airpress[i] / 1000)) / Lambda[i] # calculate longwave radiation (MJ/m2/30min) Rns[i] = (1.0 - albedo) * Rs[i] # calculate clear sky radiation Rs0 Rs0[i] = 0.75 + (2e-5 * Z) f[i] = (1.35 * (Rs[i] / Rs0[i])) - 0.35 epsilom[i] = 0.34 - (-0.14 * sp.sqrt(ea[i] / 1000)) Rnl[i] = f[i] * epsilom[i] * sigma * (airtemp[i] + 273.16) ** 4 # Longwave component [MJ/m2/30min] Rnet[i] = Rns[i] - Rnl[i] Ea[i] = (1 + (0.536 * u[i])) * ((es[i] / 1000) - (ea[i] / 1000)) E0[i] = ((DELTA[i] * Rnet[i]) + gamma[i] * (6.43 * Ea[i])) / (Lambda[i] * (DELTA[i] + gamma[i])) return E0
def Epm(airtemp = scipy.array([]),\ rh = scipy.array([]),\ airpress = scipy.array([]),\ Rn = scipy.array([]),\ G = scipy.array([]),\ ra = scipy.array([]),\ rs = scipy.array([])): ''' Function to calculate the Penman Monteith evaporation. .. math:: E_{pm} = \\frac{\\Delta \\cdot (R_n-G)+\\rho \\cdot c_p \\cdot (e_s-e_a)/r_a}{\\lambda \\cdot (\\Delta + \\gamma \\cdot (1+\\frac{r_s}{r_a}))} The function can be used with different time intervals, such as commonly used hourly or daily time intervals are used. When a plant canopy is wet, the surface resistance (rs) becomes zero (stomatal resistance irrelevant, as evaporation is directly from wet leaf surface). Function ra() in this module can be used to calculate the aerodynamic resistance (ra) from wind speed and height parameters. Parameters: - airtemp: (array of) daily average air temperatures [Celsius]. - rh: (array of) daily average relative humidity values [%]. - airpress: (array of) daily average air pressure data [hPa]. - Rn: (array of) net radiation input over time interval t [J t-1]. - G: (array of) soil heat flux input over time interval t [J t-1]. - ra: aerodynamic resistance [s m-1]. - rs: surface resistance [s m-1]. Returns: - Epm: (array of) Penman Monteith evaporation values [mm t-1]. References ---------- J.L. Monteith (1965). Evaporation and environment. Symp. Soc. Exp. Biol. 19: 205-224. Examples -------- >>> Epm(21.67,67.0,1013.0,14100000.,500000.,104.,70.) 3.243341146049407 ''' # Test input array/value airtemp, rh, airpress, Rn, G, ra, rs = meteolib._arraytest( airtemp, rh, airpress, Rn, G, ra, rs) # Calculate Delta, gamma and lambda DELTA = meteolib.Delta_calc(airtemp) / 100. # [hPa/K] airpress = airpress * 100. # [Pa] gamma = meteolib.gamma_calc(airtemp, rh, airpress) / 100. # [hPa/K] Lambda = meteolib.L_calc(airtemp) # [J/kg] rho = meteolib.rho_calc(airtemp, rh, airpress) # [kg m-3] cp = meteolib.cp_calc(airtemp, rh, airpress) # [J kg-1 K-1] # Calculate saturated and actual water vapour pressures es = meteolib.es_calc(airtemp) / 100. # [hPa] ea = meteolib.ea_calc(airtemp, rh) / 100. # [hPa] # Calculate Epm Epm = ((DELTA * (Rn - G) + rho * cp * (es - ea) / ra) / (DELTA + gamma * (1. + rs / ra))) / Lambda return Epm # actual ET in mm
def ET0pm(airtemp = scipy.array([]),\ rh = scipy.array([]),\ airpress = scipy.array([]), \ Rs = scipy.array([]),\ Rext = scipy.array([]),\ u = scipy.array([]), \ Z=0.0): ''' Function to calculate daily Penman Monteith reference evaporation estimates. Parameters: - airtemp: (array of) daily average air temperatures [Celsius]. - rh: (array of) daily average relative humidity values [%]. - airpress: (array of) daily average air pressure data [hPa]. - Rs: (array of) total incoming shortwave radiation [J m-2 day-1]. - Rext: Incoming shortwave radiation at the top of the atmosphere\ [J m-2 day-1]. - u: windspeed [m s-1]. - Z: elevation [m], default is 0 m a.s.l. Returns: - ET0pm: (array of) Penman Monteith reference evaporation (short\ grass with optimum water supply) values [mm day-1]. Notes ----- Meteorological measuements standard at 2 m above soil surface. References ---------- R.G. Allen, L.S. Pereira, D. Raes and M. Smith (1998). Crop evapotranspiration - Guidelines for computing crop water requirements - FAO Irrigation and drainage paper 56. FAO - Food and Agriculture Organization of the United Nations, Rome, 1998. (http://www.fao.org/docrep/x0490e/x0490e07.htm) Examples -------- >>> ET0pm(20.67,67.0,101300.0,22600000.,42000000.,3.2) 4.7235349721073039 ''' # Test input array/value airtemp, rh, airpress, Rs, Rext, u = meteolib._arraytest( airtemp, rh, airpress, Rs, Rext, u) # Set constants albedo = 0.23 # short grass albedo sigma = 4.903E-3 # Stefan Boltzmann constant J/m2/K4/d # Calculate Delta, gamma and lambda DELTA = meteolib.Delta_calc(airtemp) # [Pa/K] gamma = meteolib.gamma_calc(airtemp, rh, airpress) # [Pa/K] Lambda = meteolib.L_calc(airtemp) # [J/kg] # Calculate saturated and actual water vapour pressures es = meteolib.es_calc(airtemp) # [Pa] ea = meteolib.ea_calc(airtemp, rh) # [Pa] Rns = (1.0 - albedo) * Rs # Shortwave component [J/m2/d] # Calculate clear sky radiation Rs0 Rs0 = (0.75 + 2E-5 * Z) * Rext # Clear sky radiation [J/m2/d] f = 1.35 * Rs / Rs0 - 0.35 epsilom = 0.34 - 0.14 * scipy.sqrt(ea / 1000) Rnl = f * epsilom * sigma * (airtemp + 273.15)**4 # Longwave component [J/m2/d] Rnet = Rns - Rnl # Net radiation [J/m2/d] ET0pm = (DELTA/1000.*Rnet/Lambda+900./(airtemp+273.16)*u*(es-ea)/1000\ *gamma/1000)/(DELTA/1000.+gamma/1000*(1.+0.34*u)) return ET0pm # FAO reference evaporation [mm/day]
def E0(airtemp = scipy.array([]),\ rh = scipy.array([]),\ airpress = scipy.array([]),\ Rs = scipy.array([]),\ Rext = scipy.array([]),\ u = scipy.array([]),\ alpha = 0.08,\ Z = 0.0): ''' Function to calculate daily Penman (open) water evaporation estimates: .. math:: E_0 = \\frac{R_n \\cdot \\Delta}{\\lambda \cdot (\\Delta + \\gamma)} + \\frac{6430000 \\cdot E_a \\cdot \\gamma}{\\lambda \\cdot (\\Delta+\\gamma)} Parameters: - airtemp: (array of) daily average air temperatures [Celsius]. - rh: (array of) daily average relative humidity [%]. - airpress: (array of) daily average air pressure data [Pa]. - Rs: (array of) daily incoming solar radiation [J m-2 day-1]. - Rext: (array of) daily extraterrestrial radiation [J m-2 day-1]. - u: (array of) daily average wind speed at 2 m [m s-1]. - alpha: albedo [-] set at 0.08 for open water by default. - Z: (array of) site elevation, default is 0 m a.s.l. Returns: - E0: (array of) Penman open water evaporation values [mm day-1]. Notes ----- Meteorological parameters measured at 2 m above the surface. Albedo alpha set by default at 0.08 for open water (Valiantzas, 2006). References ---------- - H.L. Penman (1948). Natural evaporation from open water, bare soil\ and grass. Proceedings of the Royal Society of London. Series A.\ Mathematical and Physical Sciences 193: 120-145. - H.L. Penman (1956). Evaporation: An introductory survey. Netherlands\ Journal of Agricultural Science 4: 9-29. - J.D. Valiantzas (2006). Simplified versions for the Penman\ evaporation equation using routine weather data. J. Hydrology 331:\ 690-702. Examples -------- >>> # With single values and default albedo/elevation >>> E0(20.67,67.0,101300.0,22600000.,42000000.,3.2) 6.6029208786994467 >>> # With albedo is 0.18 instead of default and default elevation >>> E0(20.67,67.0,101300.0,22600000.,42000000.,3.2,alpha=0.18) 5.9664248091431968 >>> # With standard albedo and Z= 250.0 m >>> E0(20.67,67.0,101300.0,22600000.,42000000.,3.2,Z=250.0) 6.6135588207586284 >>> # With albedo alpha = 0.18 and elevation Z = 1000 m a.s.l. >>> E0(20.67,67.0,101300.0,22600000.,42000000.,3.2,0.18,1000.) 6.00814764682986 ''' # Test input array/value airtemp, rh, airpress, Rs, Rext, u = meteolib._arraytest( airtemp, rh, airpress, Rs, Rext, u) # Set constants sigma = 4.903E-3 # Stefan Boltzmann constant J/m2/K4/d # Calculate Delta, gamma and lambda DELTA = meteolib.Delta_calc(airtemp) # [Pa/K] gamma = meteolib.gamma_calc(airtemp, rh, airpress) # [Pa/K] Lambda = meteolib.L_calc(airtemp) # [J/kg] # Calculate saturated and actual water vapour pressures es = meteolib.es_calc(airtemp) # [Pa] ea = meteolib.ea_calc(airtemp, rh) # [Pa] # calculate radiation components (J/m2/day) Rns = (1.0 - alpha) * Rs # Shortwave component [J/m2/d] Rs0 = (0.75 + 2E-5 * Z) * Rext # Calculate clear sky radiation Rs0 f = 1.35 * Rs / Rs0 - 0.35 epsilom = 0.34 - 0.14 * scipy.sqrt(ea / 1000) Rnl = f * epsilom * sigma * (airtemp + 273.15)**4 # Longwave component [J/m2/d] Rnet = Rns - Rnl # Net radiation [J/m2/d] Ea = (1 + 0.536 * u) * (es / 1000 - ea / 1000) E0 = (DELTA / (DELTA + gamma) * Rnet / Lambda + gamma / (DELTA + gamma) * 6430000 * Ea / Lambda) return E0
def E0(airtemp = scipy.array([]),\ rh = scipy.array([]),\ airpress = scipy.array([]),\ Rs = scipy.array([]),\ # N = scipy.array([]),\ Rext = scipy.array([]),\ u = scipy.array([]),\ Z=0.0): ''' Function to calculate daily Penman open water evaporation (in mm/day). Equation according to J.D. Valiantzas (2006). Simplified versions for the Penman evaporation equation using routine weather data. J. Hydrology 331: 690-702. Following Penman (1948,1956). Albedo set at 0.06 for open water. Input (measured at 2 m height): - airtemp: (array of) daily average air temperatures [Celsius] - rh: (array of) daily average relative humidity [%] - airpress: (array of) daily average air pressure data [Pa] - Rs: (array of) daily incoming solar radiation [J/m2/day] - N: (array of) maximum daily sunshine hours [h] - Rext: (array of) daily extraterrestrial radiation [J/m2/day] - u: (array of) daily average wind speed at 2 m [m/s] - Z: (array of) site elevation [m a.s.l.], default is zero... Output: - E0: (array of) Penman open water evaporation values [mm/day] Examples: >>> # T, RH, etc. are arrays of data... >>> E0_data = E0(T,RH,press,Rs,N,Rext,u) # for zero elevation >>> E0_data = E0(T,RH,press,Rs,N,Rext,u,1000.0) # at 1000 m a.s.l >>> # With single values and default elevation... >>> E0(20.67,67.0,101300.0,22600000,14.4,42000000,2.0) 6.3102099052283389 >>> # for elevation of 1.0 m a.s.l. >>> E0(21.65,67.0,101300.0,24200000,14.66,42200000,1.51,1.0) 6.5991748573832343 >>> ''' # Set constants albedo = 0.06 # Open water albedo sigma = 4.903E-3 # Stefan Boltzmann constant J/m2/K4/d # Calculate Delta, gamma and lambda DELTA = meteolib.Delta_calc(airtemp) # [Pa/K] gamma = meteolib.gamma_calc(airtemp,rh,airpress) # [Pa/K] Lambda = meteolib.L_calc(airtemp) # [J/kg] # Calculate saturated and actual water vapour pressures es = meteolib.es_calc(airtemp) # [Pa] ea = meteolib.ea_calc(airtemp,rh) # [Pa] # Determine length of array l = scipy.size(airtemp) # Check if we have a single value or an array if l < 2: # Dealing with single value... Rns = (1.0-albedo)*Rs # Shortwave component [J/m2/d] # Calculate clear sky radiation Rs0 Rs0 = (0.75+2E-5*Z)*Rext f = 1.35*Rs/Rs0-0.35 epsilom = 0.34-0.14*scipy.sqrt(ea/1000) Rnl = f*epsilom*sigma*(airtemp+273.15)**4 # Longwave component [J/m2/d] Rnet = Rns-Rnl # Net radiation [J/m2/d] Ea = (1+0.536*u)*(es/1000.-ea/1000.) E0 = DELTA/(DELTA+gamma)*Rnet/Lambda+gamma/(DELTA+gamma)*6430000*Ea/Lambda else: # Dealing with an array # Initiate output arrays E0 = scipy.zeros(l) Rns = scipy.zeros(l) Rs0 = scipy.zeros(l) f = scipy.zeros(l) epsilom = scipy.zeros(l) Rnl = scipy.zeros(l) Rnet = scipy.zeros(l) Ea = scipy.zeros(l) for i in range(0,l): # calculate longwave radiation component Rln (J/m2/day) Rns[i] = (1.0-albedo)*Rs[i] # Shortwave component [J/m2/d] # Calculate clear sky radiation Rs0 Rs0[i] = (0.75+2E-5*Z)*Rext[i] f[i] = 1.35*Rs[i]/Rs0[i]-0.35 epsilom[i] = 0.34-0.14*scipy.sqrt(ea[i]/1000) Rnl[i] = f[i]*epsilom[i]*sigma*(airtemp[i]+273.15)**4 # Longwave component [J/m2/d] Rnet[i] = Rns[i]-Rnl[i] # Net radiation [J/m2/d] Ea[i] = (1+0.536*u[i])*(es[i]/1000-ea[i]/1000) E0[i] = DELTA[i]/(DELTA[i]+gamma[i])*Rnet[i]/Lambda[i]+gamma[i]/(DELTA[i]+gamma[i])* \ 6430000*Ea[i]/Lambda[i] return E0
def ET0pm(airtemp = scipy.array([]),\ rh = scipy.array([]),\ airpress = scipy.array([]), \ Rs = scipy.array([]),\ N = scipy.array([]),\ Rext = scipy.array([]),\ u = scipy.array([]), \ Z=0.0): ''' Function to calculate daily Penman Monteith reference evaporation (in mm/day). Source: R.G. Allen, L.S. Pereira, D. Raes and M. Smith (1998). Crop evapotranspiration - Guidelines for computing crop water requirements - FAO Irrigation and drainage paper 56. FAO - Food and Agriculture Organization of the United Nations, Rome, 1998 Input (measured at 2 m height): - airtemp: (array of) daily average air temperatures [Celsius] - rh: (array of) daily average relative humidity values[%] - airpress: (array of) daily average air pressure data [hPa] - Rs: (array of) total incoming shortwave radiation [J/m2/day] - N: daylength [h] - Rext: Incoming shortwave radiation at the top of the atmosphere [J/m2/day] - u: windspeed [m/s] - Z: elevation [m], default is 0.0 m Output: - ET0pm: (array of) Penman Monteith reference evaporation (short grass with optimum water supply) values [mm] Examples:-- >>> Eref_data = ET0pm(T,RH,press,Rs,N,Rext,u) ''' # Set constants albedo = 0.23 # short grass albedo sigma = 4.903E-3 # Stefan Boltzmann constant J/m2/K4/d # Calculate Delta, gamma and lambda DELTA = meteolib.Delta_calc(airtemp) # [Pa/K] gamma = meteolib.gamma_calc(airtemp,rh,airpress) # [Pa/K] Lambda = meteolib.L_calc(airtemp) # [J/kg] # Calculate saturated and actual water vapour pressures es = meteolib.es_calc(airtemp) # [Pa] ea = meteolib.ea_calc(airtemp,rh) # [Pa] # Determine length of array l = scipy.size(airtemp) # Check if we have a single value or an array if l < 2: # Dealing with single value... Rns = (1.0-albedo)*Rs # Shortwave component [J/m2/d] # Calculate clear sky radiation Rs0 Rs0 = (0.75+2E-5*Z)*Rext # Clear sky radiation [J/m2/d] f = 1.35*Rs/Rs0-0.35 epsilom = 0.34-0.14*scipy.sqrt(ea/1000) Rnl = f*epsilom*sigma*(airtemp+273.15)**4 # Longwave component [J/m2/d] Rnet = Rns-Rnl # Net radiation [J/m2/d] ET0pm = (DELTA/1000.*Rnet/Lambda+900./(airtemp+273.16)*u*(es-ea)/1000\ *gamma/1000)/(DELTA/1000.+gamma/1000*(1.+0.34*u)) else: # Dealing with an array # Initiate output arrays ET0pm = scipy.zeros(l) Rns = scipy.zeros(l) Rs0 = scipy.zeros(l) f = scipy.zeros(l) epsilom = scipy.zeros(l) Rnl = scipy.zeros(l) Rnet = scipy.zeros(l) for i in range(0,l): # calculate longwave radiation component Rln (J/m2/day) Rns[i] = (1.0-albedo)*Rs[i] # Shortwave component [J/m2/d] # Calculate clear sky radiation Rs0 Rs0[i] = (0.75+2E-5*Z)*Rext[i] f[i] = 1.35*Rs[i]/Rs0[i]-0.35 epsilom[i] = 0.34-0.14*scipy.sqrt(ea[i]/1000) Rnl[i] = f[i]*epsilom[i]*sigma*(airtemp[i]+273.15)**4 # Longwave component [J/m2/d] Rnet[i] = Rns[i]-Rnl[i] # Net radiation [J/m2/d] ET0pm[i] = (DELTA[i]/1000.*Rnet[i]/Lambda[i]+900./(airtemp[i]+273.16)* \ u[i]*(es[i]-ea[i])/1000*gamma[i]/1000)/ \ (DELTA[i]/1000.+gamma[i]/1000*(1.+0.34*u[i])) return ET0pm # FAO reference evaporation [mm/day]
def E0(airtemp = scipy.array([]),\ rh = scipy.array([]),\ airpress = scipy.array([]),\ Rs = scipy.array([]),\ # N = scipy.array([]),\ Rext = scipy.array([]),\ u = scipy.array([]),\ Z=0.0): ''' Function to calculate daily Penman open water evaporation (in mm/day). Equation according to J.D. Valiantzas (2006). Simplified versions for the Penman evaporation equation using routine weather data. J. Hydrology 331: 690-702. Following Penman (1948,1956). Albedo set at 0.06 for open water. Input (measured at 2 m height): - airtemp: (array of) daily average air temperatures [Celsius] - rh: (array of) daily average relative humidity [%] - airpress: (array of) daily average air pressure data [Pa] - Rs: (array of) daily incoming solar radiation [J/m2/day] - N: (array of) maximum daily sunshine hours [h] - Rext: (array of) daily extraterrestrial radiation [J/m2/day] - u: (array of) daily average wind speed at 2 m [m/s] - Z: (array of) site elevation [m a.s.l.], default is zero... Output: - E0: (array of) Penman open water evaporation values [mm/day] Examples: >>> # T, RH, etc. are arrays of data... >>> E0_data = E0(T,RH,press,Rs,N,Rext,u) # for zero elevation >>> E0_data = E0(T,RH,press,Rs,N,Rext,u,1000.0) # at 1000 m a.s.l >>> # With single values and default elevation... >>> E0(20.67,67.0,101300.0,22600000,14.4,42000000,2.0) 6.3102099052283389 >>> # for elevation of 1.0 m a.s.l. >>> E0(21.65,67.0,101300.0,24200000,14.66,42200000,1.51,1.0) 6.5991748573832343 >>> ''' # Set constants albedo = 0.06 # Open water albedo sigma = 4.903E-3 # Stefan Boltzmann constant J/m2/K4/d # Calculate Delta, gamma and lambda DELTA = meteolib.Delta_calc(airtemp) # [Pa/K] gamma = meteolib.gamma_calc(airtemp, rh, airpress) # [Pa/K] Lambda = meteolib.L_calc(airtemp) # [J/kg] # Calculate saturated and actual water vapour pressures es = meteolib.es_calc(airtemp) # [Pa] ea = meteolib.ea_calc(airtemp, rh) # [Pa] # Determine length of array l = scipy.size(airtemp) # Check if we have a single value or an array if l < 2: # Dealing with single value... Rns = (1.0 - albedo) * Rs # Shortwave component [J/m2/d] # Calculate clear sky radiation Rs0 Rs0 = (0.75 + 2E-5 * Z) * Rext f = 1.35 * Rs / Rs0 - 0.35 epsilom = 0.34 - 0.14 * scipy.sqrt(ea / 1000) Rnl = f * epsilom * sigma * (airtemp + 273.15)**4 # Longwave component [J/m2/d] Rnet = Rns - Rnl # Net radiation [J/m2/d] Ea = (1 + 0.536 * u) * (es / 1000. - ea / 1000.) E0 = DELTA / (DELTA + gamma) * Rnet / Lambda + gamma / ( DELTA + gamma) * 6430000 * Ea / Lambda else: # Dealing with an array # Initiate output arrays E0 = scipy.zeros(l) Rns = scipy.zeros(l) Rs0 = scipy.zeros(l) f = scipy.zeros(l) epsilom = scipy.zeros(l) Rnl = scipy.zeros(l) Rnet = scipy.zeros(l) Ea = scipy.zeros(l) for i in range(0, l): # calculate longwave radiation component Rln (J/m2/day) Rns[i] = (1.0 - albedo) * Rs[i] # Shortwave component [J/m2/d] # Calculate clear sky radiation Rs0 Rs0[i] = (0.75 + 2E-5 * Z) * Rext[i] f[i] = 1.35 * Rs[i] / Rs0[i] - 0.35 epsilom[i] = 0.34 - 0.14 * scipy.sqrt(ea[i] / 1000) Rnl[i] = f[i] * epsilom[i] * sigma * ( airtemp[i] + 273.15)**4 # Longwave component [J/m2/d] Rnet[i] = Rns[i] - Rnl[i] # Net radiation [J/m2/d] Ea[i] = (1 + 0.536 * u[i]) * (es[i] / 1000 - ea[i] / 1000) E0[i] = DELTA[i]/(DELTA[i]+gamma[i])*Rnet[i]/Lambda[i]+gamma[i]/(DELTA[i]+gamma[i])* \ 6430000*Ea[i]/Lambda[i] return E0
def ET0pm(airtemp = scipy.array([]),\ rh = scipy.array([]),\ airpress = scipy.array([]), \ Rs = scipy.array([]),\ N = scipy.array([]),\ Rext = scipy.array([]),\ u = scipy.array([]), \ Z=0.0): ''' Function to calculate daily Penman Monteith reference evaporation (in mm/day). Source: R.G. Allen, L.S. Pereira, D. Raes and M. Smith (1998). Crop evapotranspiration - Guidelines for computing crop water requirements - FAO Irrigation and drainage paper 56. FAO - Food and Agriculture Organization of the United Nations, Rome, 1998 Input (measured at 2 m height): - airtemp: (array of) daily average air temperatures [Celsius] - rh: (array of) daily average relative humidity values[%] - airpress: (array of) daily average air pressure data [hPa] - Rs: (array of) total incoming shortwave radiation [J/m2/day] - N: daylength [h] - Rext: Incoming shortwave radiation at the top of the atmosphere [J/m2/day] - u: windspeed [m/s] - Z: elevation [m], default is 0.0 m Output: - ET0pm: (array of) Penman Monteith reference evaporation (short grass with optimum water supply) values [mm] Examples:-- >>> Eref_data = ET0pm(T,RH,press,Rs,N,Rext,u) ''' # Set constants albedo = 0.23 # short grass albedo sigma = 4.903E-3 # Stefan Boltzmann constant J/m2/K4/d # Calculate Delta, gamma and lambda DELTA = meteolib.Delta_calc(airtemp) # [Pa/K] gamma = meteolib.gamma_calc(airtemp, rh, airpress) # [Pa/K] Lambda = meteolib.L_calc(airtemp) # [J/kg] # Calculate saturated and actual water vapour pressures es = meteolib.es_calc(airtemp) # [Pa] ea = meteolib.ea_calc(airtemp, rh) # [Pa] # Determine length of array l = scipy.size(airtemp) # Check if we have a single value or an array if l < 2: # Dealing with single value... Rns = (1.0 - albedo) * Rs # Shortwave component [J/m2/d] # Calculate clear sky radiation Rs0 Rs0 = (0.75 + 2E-5 * Z) * Rext # Clear sky radiation [J/m2/d] f = 1.35 * Rs / Rs0 - 0.35 epsilom = 0.34 - 0.14 * scipy.sqrt(ea / 1000) Rnl = f * epsilom * sigma * (airtemp + 273.15)**4 # Longwave component [J/m2/d] Rnet = Rns - Rnl # Net radiation [J/m2/d] ET0pm = (DELTA/1000.*Rnet/Lambda+900./(airtemp+273.16)*u*(es-ea)/1000\ *gamma/1000)/(DELTA/1000.+gamma/1000*(1.+0.34*u)) else: # Dealing with an array # Initiate output arrays ET0pm = scipy.zeros(l) Rns = scipy.zeros(l) Rs0 = scipy.zeros(l) f = scipy.zeros(l) epsilom = scipy.zeros(l) Rnl = scipy.zeros(l) Rnet = scipy.zeros(l) for i in range(0, l): # calculate longwave radiation component Rln (J/m2/day) Rns[i] = (1.0 - albedo) * Rs[i] # Shortwave component [J/m2/d] # Calculate clear sky radiation Rs0 Rs0[i] = (0.75 + 2E-5 * Z) * Rext[i] f[i] = 1.35 * Rs[i] / Rs0[i] - 0.35 epsilom[i] = 0.34 - 0.14 * scipy.sqrt(ea[i] / 1000) Rnl[i] = f[i] * epsilom[i] * sigma * ( airtemp[i] + 273.15)**4 # Longwave component [J/m2/d] Rnet[i] = Rns[i] - Rnl[i] # Net radiation [J/m2/d] ET0pm[i] = (DELTA[i]/1000.*Rnet[i]/Lambda[i]+900./(airtemp[i]+273.16)* \ u[i]*(es[i]-ea[i])/1000*gamma[i]/1000)/ \ (DELTA[i]/1000.+gamma[i]/1000*(1.+0.34*u[i])) return ET0pm # FAO reference evaporation [mm/day]
def Epm(airtemp = scipy.array([]),\ rh = scipy.array([]),\ airpress = scipy.array([]),\ Rn = scipy.array([]),\ G = scipy.array([]),\ ra = scipy.array([]),\ rs = scipy.array([])): ''' Function to calculate the Penman Monteith evaporation. .. math:: E_{pm} = \\frac{\\Delta \\cdot (R_n-G)+\\rho \\cdot c_p \\cdot (e_s-e_a)/r_a}{\\lambda \\cdot (\\Delta + \\gamma \\cdot (1+\\frac{r_s}{r_a}))} The function can be used with different time intervals, such as commonly used hourly or daily time intervals are used. When a plant canopy is wet, the surface resistance (rs) becomes zero (stomatal resistance irrelevant, as evaporation is directly from wet leaf surface). Function ra() in this module can be used to calculate the aerodynamic resistance (ra) from wind speed and height parameters. Parameters: - airtemp: (array of) daily average air temperatures [Celsius]. - rh: (array of) daily average relative humidity values [%]. - airpress: (array of) daily average air pressure data [hPa]. - Rn: (array of) net radiation input over time interval t [J t-1]. - G: (array of) soil heat flux input over time interval t [J t-1]. - ra: aerodynamic resistance [s m-1]. - rs: surface resistance [s m-1]. Returns: - Epm: (array of) Penman Monteith evaporation values [mm t-1]. References ---------- J.L. Monteith (1965). Evaporation and environment. Symp. Soc. Exp. Biol. 19: 205-224. Examples -------- >>> Epm(21.67,67.0,1013.0,14100000.,500000.,104.,70.) 3.243341146049407 ''' # Test input array/value airtemp,rh,airpress,Rn,G,ra,rs = meteolib._arraytest(airtemp,rh,airpress,Rn,G,ra,rs) # Calculate Delta, gamma and lambda DELTA = meteolib.Delta_calc(airtemp)/100. # [hPa/K] airpress=airpress*100. # [Pa] gamma = meteolib.gamma_calc(airtemp,rh,airpress)/100. # [hPa/K] Lambda = meteolib.L_calc(airtemp) # [J/kg] rho = meteolib.rho_calc(airtemp,rh,airpress) # [kg m-3] cp = meteolib.cp_calc(airtemp,rh,airpress) # [J kg-1 K-1] # Calculate saturated and actual water vapour pressures es = meteolib.es_calc(airtemp)/100. # [hPa] ea = meteolib.ea_calc(airtemp,rh)/100. # [hPa] # Calculate Epm Epm = ((DELTA*(Rn-G)+rho*cp*(es-ea)/ra)/(DELTA+gamma*(1.+rs/ra)))/Lambda return Epm # actual ET in mm
def ET0pm(airtemp = scipy.array([]),\ rh = scipy.array([]),\ airpress = scipy.array([]), \ Rs = scipy.array([]),\ Rext = scipy.array([]),\ u = scipy.array([]), \ Z=0.0): ''' Function to calculate daily Penman Monteith reference evaporation estimates. Parameters: - airtemp: (array of) daily average air temperatures [Celsius]. - rh: (array of) daily average relative humidity values [%]. - airpress: (array of) daily average air pressure data [hPa]. - Rs: (array of) total incoming shortwave radiation [J m-2 day-1]. - Rext: Incoming shortwave radiation at the top of the atmosphere\ [J m-2 day-1]. - u: windspeed [m s-1]. - Z: elevation [m], default is 0 m a.s.l. Returns: - ET0pm: (array of) Penman Monteith reference evaporation (short\ grass with optimum water supply) values [mm day-1]. Notes ----- Meteorological measuements standard at 2 m above soil surface. References ---------- R.G. Allen, L.S. Pereira, D. Raes and M. Smith (1998). Crop evapotranspiration - Guidelines for computing crop water requirements - FAO Irrigation and drainage paper 56. FAO - Food and Agriculture Organization of the United Nations, Rome, 1998. (http://www.fao.org/docrep/x0490e/x0490e07.htm) Examples -------- >>> ET0pm(20.67,67.0,101300.0,22600000.,42000000.,3.2) 4.7235349721073039 ''' # Test input array/value airtemp,rh,airpress,Rs,Rext,u = meteolib._arraytest(airtemp,rh,airpress,Rs,Rext,u) # Set constants albedo = 0.23 # short grass albedo sigma = 4.903E-3 # Stefan Boltzmann constant J/m2/K4/d # Calculate Delta, gamma and lambda DELTA = meteolib.Delta_calc(airtemp) # [Pa/K] gamma = meteolib.gamma_calc(airtemp,rh,airpress) # [Pa/K] Lambda = meteolib.L_calc(airtemp) # [J/kg] # Calculate saturated and actual water vapour pressures es = meteolib.es_calc(airtemp) # [Pa] ea = meteolib.ea_calc(airtemp,rh) # [Pa] Rns = (1.0-albedo)*Rs # Shortwave component [J/m2/d] # Calculate clear sky radiation Rs0 Rs0 = (0.75+2E-5*Z)*Rext # Clear sky radiation [J/m2/d] f = 1.35*Rs/Rs0-0.35 epsilom = 0.34-0.14*scipy.sqrt(ea/1000) Rnl = f*epsilom*sigma*(airtemp+273.15)**4 # Longwave component [J/m2/d] Rnet = Rns-Rnl # Net radiation [J/m2/d] ET0pm = (DELTA/1000.*Rnet/Lambda+900./(airtemp+273.16)*u*(es-ea)/1000\ *gamma/1000)/(DELTA/1000.+gamma/1000*(1.+0.34*u)) return ET0pm # FAO reference evaporation [mm/day]
def E0(airtemp = scipy.array([]),\ rh = scipy.array([]),\ airpress = scipy.array([]),\ Rs = scipy.array([]),\ Rext = scipy.array([]),\ u = scipy.array([]),\ alpha = 0.08,\ Z = 0.0): ''' Function to calculate daily Penman (open) water evaporation estimates: .. math:: E_0 = \\frac{R_n \\cdot \\Delta}{\\lambda \cdot (\\Delta + \\gamma)} + \\frac{6430000 \\cdot E_a \\cdot \\gamma}{\\lambda \\cdot (\\Delta+\\gamma)} Parameters: - airtemp: (array of) daily average air temperatures [Celsius]. - rh: (array of) daily average relative humidity [%]. - airpress: (array of) daily average air pressure data [Pa]. - Rs: (array of) daily incoming solar radiation [J m-2 day-1]. - Rext: (array of) daily extraterrestrial radiation [J m-2 day-1]. - u: (array of) daily average wind speed at 2 m [m s-1]. - alpha: albedo [-] set at 0.08 for open water by default. - Z: (array of) site elevation, default is 0 m a.s.l. Returns: - E0: (array of) Penman open water evaporation values [mm day-1]. Notes ----- Meteorological parameters measured at 2 m above the surface. Albedo alpha set by default at 0.08 for open water (Valiantzas, 2006). References ---------- - H.L. Penman (1948). Natural evaporation from open water, bare soil\ and grass. Proceedings of the Royal Society of London. Series A.\ Mathematical and Physical Sciences 193: 120-145. - H.L. Penman (1956). Evaporation: An introductory survey. Netherlands\ Journal of Agricultural Science 4: 9-29. - J.D. Valiantzas (2006). Simplified versions for the Penman\ evaporation equation using routine weather data. J. Hydrology 331:\ 690-702. Examples -------- >>> # With single values and default albedo/elevation >>> E0(20.67,67.0,101300.0,22600000.,42000000.,3.2) 6.6029208786994467 >>> # With albedo is 0.18 instead of default and default elevation >>> E0(20.67,67.0,101300.0,22600000.,42000000.,3.2,alpha=0.18) 5.9664248091431968 >>> # With standard albedo and Z= 250.0 m >>> E0(20.67,67.0,101300.0,22600000.,42000000.,3.2,Z=250.0) 6.6135588207586284 >>> # With albedo alpha = 0.18 and elevation Z = 1000 m a.s.l. >>> E0(20.67,67.0,101300.0,22600000.,42000000.,3.2,0.18,1000.) 6.00814764682986 ''' # Test input array/value airtemp,rh,airpress,Rs,Rext,u = meteolib._arraytest(airtemp,rh,airpress,Rs,Rext,u) # Set constants sigma = 4.903E-3 # Stefan Boltzmann constant J/m2/K4/d # Calculate Delta, gamma and lambda DELTA = meteolib.Delta_calc(airtemp) # [Pa/K] gamma = meteolib.gamma_calc(airtemp,rh,airpress) # [Pa/K] Lambda = meteolib.L_calc(airtemp) # [J/kg] # Calculate saturated and actual water vapour pressures es = meteolib.es_calc(airtemp) # [Pa] ea = meteolib.ea_calc(airtemp,rh) # [Pa] # calculate radiation components (J/m2/day) Rns = (1.0-alpha)*Rs # Shortwave component [J/m2/d] Rs0 = (0.75+2E-5*Z)*Rext # Calculate clear sky radiation Rs0 f = 1.35*Rs/Rs0-0.35 epsilom = 0.34-0.14*scipy.sqrt(ea/1000) Rnl = f*epsilom*sigma*(airtemp+273.15)**4 # Longwave component [J/m2/d] Rnet = Rns-Rnl # Net radiation [J/m2/d] Ea = (1+0.536*u)*(es/1000-ea/1000) E0 = (DELTA/(DELTA+gamma)*Rnet/Lambda+gamma/(DELTA+gamma)* 6430000*Ea/Lambda) return E0