def Em(airtemp = scipy.array([]),\ rh = scipy.array([]),\ airpress = scipy.array([]),\ Rs = scipy.array([])): ''' Function to calculate Makkink evaporation (in mm/day): .. math:: E_m = 0.65 \\frac{R_s}{\\lambda} \\cdot \\frac{\\Delta}{\\Delta + \\gamma} The Makkink evaporation is a reference crop evaporation. It is a reference crop evaporation equation based on the Penman open water equation and represents evapotranspiration from short, well-watered grassland under Dutch climate conditions. Makkink reference evaporation values are published daily by the Royal Netherlands Meteorological Institute (KNMI) in the Netherlands. Values are used in combination with crop factors to provide daily estimates of actual crop evaporation for many crop types. 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 [Pa]. - Rs: (array of) average daily incoming solar radiation [J m-2 day-1]. Returns: - Em: (array of) Makkink evaporation values [mm day-1]. Notes ----- Meteorological measurements standard at 2 m above soil surface. References ---------- H.A.R. de Bruin (1987). From Penman to Makkink, in Hooghart, C. (Ed.), Evaporation and Weather, Proceedings and Information. Comm. Hydrological Research TNO, The Hague. pp. 5-30. Examples -------- >>> Em(21.65,67.0,101300.,24200000.) 4.503830479197991 ''' # Test input array/value airtemp,rh,airpress,Rs = meteolib._arraytest(airtemp,rh,airpress,Rs) # Calculate Delta and gamma constants DELTA = meteolib.Delta_calc(airtemp) gamma = meteolib.gamma_calc(airtemp,rh,airpress) Lambda = meteolib.L_calc(airtemp) # calculate Em [mm/day] Em = 0.65 * DELTA/(DELTA + gamma) * Rs / Lambda return Em
def Ept(airtemp = scipy.array([]),\ rh = scipy.array([]),\ airpress = scipy.array([]),\ Rn = scipy.array([]),\ G = scipy.array([])): ''' Function to calculate daily Priestley - Taylor evaporation: .. math:: E_{pt} = \\alpha \\frac{R_n - G}{\\lambda} \\cdot \\frac{\\Delta}{\\Delta + \\gamma} where alpha is set to 1.26. 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 [Pa]. - Rn: (array of) average daily net radiation [J m-2 day-1]. - G: (array of) average daily soil heat flux [J m-2 day-1]. Returns: - Ept: (array of) Priestley Taylor evaporation values [mm day-1]. Notes ----- Meteorological parameters normally measured at 2 m above the surface. References ---------- Priestley, C.H.B. and R.J. Taylor, 1972. On the assessment of surface heat flux and evaporation using large-scale parameters. Mon. Weather Rev. 100:81-82. Examples -------- >>> Ept(21.65,67.0,101300.,18200000.,600000.) 6.349456116128078 ''' # Test input array/value airtemp, rh, airpress, Rn, G = meteolib._arraytest(airtemp, rh, airpress, Rn, G) # Calculate Delta and gamma constants DELTA = meteolib.Delta_calc(airtemp) gamma = meteolib.gamma_calc(airtemp, rh, airpress) Lambda = meteolib.L_calc(airtemp) # calculate Em [mm/day] Ept = 1.26 * DELTA / (DELTA + gamma) * (Rn - G) / Lambda return Ept
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 Ept(airtemp = scipy.array([]),\ rh = scipy.array([]),\ airpress = scipy.array([]),\ Rn = scipy.array([]),\ G = scipy.array([])): ''' Function to calculate daily Priestley - Taylor evaporation (in mm). Source: Priestley, C.H.B. and R.J. Taylor, 1972. On the assessment of surface heat flux and evaporation using large-scale parameters. Mon. Weather Rev. 100:81-82. 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 [Pa] - Rn: (array of) average daily net radiation [J/m2/day] - G: (array of) average daily soil heat flux [J/m2/day] Output: - Ept: (array of) Priestley Taylor evaporation values [mm] Examples: >>> Ept_data = Ept(T,RH,press,Rn,G) >>> Ept(21.65,67.0,101300,18200000,600000) 6.3494561161280778 ''' # Calculate Delta and gamma constants DELTA = meteolib.Delta_calc(airtemp) gamma = meteolib.gamma_calc(airtemp, rh, airpress) Lambda = meteolib.L_calc(airtemp) # 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... # calculate Em [mm/day] Ept = 1.26 * DELTA / (DELTA + gamma) * (Rn - G) / Lambda else: # Dealing with an array # Initiate output array Ept = scipy.zeros(l) for i in range(0, l): # calculate Ept [mm/day] Ept[i] = 1.26 * DELTA[i] / (DELTA[i] + gamma[i]) * (Rn[i] - G[i]) / Lambda[i] Ept = scipy.array(Ept) return Ept
def Em(airtemp = scipy.array([]),\ rh = scipy.array([]),\ airpress = scipy.array([]),\ Rs = scipy.array([])): ''' Function to calculate Makkink evaporation (in mm/day). The Makkink evaporation is a reference crop evaporation used in the Netherlands, which is combined with a crop factor to provide an estimate of actual crop evaporation. Source: De Bruin, H.A.R.,1987. From Penman to Makkink', in Hooghart, C. (Ed.), Evaporation and Weather, Proceedings and Information. Comm. Hydrological Research TNO, The Hague. pp. 5-30. 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 [Pa] - Rs: (array of) average daily incoming solar radiation [J/m2/day] Output: - Em: (array of) Makkink evaporation values [mm] Examples: >>> Em_data = Em(T,RH,press,Rs) >>> Em(21.65,67.0,101300,24200000) 4.5038304791979913 ''' # Calculate Delta and gamma constants DELTA = meteolib.Delta_calc(airtemp) gamma = meteolib.gamma_calc(airtemp, rh, airpress) Lambda = meteolib.L_calc(airtemp) # 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... # calculate Em [mm/day] Em = 0.65 * DELTA / (DELTA + gamma) * Rs / Lambda else: # Dealing with an array # Initiate output array Em = scipy.zeros(l) for i in range(0, l): # calculate Em [mm/day] Em[i] = 0.65 * DELTA[i] / (DELTA[i] + gamma[i]) * Rs[i] / Lambda[i] Em = scipy.array(Em) return Em
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]