Chapter 2 Data structures and main functions

2.1 Meteorological variables

Package meteoland assists in the estimation of the following daily variables over lanscapes (units in parentheses):

  • DOY: Day of the year ([1-366]).
  • MeanTemperature: Mean daily temperature (in degrees Celsius).
  • MinTemperature: Minimum daily temperature (in degrees Celsius).
  • MaxTemperature: Maximum daily temperature (in degrees Celsius).
  • Precipitation: Daily precipitation (in mm of water).
  • MeanRelativeHumidity: Mean daily relative humidity (in percent).
  • MinRelativeHumidity: Minimum daily relative humidity (in percent).
  • MaxRelativeHumidity: Maximum daily relative humidity (in percent).
  • Radiation: Incoming radiation (in MJ/m2).
  • WindSpeed: Wind speed (in m/s).
  • WindDirection: Wind direction (in degrees from North).
  • PET: Potential evapo-transpiration (in mm of water).

2.2 Spatial classes

With the retirement of rgdal, rgeos and maptools R packages, a complete update of meteoland was necessary to remove the hard dependency that the package had with sp and raster R packages. Starting with version 2.0.0 of meteoland, now sf and stars packages are internally used for working with simple features and raster data, respectively.

2.2.1 Topography

Spatial variation of topography should be represented in sf and stars objects by the variables: elevation (in meters), slope (in degrees from the horizontal plane) and aspect (in degrees from North).

2.2.2 Meteorology

When using sf data structures, daily weather variables can be represented as columns of the corresponding data frame, whereas dates (i.e. Date or POSIXct objects) are specified in a column called dates. Interpolation results use also sf objects, but where weather data series for all variables are supplied in a column called interpolated_data.

When using stars data structures, daily weather variables are represented as attributes and dates are represented as a time dimension.

2.2.3 Interpolator objects

Since ver. 2.0.0, reference weather data is represented by interpolator objects of class stars, where the interpolation parameter list is included as an attribute params. Interpolator objects can be created using function create_meteo_interpolator(), and interpolation parameters are retrieved or modified using functions get_interpolation_params() and set_interpolation_params(), respectively.

2.3 Reading and writing meteorological data

Since ver. 2.0.0, reading and writing meteorological data is no longer dealt within the package, but can be dealt with using the corresponding functions in packages sf and stars. The only exception are interpolator objects, which are stored as NetCDFs and have their own functions read_interpolator() and write_interpolator().

2.4 Subsetting, merging and reshaping data

Since ver. 2.0.0, subsetting, merging and reshaping weather data is done using functions provided by packages sf and stars.

2.5 Summarizing meteorological data

Since ver. 2.0.0 spatial or temporal summaries can be done using functions of packages sf and stars. Additionally, meteoland provides a helper function called summarise_interpolated_data() that accepts the objects returned by function interpolation_data().

2.6 Meteorology interpolation

Since ver. 2.0.0, package meteoland provides one single functions for interpolating meteorological data over landscapes. Function interpolate_data() interpolates weather for a set of locations, and accepts both sf and stars structures as input, but necessitates an interpolator object with the reference weather station data.

Functions interpolator_calibration() and interpolation_cross_validation() are included in meteoland to calibrate interpolation parameters and evaluate predictive performance of interpolation routines before using them. Details of interpolation routines are described in chapter 3.