Title: | Species Distribution Modelling Predictor Datasets |
---|---|
Description: | Terrestrial and marine predictors for species distribution modelling from multiple sources, including WorldClim <https://www.worldclim.org/>,, ENVIREM <https://envirem.github.io/>, Bio-ORACLE <https://bio-oracle.org/> and MARSPEC <http://www.marspec.org/>. |
Authors: | Samuel Bosch [aut], Lennert Tyberghein [ctb], Olivier De Clerck [ctb], Salvador Fernandez [aut, cre], Lennert Schepers [ctb], LifeWatch Belgium [fnd] (https://lifewatch.be) |
Maintainer: | Salvador Fernandez <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.2.15 |
Built: | 2025-03-09 04:27:27 UTC |
Source: | https://github.com/lifewatch/sdmpredictors |
Method used to calculate the statistics of all layers. It can be re-used to calculate statistics for a cropped version of the rasters.
calculate_statistics(layercode, raster)
calculate_statistics(layercode, raster)
layercode |
character. Name of the layer. |
raster |
RasterLayer. The raster you want to calculate statistics for. |
A dataframe with the layercode and all basic statistics.
## Not run: # calculate statistics of the SST and salinity in the Baltic Sea # warning using tempdir() implies that data will be downloaded again in the # next R session x <- load_layers(c("BO_sstmax", "BO_salinity"), datadir = tempdir()) e <- extent(13, 31, 52, 66) baltics <- crop(x, e) View(rbind(calculate_statistics("SST Baltic Sea", raster(x, layer = 1))) calculate_statistics("Salinity Baltic Sea", raster(x, layer = 2))) ## End(Not run)
## Not run: # calculate statistics of the SST and salinity in the Baltic Sea # warning using tempdir() implies that data will be downloaded again in the # next R session x <- load_layers(c("BO_sstmax", "BO_salinity"), datadir = tempdir()) e <- extent(13, 31, 52, 66) baltics <- crop(x, e) View(rbind(calculate_statistics("SST Baltic Sea", raster(x, layer = 1))) calculate_statistics("Salinity Baltic Sea", raster(x, layer = 2))) ## End(Not run)
correlation_groups
returns groups of layer codes such as each layer
from one group has an absolute Pearson product-moment correlation coefficient
(Pearson's r) that is smaller than the maximum_correlation (default 0.7) with
each variable in any other group. The correlation values of quadratic layers
are used for creating the groups but only non quadratic layer codes are
returned.
correlation_groups(layers_correlation, max_correlation=0.7)
correlation_groups(layers_correlation, max_correlation=0.7)
layers_correlation |
matrix or dataframe. A square matrix with the layers correlations you want to group. |
max_correlation |
number. The maximum correlation 2 layers may have before they are put in the same correlation group. |
A list of vectors with each vector containing the layer codes of one correlation group.
Dormann, C. F., Elith, J., Bacher, S., Buchmann, C., Carl, G., Carre, G., ... Lautenbach, S. (2013). Collinearity: a review of methods to deal with it and a simulation study evaluating their performance. Ecography, 36(1), 027-046. doi:10.1111/j.1600-0587.2012.07348.x Barbet-Massin, M. & Jetz, W. (2014). A 40-year, continent-wide, multispecies assessment of relevant climate predictors for species distribution modelling. Diversity and Distributions, 20(11), 1285-1295. doi:10.1111/ddi.12229
layers_correlation list_layers
layer_stats
corr <- layers_correlation(c("BO_calcite", "BO_damin", "MS_bathy_5m")) print(corr) print(correlation_groups(corr, max_correlation=0.6))
corr <- layers_correlation(c("BO_calcite", "BO_damin", "MS_bathy_5m")) print(corr) print(correlation_groups(corr, max_correlation=0.6))
dataset_citations
returns dataset citations as text or as
"bibentry
" objects.
dataset_citations(datasets = c(), astext = TRUE)
dataset_citations(datasets = c(), astext = TRUE)
datasets |
character vector. Code of the datasets. When no datasets are provided (default), then all citations are returned. |
astext |
logical. When |
Note that in order to generate a full list of citations it is
preferable to run the layer_citations
function.
Either a character vector or a list of
"bibentry
" objects.
layer_citations
, bibentry
,
list_datasets
# print the Bio-ORACLE citation print(dataset_citations("Bio-ORACLE")) # print all citations as Bibtex print(lapply(dataset_citations(astext = FALSE), toBibtex))
# print the Bio-ORACLE citation print(dataset_citations("Bio-ORACLE")) # print all citations as Bibtex print(lapply(dataset_citations(astext = FALSE), toBibtex))
World Behrmann equal area coordinate reference system (ESRI:54017), used when using load_layers with equal_area = TRUE
equalareaproj
equalareaproj
An object of class CRS
of length 1.
get_future_layers
returns information on the future climate layers for
the matching current climate layers.
get_future_layers(current_layer_codes, scenario, year)
get_future_layers(current_layer_codes, scenario, year)
current_layer_codes |
character vector. Code(s) of the current climate
layers either as a character vector or as the dataframe provided by
|
scenario |
character vector. Climate change scenario, e.g. |
year |
integer. Year for which you want the climate change prediction,
e.g. |
Stops with an exception if no matching future climate layer was found for one or more of the provided current climate layer codes.
A dataframe with information on the future layer(s) matching the provided current layer(s).
list_layers_future
, list_layers
,
load_layers
future_layers <- get_future_layers(c("BO_salinity", "BO_sstmean"), scenario = "B1", year = 2100) future_layers$layer_code
future_layers <- get_future_layers(c("BO_salinity", "BO_sstmean"), scenario = "B1", year = 2100) future_layers$layer_code
get_layers_info
returns all detailed information on the current or
future climate layers of one or more datasets.
get_layers_info(layer_codes = c())
get_layers_info(layer_codes = c())
layer_codes |
character vector. Vector with the layer codes of the
layers you want the full information for. This can also be a dataframe with
as column |
A list with four dataframes common
, current
,
future
and paleo
, the common
dataframe contains data
for all shared columns in the other three dataframes. The other dataframes
contain all detailed information on the layer(s) matching the layer codes.
By default information for all layers is returned.
list_layers
, list_layers_future
,
list_layers_paleo
, load_layers
info <- get_layers_info(c("BO_salinity", "BO_B1_2100_salinity")) info$common info$current info$future info$paleo
info <- get_layers_info(c("BO_salinity", "BO_B1_2100_salinity")) info$common info$current info$future info$paleo
get_paleo_layers
returns information on the future climate layers for
the matching current climate layers.
get_paleo_layers(current_layer_codes, model_name = NA, epoch = NA, years_ago = NA)
get_paleo_layers(current_layer_codes, model_name = NA, epoch = NA, years_ago = NA)
current_layer_codes |
character vector. Code(s) of the current climate
layers either as a character vector or as the dataframe provided by
|
model_name |
character vector. Paleo climate model name see the
|
epoch |
character vector. Epoch for which you want the paleo layer, e.g.
|
years_ago |
integer. Years for which you want the paleo layer, e.g.
|
Stops with an exception if no matching paleo layer was found for one or more of the provided current climate layer codes.
A dataframe with information on the paleo layer(s) matching the provided current layer(s).
list_layers_paleo
, list_layers
,
load_layers
paleo_layers <- get_paleo_layers("MS_biogeo08_sss_mean_5m", years_ago = 6000) paleo_layers$layer_code
paleo_layers <- get_paleo_layers("MS_biogeo08_sss_mean_5m", years_ago = 6000) paleo_layers$layer_code
layer_citations
returns layer citations as text or as
"bibentry
" objects.
layer_citations(layers = c(), astext = TRUE)
layer_citations(layers = c(), astext = TRUE)
layers |
character vector. Code of the layers from past, current and future climate layers. When no layers are provided (default), then all citations are returned. |
astext |
logical. When |
Note that for some layers multiple references are returned as some of the predictors have been published separately.
Either a character vector or a list of
"bibentry
" objects.
layer_citations
, bibentry
, list_datasets
# print the citation for the Bio-ORACLE salinity layer print(layer_citations("BO_salinity")) # print the citation for a MARSPEC paleo layer print(layer_citations("MS_biogeo02_aspect_NS_21kya")) # print all citations as Bibtex print(lapply(layer_citations(astext = FALSE), toBibtex))
# print the citation for the Bio-ORACLE salinity layer print(layer_citations("BO_salinity")) # print the citation for a MARSPEC paleo layer print(layer_citations("MS_biogeo02_aspect_NS_21kya")) # print all citations as Bibtex print(lapply(layer_citations(astext = FALSE), toBibtex))
layer_stats
returns basic statistics (minimum, q1, median, q3,
maximum, median absolute deviation (mad), mean, standard deviation (sd))
for each given layercode.
layer_stats(layercodes = c())
layer_stats(layercodes = c())
layercodes |
character vector or dataframe. Codes of the layers you want the basic statistics of as a character vector or a dataframe with a "layer_code" column. With the default empty vector all statistics are returned. |
A dataframe with basic statistics about each given layercode.
list_layers
layers_correlation
# layer stats for the first 10 layers layer_stats()[1:10,] layer_stats(c("BO_calcite", "MS_bathy_5m"))
# layer stats for the first 10 layers layer_stats()[1:10,] layer_stats(c("BO_calcite", "MS_bathy_5m"))
layers_correlations
returns the Pearson product-moment correlation
coefficient (Pearson's r) for every combination of the give layercodes. The
correlation between a terrestrial and a marine layer has been set to
NA
.
layers_correlation(layercodes = c())
layers_correlation(layercodes = c())
layercodes |
character vector or dataframe. Codes of the layers, you want the correlation matrix of, as a character vector or a dataframe with a "layer_code" column. With the default empty vector the correlation between all layers is returned. |
A dataframe with the Pearson product-moment correlation coefficients.
list_layers layer_stats
correlation_groups plot_correlation
# correlation of the first 10 layers layers_correlation()[1:10,1:10] layers_correlation(c("BO_calcite", "MS_bathy_5m")) layers_correlation(c("BO_calcite", "MS_bathy_5m"))
# correlation of the first 10 layers layers_correlation()[1:10,1:10] layers_correlation(c("BO_calcite", "MS_bathy_5m")) layers_correlation(c("BO_calcite", "MS_bathy_5m"))
list_datasets
returns information on the supported datasets.
list_datasets(terrestrial = NA, marine = NA, freshwater = NA)
list_datasets(terrestrial = NA, marine = NA, freshwater = NA)
terrestrial |
logical. When |
marine |
logical. When |
freshwater |
logical. When |
By default it returns all datasets, when both marine
, freshwater
and
terrestrial
are FALSE
then only datasets without land- nor
seamasks are returned.
A dataframe with information on the supported datasets.
list_layers
, list_layers_future
,
list_layers_paleo
list_datasets() list_datasets(marine=TRUE) list_datasets(terrestrial=TRUE)
list_datasets() list_datasets(marine=TRUE) list_datasets(terrestrial=TRUE)
list_layers
returns information on the layers of one or more datasets.
list_layers(datasets=c(), terrestrial = NA, marine = NA, freshwater = NA, monthly = TRUE, version = NULL)
list_layers(datasets=c(), terrestrial = NA, marine = NA, freshwater = NA, monthly = TRUE, version = NULL)
datasets |
character vector. Code of the datasets. |
terrestrial |
logical. When |
marine |
logical. When |
freshwater |
logical. When |
monthly |
logical. When |
version |
numeric vector. When |
By default it returns all layers from all datasets, when both marine
and terrestrial are FALSE
then only layers from datasets without
land- nor seamasks are returned. Layers for paleo and future climatic
conditions can be listed with list_layers_paleo
and
list_layers_future
. Available paleo and future climate layers
for a current climate layer code can be listed with the functions
get_paleo_layers
and get_future_layers
.
A dataframe with information on the supported current climate layers.
load_layers
, list_datasets
,
list_layers_future
, list_layers_paleo
,
get_future_layers
, get_paleo_layers
# list the first 5 layers list_layers()[1:5,] # list the layercodes all monthly layers from WorldClim worldclim <- list_layers("WorldClim") worldclim[!is.na(worldclim$month),]$layer_code # list layer codes for Bio-ORACLE and MARSPEC list_layers(c("Bio-ORACLE","MARSPEC"))$layer_code # list the first 5 terrestrial layers list_layers(marine=FALSE)[1:5,] # list the first 5 marine layers list_layers(terrestrial=FALSE)[1:5,] # list all annual MARSPEC layers (remove monthly layers) list_layers("MARSPEC", monthly = FALSE)
# list the first 5 layers list_layers()[1:5,] # list the layercodes all monthly layers from WorldClim worldclim <- list_layers("WorldClim") worldclim[!is.na(worldclim$month),]$layer_code # list layer codes for Bio-ORACLE and MARSPEC list_layers(c("Bio-ORACLE","MARSPEC"))$layer_code # list the first 5 terrestrial layers list_layers(marine=FALSE)[1:5,] # list the first 5 marine layers list_layers(terrestrial=FALSE)[1:5,] # list all annual MARSPEC layers (remove monthly layers) list_layers("MARSPEC", monthly = FALSE)
list_layers_future
returns information on the future climate layers of
one or more datasets.
list_layers_future(datasets = c(), scenario = NA, year = NA, terrestrial = NA, marine = NA, freshwater = NA, monthly = TRUE, version = NULL)
list_layers_future(datasets = c(), scenario = NA, year = NA, terrestrial = NA, marine = NA, freshwater = NA, monthly = TRUE, version = NULL)
datasets |
character vector. Code of the datasets. |
scenario |
character vector. Climate change scenario, e.g. |
year |
integer. Year for which you want the climate change prediction,
e.g. |
terrestrial |
logical. When |
marine |
logical. When |
freshwater |
logical. When |
monthly |
logical. When |
version |
numeric vector. When |
By default it returns all layers from all datasets, when both marine
and terrestrial are FALSE
then only layers without land- nor
seamasks are returned.
A dataframe with information on the supported future climate layers.
list_layers
, list_layers_paleo
,
list_datasets
, load_layers
# list the first 5 layers list_layers_future()[1:5,] # list layer codes for Bio-ORACLE with scenario B1 and year 2100 list_layers_future("Bio-ORACLE", scenario = "B1", year = 2100)$layer_code
# list the first 5 layers list_layers_future()[1:5,] # list layer codes for Bio-ORACLE with scenario B1 and year 2100 list_layers_future("Bio-ORACLE", scenario = "B1", year = 2100)$layer_code
list_layers_paleo
returns information on the paleo climate layers of
one or more datasets.
list_layers_paleo(datasets = c(), model_name = NA, epoch = NA, years_ago = NA, terrestrial = NA, marine = NA, freshwater = NA, monthly = TRUE, version = NULL)
list_layers_paleo(datasets = c(), model_name = NA, epoch = NA, years_ago = NA, terrestrial = NA, marine = NA, freshwater = NA, monthly = TRUE, version = NULL)
datasets |
character vector. Code of the datasets. |
model_name |
character vector. Paleo climate model name see the
|
epoch |
character vector. Epoch for which you want the paleo layer, e.g.
|
years_ago |
integer. Years for which you want the paleo layer, e.g.
|
terrestrial |
logical. When |
marine |
logical. When |
freshwater |
logical. When |
monthly |
logical. When |
version |
numeric vector. When |
By default it returns all layers from all datasets, when both marine
and terrestrial are FALSE
then only layers without land- nor
seamasks are returned.
A dataframe with information on the supported paleo climate layers.
list_layers
, list_layers_future
,
list_datasets
, load_layers
# list the first 5 layers list_layers_paleo()[1:5,] # list layer codes for MARSPEC for the mid-Holocene list_layers_paleo("MARSPEC", epoch = "mid-Holocene")$layer_code
# list the first 5 layers list_layers_paleo()[1:5,] # list layer codes for MARSPEC for the mid-Holocene list_layers_paleo("MARSPEC", epoch = "mid-Holocene")$layer_code
Method to load rasters from disk or from the internet. By default a RasterStack is returned but this is only possible When all rasters have the same spatial extent and resolution.
load_layers(layercodes, equalarea=FALSE, rasterstack=TRUE, datadir=NULL)
load_layers(layercodes, equalarea=FALSE, rasterstack=TRUE, datadir=NULL)
layercodes |
character vector or dataframe. Layer_codes of the layers to be loaded or dataframe with a "layer_code" column. |
equalarea |
logical. If |
rasterstack |
logical. If |
datadir |
character. Directory where you want to store the data. If
|
RasterStack or list of raster
list_layers
, layer_stats
,
layers_correlation
## Not run: # warning using tempdir() implies that data will be downloaded again in the # next R session env <- load_layers("BO_calcite", datadir = tempdir()) ## End(Not run)
## Not run: # warning using tempdir() implies that data will be downloaded again in the # next R session env <- load_layers("BO_calcite", datadir = tempdir()) ## End(Not run)
Longitude/latitude coordinate reference system (EPSG:4326), used when using load_layers with equal_area = FALSE
lonlatproj
lonlatproj
An object of class CRS
of length 1.
Calculate the Pearson correlation coefficient matrix for a rasterstack
pearson_correlation_matrix(x, cachesize = 20, same_mask = FALSE)
pearson_correlation_matrix(x, cachesize = 20, same_mask = FALSE)
x |
RasterStack. The stack of rasters you want to calculate the Pearson
correlation coefficient matrix for. This can be obtained by calling
|
cachesize |
integer. For how many rasters should the values be kept in local memory. By default this is set to 20, a parameter which works reasonably well on a windows computer with 8GB RAM. |
same_mask |
logical. Whether we can assume that the mask is the same
for all layers (same NA values), default is |
A correlation matrix.
layers_correlation plot_correlation
load_layers
## Not run: # calculate correlation between SST and salinity in the Baltic Sea # warning using tempdir() implies that data will be downloaded again in the # next R session x <- load_layers(c("BO_sstmax", "BO_salinity"), datadir = tempdir()) e <- extent(13, 31, 52, 66) baltics <- crop(x, e) print(pearson_correlation_matrix(baltics)) ## End(Not run)
## Not run: # calculate correlation between SST and salinity in the Baltic Sea # warning using tempdir() implies that data will be downloaded again in the # next R session x <- load_layers(c("BO_sstmax", "BO_salinity"), datadir = tempdir()) e <- extent(13, 31, 52, 66) baltics <- crop(x, e) print(pearson_correlation_matrix(baltics)) ## End(Not run)
#' plot_correlation
creates a plot of the correlation between
different layers
plot_correlation(layers_correlation, prettynames = list(), palette = c("#2c7bb6", "#abd9e9", "#ffffbf", "#fdae61", "#d7191c"))
plot_correlation(layers_correlation, prettynames = list(), palette = c("#2c7bb6", "#abd9e9", "#ffffbf", "#fdae61", "#d7191c"))
layers_correlation |
matrix or dataframe. A square matrix with the
layers correlations you want to plot as returned by
|
prettynames |
list. Optional list with as names the layercodes and as values the name of the layer to be used in the plot. |
palette |
character vector. optional vector with 5 entries for the range of colors to be used for the correlation matrix plot. |
This function requires ggplot2 and plots the correlations for the layers in the same order as the layercodes are provided to this function.
A ggplot object that can be printed or saved.
layers_correlation pearson_correlation_matrix
list_layers layer_stats correlation_groups
correlation <- layers_correlation(c("BO_calcite", "BO_damin", "MS_bathy_5m")) p <- plot_correlation(correlation) print(p)
correlation <- layers_correlation(c("BO_calcite", "BO_damin", "MS_bathy_5m")) p <- plot_correlation(correlation) print(p)
Translate file name from sdmpredictors to bio-oracle
sdm_to_bo(sdm)
sdm_to_bo(sdm)
sdm |
the name of the sdm string |
A string with the name of the same file in bio-oracle
sdm_to_bo("BO2_tempmean_ss.tif") sdm_to_bo("BO21_RCP26_2050_curvelltmax_bdmax.tif")
sdm_to_bo("BO2_tempmean_ss.tif") sdm_to_bo("BO21_RCP26_2050_curvelltmax_bdmax.tif")
Terrestrial and marine predictors for species distribution modeling from multiple sources, including WorldClim (https://www.worldclim.org/), Bio-ORACLE (https://bio-oracle.org/) and MARSPEC (http://www.marspec.org/).
WorldClim: Hijmans, R.J., S.E. Cameron, J.L. Parra, P.G. Jones and A. Jarvis (2005). Very high resolution interpolated climate surfaces for global land areas. International Journal of Climatology 25: 1965-1978. (doi:10.1002/joc.1276)
ENVIREM: Title, P. O. and Bemmels, J. B. (2017). envirem: An expanded set of bioclimatic and topographic variables increases flexibility and improves performance of ecological niche modeling. Ecography (Cop.). in press. (doi:10.1111/ecog.02880)
Bio-ORACLE: Tyberghein L., Verbruggen H., Pauly K., Troupin C., Mineur F. & De Clerck O. (2012) Bio-ORACLE: a global environmental dataset for marine species distribution modeling. Global Ecology and Biogeography (doi:10.1111/j.1466-8238.2011.00656.x).
Assis, J., Tyberghein, L., Bosh, S., Verbruggen, H., Serrao, E. A., & De Clerck, O. (2017). Bio-ORACLE v2.0: Extending marine data layers for bioclimatic modelling. Global Ecology and Biogeography. (doi:10.1111/geb.12693)
MARSPEC: Sbrocco, EJ and Barber, PH (2013) MARSPEC: Ocean climate layers for marine spatial ecology. Ecology 94: 979. (doi:10.1890/12-1358.1)