Skip to contents

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 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.

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.

See also

WeatherData$read_weather()

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)

Arguments

weather_file

string Path to file containing the weather data to be read.

years

numeric 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_file

Path to or name of file containing weather data.

years

Years 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

weather

data.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

latitude

numeric; 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

year

integer 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

deep

Whether to make a deep clone.