knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
library(lfcdata)
library(dplyr)

Meteoland database

Meteoland database offers access to the daily metereological interpolation data, powered by the meteoland package.

meteolanddb <- meteoland()
meteolanddb

Access to precalculated data

The Meteoland database has spatial precalculated data as rasters with a 1km resolution, that can be accessed with the meteoland_get_lowres_raster function:

Raster formats

This function allows to access the raster for a specified date (as character), and returns a spatial object, whose class depends on the spatial argument. Available classes are raster (a RasterBrick object) and stars (a stars object).

meteoland_get_lowres_raster(
  meteolanddb,
  date = as.character(Sys.Date() - 1),
  spatial = 'stars'
)
meteoland_get_lowres_raster(
  meteolanddb,
  date = as.character(Sys.Date() - 1),
  spatial = 'raster'
)

Dates available

Dates available covers from 1976-01-01 to the day before current day.

meteoland_get_lowres_raster(
  meteolanddb,
  date = '1977-04-25',
  spatial = 'stars'
)

On the fly points interpolation (resolution 20m)

It is possible to perform on-the-fly interpolation of meteorological variables for a set of points, only for the current natural year (365 days). This is done with the meteoland_points_interpolation:

# points spatial object, obtained from fes database
points_sf <- lfcdata::fes()$get_data('plot_nfi_4_results', spatial = TRUE) |>
  slice(1:5)


meteoland_points_interpolation(
  meteolanddb,
  sf = points_sf,
  dates = c(as.character(Sys.Date() - 5), as.character(Sys.Date() - 1))
)

NOTE: This process may take a while depending on the number of points to interpolate

Precalculated historical points interpolation (resolution 1km)

For historic dates interpolation, only a lower resolution (1km) is available, using the meteoland_historical_points_interpolation function:

meteoland_historical_points_interpolation(
  meteolanddb,
  sf = points_sf,
  dates = c('1976-01-01', '1976-01-05'),
  points_id = 'plot_id'
)

Arguments are the same as previously explained.

Precalculated raster interpolation (resolution 1km)

Interpolation for current and historical dates for polygons (not points) can be done with the meteoland_raster_interpolation. The returned value is a raster with the interpolated data for the polygons provided.

# polygons object obtained from lidar database
sf_polygons <- lfcdata::lidar()$get_data('lidar_municipalities', 'AB') |>
  slice(1:5)

meteoland_raster_interpolation(
  meteolanddb,
  sf = sf_polygons,
  dates = c(as.character(Sys.Date() - 5), as.character(Sys.Date() - 1))
)

NOTE: This process may take a while depending on the number of points to interpolate



MalditoBarbudo/lfcdata documentation built on May 2, 2023, 10:30 p.m.