| WeatherData {growR} | R Documentation |
Weather Data Object
Description
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):
-
DOYday of year in given year -
Taaverage temperature of given day (Celsius). -
precipprecipitation in millimeter per day. -
PARphotosynthetically active radiation in MJ/m^2^. Can be calculated from average sunlight irradianceSRadin J/s/m^2^ as:PAR = SRad * 0.47 * 24 * 60 * 60 / 1e6 -
ET0evapotranspiration 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.
Public fields
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)
Methods
Public methods
Method new()
Create a new WeatherData object.
Usage
WeatherData$new(weather_file = NULL, years = NULL)
Arguments
weather_filestring Path to file containing the weather data to be read.
yearsnumeric Vector of years for which the weather is to be extracted.
Method read_weather()
Read weather data from supplied weather_file.
Usage
WeatherData$read_weather(weather_file, years = NULL)
Arguments
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.
Method ensure_file_integrity()
Check if supplied input file is formatted correctly.
Check if required column names are present and fix NA entries.
Usage
WeatherData$ensure_file_integrity(weather)
Arguments
weatherdata.table of the read input file with
header = TRUE.
Method calculate_day_length()
Calculate the expected length of day based on a site's geographical latitude.
Usage
WeatherData$calculate_day_length(latitude)
Arguments
latitudenumeric; geographical latitude in degrees.
Method get_weather_for_year()
Extract state variables to the weather data for given year and return them as a list.
Usage
WeatherData$get_weather_for_year(year)
Arguments
yearinteger Year for which to extract weather data.
Returns
W List containing the keys aCO2, year, DOY, Ta, Ta_sm, PAR, PP, PET, liquidP, melt, snow, ndays.
Method clone()
The objects of this class are cloneable with this method.
Usage
WeatherData$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
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.
See Also
WeatherData$read_weather()