A handy little R function for computing Hargreaves potential evapotranspiration at the daily scale.
# Compute Hagreaves daily pot. evapotranspiration, based on:
# tmin: a vector of minimum daily temperatures (ºC)
# tmax: a vector of maximum daily temperatures (ºC)
# times: a vector of dates corresponding to the temperature observations (POSIXlt)
# lat: latitude of the site
# A matrix of temperature and latitude values can be provided as a convenient way
# to obtain PET for a number of observatories.
# NA in any of the input variables will generate a NA value.
hargreavesDay - function (tmin, tmax, times, lat) { n - length(tmin) ET0 - tmin * NA T - (tmin + tmax)/2 Tr - tmax — tmin Tr - ifelse(Tr 0, 0, Tr) J - times$yday+1 delta - 0.409 * sin(0.0172 * J — 1.39) dr - 1 + 0.033 * cos(0.0172 * J) latr - lat/57.2957795 sset - ‑tan(latr) * tan(delta) omegas - sset * 0 omegas[sset>={-1} & sset=1] - acos(sset[sset>={-1} & sset=1]) omegas[sset{-1}] - max(omegas) Ra - 37.6 * dr * (omegas * sin(latr) * sin(delta) + cos(latr) * cos(delta) * sin(omegas)) Ra - ifelse(Ra 0, 0, Ra) ET0 - 0.0023 * 0.408 * Ra * (T + 17.8) * Tr^0.5 ET0 - ifelse(ET0 0, 0, ET0) return(ET0) }
Sin comentarios