# Datasets

The package offers access to bioclimatic and other datasets - they are downloaded, saved to the disk, and then read locally. Please note that some of them require a lot of memory, so make sure your machine can handle them.

By default, the layers are stored in the assets subfolder of the current project. This being said, the prefered solution is to define a SDMLAYERS_PATH environment variable pointing to a specific path, where the layers will live. This will ensure that they are re-used between projects.

## General interface

All layers are returned as SimpleSDMPredictor, and therefore constructed by calling the SimpleSDMPredictor function on a LayerProvider and a LayerDataset, possibly with a future climate model and scenario. In all cases, the method accepts either a single layer, or an array of layers.

Data providerDatasetLayersFuture modelsFuture scenarios
EarthEnvLandcover12
EarthEnvHabitatHeterogeneity14
[WorldClim][worldclim-current]BioClim19CMIP6SharedSocioeconomicPathway
[CHELSA][chelsa-bioclim]BioClim12CMIP5RepresentativeConcentrationPathway

[earthenv-landcover]: http://www.earthenv.org/landcover [earthenv-texture]: http://www.earthenv.org/texture [worldclim-current]: https://www.worldclim.org/data/worldclim21.html [chelsa-bioclim]: http://chelsa-climate.org/

## Later providers

SimpleSDMLayers.LayerProviderType
LayerProvider

A LayerProvider is an abstract type used to dispatch the correct call of SimpleSDMPredictor to a specific dataset. A dataset is specified by a LayerProvider and a LayerDataset, as well as optionally one or multiple layers, and future climate information.

source
SimpleSDMLayers.EarthEnvType
EarthEnv

Data from the earthenv project, all released under a CC-BY-NC license to Tuanmu & Jetz. This provider currently offers LandCover and HabitatHeterogeneity rasters.

source

## Layer datasets

SimpleSDMLayers.BioClimType
BioClim

A list of 19 bioclimatic variables derived from the monthly temperature and precipitation data. This dataset is provided by WorldClim and CHELSA, both of which offer future versions under CMIP5 and CMIP6 models.

VariableDescription
1Annual Mean Temperature
2Mean Diurnal Range (Mean of monthly (max temp - min temp))
3Isothermality (BIO2/BIO7) (* 100)
4Temperature Seasonality (standard deviation *100)
5Max Temperature of Warmest Month
6Min Temperature of Coldest Month
7Temperature Annual Range (BIO5-BIO6)
8Mean Temperature of Wettest Quarter
9Mean Temperature of Driest Quarter
10Mean Temperature of Warmest Quarter
11Mean Temperature of Coldest Quarter
12Annual Precipitation
13Precipitation of Wettest Month
14Precipitation of Driest Month
15Precipitation Seasonality (Coefficient of Variation)
16Precipitation of Wettest Quarter
17Precipitation of Driest Quarter
18Precipitation of Warmest Quarter
19Precipitation of Coldest Quarter
source

## Future climate models

SimpleSDMLayers.asciiFunction
ascii(file::AbstractString, datatype::Type{T}=Float64) where {T <: Number}

Reads the content of a grid file to a SimpleSDMPredictor, the type of which is given by the datatype argument.

source
ascii(layer::SimpleSDMPredictor{T}, file::AbstractString; nodata::T=convert(T, -9999)) where {T <: Number}

Writes a layer to a grid file, with a given nodata value. The layer must store numbers.

source
ascii(layer::SimpleSDMResponse{T}, file::AbstractString; nodata::T=convert(T, -9999)) where {T <: Number}

Writes a layer to a grid file, with a given nodata value. The layer must store numbers.

source
SimpleSDMLayers.geotiffFunction
geotiff(::Type{LT}, file, bandnumber::Integer=1; left=nothing, right=nothing, bottom=nothing, top=nothing) where {LT <: SimpleSDMLayer}

The geotiff function reads a geotiff file, and returns it as a matrix of the correct type. The optional arguments left, right, bottom, and left are defining the bounding box to read from the file. This is particularly useful if you want to get a small subset from large files.

The first argument is the type of the SimpleSDMLayer to be returned.

source
geotiff(file::AbstractString, layer::SimpleSDMPredictor{T}; nodata::T=convert(T, -9999)) where {T <: Number}

Write a single layer to a file, where the nodata field is set to an arbitrary value.

source
geotiff(file::AbstractString, layers::Vector{SimpleSDMPredictor{T}}; nodata::T=convert(T, -9999)) where {T <: Number}

Stores a series of layers in a file, where every layer in a band. See geotiff for other options.

source
geotiff(file::AbstractString, layer::SimpleSDMResponse{T}; nodata::T=convert(T, -9999)) where {T <: Number}

Write a single SimpleSDMResponse layer to a file.

source
geotiff(file::AbstractString, layers::Vector{SimpleSDMResponse{T}}; nodata::T=convert(T, -9999)) where {T <: Number}

Write a vector of SimpleSDMResponse layers to bands in a file.

source