Data structure containing weather data for a given site for several years.
Details
All fields representing weather variables are vectors of length 365 times N, where N is the number of years for which weather data is stored. In other words, every variable has one value for each of the 365 of each of the N years.
Weather inputs
The weather input file should be organized as space separated columns
with a year
column and at least the following parameters as headers
(further columns are ignored):
DOY
day of year in given yearTa
average temperature of given day (Celsius).precip
precipitation in millimeter per day.PAR
photosynthetically active radiation in MJ/m^2^. Can be calculated from average sunlight irradianceSRad
in J/s/m^2^ as:PAR = SRad * 0.47 * 24 * 60 * 60 / 1e6
ET0
evapotranspiration in mm.
These parameters are stored in this object in the respective PARAM_vec
fields.
Snow model
The precipitation and temperature inputs are used in order to estimate the snow cover for each day by use of a snow model. The employed model is as formulated by Kokkonen et al. 2006 and makes use of parameters from Rango and Martinec, 1995.
References
Rango A, Martinec J (1995). “Revisiting the Degree-Day Method for Snowmelt Computations.” JAWRA Journal of the American Water Resources Association, 31(4), 657–669. ISSN 1752-1688, doi:10.1111/j.1752-1688.1995.tb03392.x .
Kokkonen T, Koivusalo H, Jakeman A, Norton J (2006). “Construction of a Degree-Day Snow Model in the Light of the Ten Iterative Steps in Model Development.” In iEMSs Third Biennial Meeting: "Summit on Environmental Modelling and Software". International Environmental Modelling and Software Society, Burlington, USA, July 2006.
Public fields
weather_file
Name of provided weather data file.
years
numeric Integer representation of the contained years.
vec_size
Length of the PARAM_vec vectors, which is equal to number of contained years times 365.
year_vec
Vector of length vec_size, holding the year for the respective index.
W
A list generated by
get_weather_for_year()
which contains weather data only for a given year. The keys in the list are:aCO2 (atmospheric CO2 concentration in ppm)
year
DOY
Ta
Ta_sm (smoothed daily average temperature)
PAR
PP
PET
liquidP
melt
snow
ndays (number of days in this year)
Methods
Method new()
Create a new WeatherData object.
Usage
WeatherData$new(weather_file = NULL, years = NULL)
Method ensure_file_integrity()
Check if supplied input file is formatted correctly.
Check if required column names are present and fix NA entries.
Method calculate_day_length()
Calculate the expected length of day based on a site's geographical latitude.
Method get_weather_for_year()
Extract state variables to the weather data for given year and return them as a list.