Title: | An R implementation of the InSiGHTS framework |
---|---|
Description: | The package provides an implementation of the InSiGHTS modelling framework for creating climate and land-use indicators. This package acts a simple wrapper to do an area-of-habitat refinements on top of climatic envelope models or species distribution models (SDMs). By default it is assumed that such models are obtained through the ibis.iSDM package and this package contains a simple wrapper to link the two approaches. |
Authors: | Martin Jung [aut, cre] |
Maintainer: | Martin Jung <[email protected]> |
License: | CC BY 4.0 |
Version: | 0.6 |
Built: | 2025-02-12 04:42:33 UTC |
Source: | https://github.com/iiasa/insights |
The purpose of this function is to create the range from several derivative
variables. The information to do so is taken from the variable name and it
is assumed that those have been created by ibis.iSDM::predictor_derivate()
function.
This function return the range of values from the original data that fall within the set of coefficients. Currently only positive coefficients are taken by default.
create_derivate_range(env, varname, co, to_binary = FALSE)
create_derivate_range(env, varname, co, to_binary = FALSE)
env |
The original variable stacks as |
varname |
A |
co |
A set of coefficients obtained via |
to_binary |
A |
This function really only makes sense for 'bin'
, 'thresh'
and
'hinge'
transformations.
For 'hinge'
the combined min
is returned.
A SpatRaster
object containing the predictor range.
This is rather an internal function created for a specific use and project. It might be properly described in an example later.
Martin Jung
## Not run: # Assuming derivates of temperature have been created for a model, this # recreates the range over which they apply. deriv <- create_derivate_range(env, varname = "Temperature", co = coef(fit), to_binary = TRUE) ## End(Not run)
## Not run: # Assuming derivates of temperature have been created for a model, this # recreates the range over which they apply. deriv <- create_derivate_range(env, varname = "Temperature", co = coef(fit), to_binary = TRUE) ## End(Not run)
This function applies an area-of-habitat (AOH) correction to a provided single time step or multiple step range estimate (binary or other format). This thus assumes that species-habitat relations remain stable also in future conditions within a provided climatic niche.
Opposed to insights_fraction
it is assumed that the land-use layers come in continuous areal units,
such as 'km2'
.
Optionally also a elevation (elev
) layer and habitat condition (condition
) can be provided to support refinements
by elevational range or habitat condition.
insights_area(range, lu, other, outfile = NULL) ## S4 method for signature 'SpatRaster,SpatRaster,SpatRaster,character' insights_area(range,lu,other,outfile) ## S4 method for signature 'SpatRaster,stars,ANY,character' insights_area(range,lu,other,outfile) ## S4 method for signature 'stars,stars,ANY,character' insights_area(range,lu,other,outfile) ## S4 method for signature 'stars,stars,ANY,character' insights_area(range,lu,other,outfile) ## S4 method for signature 'ANY,ANY,SpatRaster,character' insights_area(range,lu,other,outfile)
insights_area(range, lu, other, outfile = NULL) ## S4 method for signature 'SpatRaster,SpatRaster,SpatRaster,character' insights_area(range,lu,other,outfile) ## S4 method for signature 'SpatRaster,stars,ANY,character' insights_area(range,lu,other,outfile) ## S4 method for signature 'stars,stars,ANY,character' insights_area(range,lu,other,outfile) ## S4 method for signature 'stars,stars,ANY,character' insights_area(range,lu,other,outfile) ## S4 method for signature 'ANY,ANY,SpatRaster,character' insights_area(range,lu,other,outfile)
range |
A |
lu |
A |
other |
Any other |
outfile |
A writeable |
Either a SpatRaster
or temporal stars
object or nothing if outputs are written directly to drive.
This function does not do the refinement of land-use fraction to relevant habitats. This needs to be done by the analyst a-priori. No checks are conducted on whether area shares match or exceed certain amounts!
Martin Jung
Rondinini, Carlo, and Piero Visconti. "Scenarios of large mammal loss in Europe for the 21st century." Conservation Biology 29, no. 4 (2015): 1028-1036.
Visconti, Piero, Michel Bakkenes, Daniele Baisero, Thomas Brooks, Stuart HM Butchart, Lucas Joppa, Rob Alkemade et al. "Projecting global biodiversity indicators under future development scenarios." Conservation Letters 9, no. 1 (2016): 5-13.
## Not run: out <- insights_area(range, landuse_km2) ## End(Not run)
## Not run: out <- insights_area(range, landuse_km2) ## End(Not run)
This function applies an area-of-habitat (AOH) correction to a provided single time step or multiple step range estimate (binary format). This thus assumes that species-habitat relations remain stable also in future conditions within a provided climatic niche.
It is assumed that the land-use layers come in fractional units, so are ranging from 0
to 1
.
Optionally also a elevation (elev
) layer and habitat condition (condition
) can be provided to support refinements
by elevational range or habitat condition.
insights_fraction(range, lu, other, outfile = NULL, clamp = FALSE) ## S4 method for signature 'SpatRaster,SpatRaster,SpatRaster,character,logical' insights_fraction(range,lu,other,outfile,clamp) ## S4 method for signature 'SpatRaster,stars,ANY,character,logical' insights_fraction(range,lu,other,outfile,clamp) ## S4 method for signature 'stars,stars,ANY,character,logical' insights_fraction(range,lu,other,outfile,clamp) ## S4 method for signature 'stars,stars,ANY,character,logical' insights_fraction(range,lu,other,outfile,clamp) ## S4 method for signature 'ANY,ANY,SpatRaster,character,logical' insights_fraction(range,lu,other,outfile,clamp)
insights_fraction(range, lu, other, outfile = NULL, clamp = FALSE) ## S4 method for signature 'SpatRaster,SpatRaster,SpatRaster,character,logical' insights_fraction(range,lu,other,outfile,clamp) ## S4 method for signature 'SpatRaster,stars,ANY,character,logical' insights_fraction(range,lu,other,outfile,clamp) ## S4 method for signature 'stars,stars,ANY,character,logical' insights_fraction(range,lu,other,outfile,clamp) ## S4 method for signature 'stars,stars,ANY,character,logical' insights_fraction(range,lu,other,outfile,clamp) ## S4 method for signature 'ANY,ANY,SpatRaster,character,logical' insights_fraction(range,lu,other,outfile,clamp)
range |
A |
lu |
A |
other |
Any other |
outfile |
A writeable |
clamp |
A |
Either a SpatRaster
or temporal stars
object or nothing if outputs are written directly to drive.
This function does not do the refinement of land-use fraction to relevant habitats. This needs to be done by the analyst a-priori.
Martin Jung
Rondinini, Carlo, and Piero Visconti. "Scenarios of large mammal loss in Europe for the 21st century." Conservation Biology 29, no. 4 (2015): 1028-1036.
Visconti, Piero, Michel Bakkenes, Daniele Baisero, Thomas Brooks, Stuart HM Butchart, Lucas Joppa, Rob Alkemade et al. "Projecting global biodiversity indicators under future development scenarios." Conservation Letters 9, no. 1 (2016): 5-13.
## Not run: out <- insights_fraction(range, landuse) ## End(Not run)
## Not run: out <- insights_fraction(range, landuse) ## End(Not run)
This function handily summarizes the suitable habitat for a given species or biodiversity feature into an index. If a single timestep (or object with a single layer) is provided, this function simply summarizes the suitable area.
insights_summary(obj, toArea = TRUE, fun = "sum", relative = TRUE) ## S4 method for signature 'SpatRaster,logical,character,logical' insights_summary(obj,toArea,fun,relative) ## S4 method for signature 'stars,logical,character,logical' insights_summary(obj,toArea,fun,relative)
insights_summary(obj, toArea = TRUE, fun = "sum", relative = TRUE) ## S4 method for signature 'SpatRaster,logical,character,logical' insights_summary(obj,toArea,fun,relative) ## S4 method for signature 'stars,logical,character,logical' insights_summary(obj,toArea,fun,relative)
obj |
A |
toArea |
A |
fun |
A |
relative |
A |
A data.frame
with area estimates or the respective indicator.
Martin Jung
Baisero, Daniele, Piero Visconti, Michela Pacifici, Marta Cimatti, and Carlo Rondinini. "Projected global loss of mammal habitat due to land-use and climate change." One Earth 2, no. 6 (2020): 578-585.
Powers, Ryan P., and Walter Jetz. "Global habitat loss and extinction risk of terrestrial vertebrates under future land-use-change scenarios." Nature Climate Change 9, no. 4 (2019): 323-329.
This function calculates the relative change of a vector, taking the first value as a reference value.
relChange(v, fac = 100)
relChange(v, fac = 100)
v |
A |
fac |
A |
A numeric
vector.
Martin Jung
# Example vector x <- c(20,6,2,1,15,25) relChange(x)
# Example vector x <- c(20,6,2,1,15,25) relChange(x)
This small helper function simply clamps the a given SpatRaster
or stars
object \
to a provided range. This can help to adjust for example land-use fractions for use
in insights_fraction()
.
st_clamp(env, lb = -Inf, ub = Inf)
st_clamp(env, lb = -Inf, ub = Inf)
env |
The original variable stacks as |
lb |
The lower bound for clamping (Default: |
ub |
The lower bound for clamping (Default: |
The same as input 'env'
.
Martin Jung
## Not run: # Use ## End(Not run)
## Not run: # Use ## End(Not run)