View source: R/get_perc_risk_index.R
get_perc_risk_index | R Documentation |
Generates the mean of the values over a certain percentile threshold for the portion of the Raster* that intersects a polygon
get_perc_risk_index(b, p, perc_val = 75, mod = "gt")
b |
RasterLayer/Brick/Stack containing the historical observations or a proxy (typically a reanalysis). |
p |
SpatialPolygons* object |
perc_val |
is the percentile value used as a threshold |
mod |
defines if the values considered for the mean are above (gt) or below (lt) the threshold |
The function returns a numeric value (for each layer in b
),
corresponding to the mean of the values of b
above/below a given
percentile of the historical observations.
## Not run: # Read RISICO test data r_risico <- readRDS(system.file("extdata", "RISICO_raster.rds", package = "caliver")) # Set missing crs raster::crs(r_risico) <- "+proj=longlat +datum=WGS84 +no_defs" # Define dummy polygon, as sf simple feature shape <- sf::st_bbox(c(xmin = 7, xmax = 18, ymax = 40, ymin = 18), crs = sf::st_crs(4326)) get_perc_risk_index(b = r_risico, p = shape, perc_val = 75, mod = "gt") ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.