Tag Archives: R

Reading SWAT output.hru files in R

The output.hru file is one of the most important output files of the SWAT (Soil and Water Assessment Tool) simulation model. It contains daily or monthly (depending on how you configured your simulation) time series of about 70 variables that are computed within the HRUs (hydrologic response units) of your simulation. The HRUs are the […]

Importar datos AEMET en formato ancho

Una pregunta recurrente es cómo importar eficientemente en R datos climatológicos en formato ‘ancho’ (del inglés wide), como los proporcionados en ocasiones por la Agencia Española de Meteorología (AEMET). Este es un ejemplo de un fichero de datos de este tipo: Estación Año  Mes 1  2  3  … 31 9245     1975 1   9  10 9 […]

SPEI R package, version 1.4

A new version of our SPEI R package has just been released on the CRAN site. From the NEWS file, the differences are: 1. Minor fixes to functions penman and pwm. 2. Documentation of the penman function defined by mistake ed as the saturation vapour pressure, while it should read ‘actual vapour pressure’. 3. Function […]

Daily potential evapotranspiration based on the Hargreaves equation

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 […]