| WeatherData | R Documentation |
Data structure containing weather data for a given site for several years.
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.
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 year
Ta 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 irradiance SRad 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.
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.
weather_fileName of provided weather data file.
yearsnumeric Integer representation of the contained years.
vec_sizeLength of the PARAM_vec vectors, which is equal to number of contained years times 365.
year_vecVector of length vec_size, holding the year for the respective index.
WA 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)
new()Create a new WeatherData object.
WeatherData$new(weather_file = NULL, years = NULL)
weather_filestring Path to file containing the weather data to be read.
yearsnumeric Vector of years for which the weather is to be extracted.
read_weather()Read weather data from supplied weather_file.
WeatherData$read_weather(weather_file, years = NULL)
weather_filePath to or name of file containing weather data.
yearsYears for which the weather is to be extracted. Default (NULL) is to read in all found years.
ensure_file_integrity()Check if supplied input file is formatted correctly.
Check if required column names are present and fix NA entries.
WeatherData$ensure_file_integrity(weather)
weatherdata.table of the read input file with header = TRUE.
calculate_day_length()Calculate the expected length of day based on a site's geographical latitude.
WeatherData$calculate_day_length(latitude)
latitudenumeric; geographical latitude in degrees.
get_weather_for_year()Extract state variables to the weather data for given year and return them as a list.
WeatherData$get_weather_for_year(year)
yearinteger Year for which to extract weather data.
W List containing the keys aCO2, year, DOY, Ta, Ta_sm, PAR, PP, PET, liquidP, melt, snow, ndays.
clone()The objects of this class are cloneable with this method.
WeatherData$clone(deep = FALSE)
deepWhether to make a deep clone.
rango1995RevisitingDegreeDayMethodgrowR
\insertRefkokkonen2006ConstructionDegreedaySnowgrowR
WeatherData$read_weather()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.