get_outliers: Identify temperature-precipitation outliers

View source: R/get_outliers.R

get_outliersR Documentation

Identify temperature-precipitation outliers

Description

Identifies temperature-precipitation pairs (points) that are outside of the Whittaker biome polygons.

Usage

get_outliers(tp, validate = TRUE)

Arguments

tp

A two column matrix, data.frame or data.table object. First column must refer to mean annual temperatures in Celsius degrees. Second column must refer to annual precipitations in cm. This two-column table represents all temperature-precipitation pairs (rows) to be tested if they fall inside or outside of the Whittaker biome polygons.

validate

Should the input be validated? Variable containing a single logical constant (TRUE or FALSE). Default is TRUE, meaning that some input checking is carried out by default. For example, it checks if tp variable contains exactly a two column matrix, data.frame or data.table object, if its columns are of numeric type and if the values are within certain ranges (e.g. temperature must be within -55 and 40 Celsius degrees and precipitation must not be above 1200 cm). See Details section for additional information.

Details

Usually, for getting temperature-precipitation values one would most probably have pairs of spatial coordinates. These coordinates would be used for raster extraction (see raster::extract()).

The ranges used for input validation are slightly wider that those encountered in the (CHELSA v 1.2 BIO1 & BIO12 raster datasets. The following can throw an error (also possible reasons are given in the error messages):

  • Temperatures were switched with precipitations (temperature must be the first column);

  • Temperature values were extracted from a raster that stores values as integers (for saving space, raster datasets could store data as integer type instead of full floating point accuracy; usually division by 10 solves the issue);

  • Precipitations are in mm and not cm (divide by 10 to get cm);

  • The given values are simply not temperature nor precipitation values. Perhaps other raster datasets were accidently used for point extraction.

We consider useful and informative to include input validation. There is always the option to turn the validation off by setting the argument validate = FALSE.

Value

Returns a data.table with tree columns:

Column Type Description
[, 1] row_idx , integer : Outlier row index
[, 2] temp , numeric : Outlier mean annual temperature (Celsius degrees)
[, 3] pp_cm , numeric : Outlier annual precipitation (cm)

The indices in row_idx connect to the row indices in tp table.

Author(s)

Valentin Stefan


valentinitnelav/plotbiomes documentation built on Oct. 22, 2022, 6:22 a.m.