ISRaD.extra.geospatial: ISRaD.extra.geospatial

View source: R/ISRaD.extra.geospatial.R

ISRaD.extra.geospatialR Documentation

ISRaD.extra.geospatial

Description

Extracts data from a user-supplied raster file and adds data as a new variable at the profile level

Usage

ISRaD.extra.geospatial(
  database,
  geodata_directory,
  CRS = "+proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0"
)

Arguments

database

ISRaD dataset object

geodata_directory

Directory where geospatial data are found

CRS

Coordinate reference system used for geospatial datasets

Details

Generic function that uses geographic coordinates of profiles to extract data from one or more raster files. Raster data will be added as new variables at the profile level.

The new variable name will be a concatenation of "pro_", and the file name (excluding the file extension). The ISRaD file name convention for geospatial files uses a 6 component string, separated by "_". Missing components can be replaced with "x" ("x"s will be dropped before creating variable names). The 6 components are as follows:

1) Short description of the data type, e.g. "bd" for bulk density
2) Top layer depth or exact depth (numeric, cm)
3) Bottom layer depth (numeric, cm)
4) Year of data observation (numeric)
5) Data units (e.g. mmyr for mean annual precipitation)
6) Any relevant notes

Coordinate reference system can be specified with the "CRS" argument; default is WGS84. Note that all files in geodata_directory must use the same CRS.

Value

Updated ISRaD_extra object with new columns at the profile level

Examples


# Load example dataset Gaudinski_2001
database <- ISRaD::Gaudinski_2001
# Fill profile coordinates
database <- ISRaD.extra.fill_coords(database)
# Run function
# Note that geospatial data in pkg is only for the Gaudinski_2001 dataset
# Users may supply their own geospatial data as long as it can be read by the raster package
database.x <- ISRaD.extra.geospatial(database,
  geodata_directory = system.file("extdata", "geodata_directory", package = "ISRaD")
)



ISRaD documentation built on Sept. 21, 2023, 9:06 a.m.