ensemble.ecocrop | R Documentation |
Function ensemble.ecocrop
creates the map with novel conditions. Function ensemble.novel.object
provides the reference values used by the prediction function used by predict
.
ensemble.ecocrop(x = NULL, ecocrop.object = NULL,
RASTER.object.name = ecocrop.object$name,
RASTER.stack.name = "xTitle",
RASTER.format = "GTiff", RASTER.datatype = "INT2S", RASTER.NAflag = -32767,
CATCH.OFF = FALSE)
ensemble.ecocrop.object(temp.thresholds, rain.thresholds, name = "crop01",
temp.multiply = 1, annual.temps = TRUE, transform = 1)
x |
RasterStack object ( |
ecocrop.object |
Object listing optimal and absolute minima and maxima for the rainfall and temperature values, used by the prediction function that is used internally by |
RASTER.object.name |
First part of the names of the raster file that will be generated, expected to identify the species or crop for which ranges were calculated |
RASTER.stack.name |
Last part of the names of the raster file that will be generated, expected to identify the predictor stack used |
RASTER.format |
Format of the raster files that will be generated. See |
RASTER.datatype |
Format of the raster files that will be generated. See |
RASTER.NAflag |
Value that is used to store missing data. See |
CATCH.OFF |
Disable calls to function |
temp.thresholds |
Optimal and absolute thresholds for temperatures. These will be sorted as: absolute minimum temperature, optimal minimum temperature, optimal maximum temperature and absolute maximum temperature. |
rain.thresholds |
Optimal and absolute thresholds for annual rainfall. These will be sorted as: absolute minimum rainfall, optimal minimum rainfall, optimal maximum rainfall and absolute maximum rainfall. |
name |
Name of the object, expect to expected to identify the species or crop |
temp.multiply |
Multiplier for temperature values. The value of 10 is to be used with raster layers where temperature was multiplied by 10 such as Worldclim version 1 or AFRICLIM. |
annual.temps |
If |
transform |
Exponent used to transform probability values obtained from interpolating between optimal and absolute limits. Exponent of 2 results in squaring probabilities, for example input probabilities of 0.5 transformed to 0.5^2 = 0.25. |
Function ensemble.ecocrop
maps suitability for a species or crop based on optimal and absolute temperature and rainfall limits. Where both temperature and rainfall are within the optimal limits, suitability of 1000 is calculated. Where both temperature and rainfall are outside the absolute limits, suitability of 0 is calculated. In situations where temperature or rainfall is in between the optimal and absolute limits, then suitability is interpolated between 0 and 1000, and the lowest suitability from temperature and rainfall is calculated. Setting very wide rainfall limits will simulate the effect of irrigation, i.e. where suitability only depends on temperature limits.
For a large range of crop and plant species, optimal and absolute limits are available from the FAO ecocrop database (https://gaez.fao.org/pages/ecocrop-search), hence the name of the function. A different implementation of suitability mapping based on ecocrop limits is available from ecocrop
. Ecocrop thresholds for several species are available from: getCrop
Function ensemble.ecocrop.object
returns a list with following objects:
name |
name for the crop or species |
temp.thresholds |
optimal and absolute minimum and maximum temperature limits |
rain.thresholds |
optimal and absolute minimum and maximum annual rainfall limits |
annual.temps |
logical indicating whether temperature limits apply to annual temperatures |
transform |
exponent to transform suitability values |
Roeland Kindt (World Agroforestry Centre)
biovars
## Not run:
# test with Brazil nut (limits from FAO ecocrop)
# temperature: (12) 20-36 (40)
# annnual rainfall: (1400) 2400-2800 (3500)
# get predictor variables
library(dismo)
predictor.files <- list.files(path=paste(system.file(package="dismo"), '/ex', sep=''),
pattern='grd', full.names=TRUE)
predictors <- stack(predictor.files)
# subset based on Variance Inflation Factors
predictors <- subset(predictors, subset=c("bio5", "bio6", "bio12"))
predictors
predictors@title <- "base"
# As the raster data correspond to WorldClim version 1,
# the temperatures need to be multiplied by 10
Brazil.ecocrop <- ensemble.ecocrop.object(temp.thresholds=c(20, 36, 12, 40),
rain.thresholds=c(2400, 2800, 1400, 3500),
temp.multiply=10,
annual.temps=FALSE, name="Bertholletia_excelsa")
Brazil.ecocrop
ensemble.ecocrop(predictors,
ecocrop.object=Brazil.ecocrop,
RASTER.stack.name="base")
dev.new()
par.old <- graphics::par(no.readonly=T)
graphics::par(mfrow=c(1,2))
rasterfull1 <- paste("ensembles//ecocrop//Bertholletia_excelsa_base.tif", sep="")
rasterfull1 <- raster(rasterfull1)
# raster file saved probabilities as integer values between 0 and 1000
rasterfull1 <- rasterfull1/1000
raster::plot(rasterfull1, main="Ecocrop suitability")
GBIFloc <- gbif(genus="Bertholletia", species="excelsa", geo=TRUE)
GBIFpres <- GBIFloc[, c("lon", "lat")]
GBIFpres <- GBIFpres[complete.cases(GBIFpres), ]
GBIFpres <- GBIFpres[duplicated(GBIFpres) == FALSE, ]
point.suitability <- extract(rasterfull1, y=GBIFpres)
point.suitability[is.na(point.suitability)] <- -1
GBIFpres.optimal <- GBIFpres[point.suitability == 1, ]
GBIFpres.suboptimal <- GBIFpres[point.suitability < 1 & point.suitability > 0, ]
GBIFpres.not <- GBIFpres[point.suitability == 0, ]
raster::plot(rasterfull1, main="GBIF locations",
sub="blue: optimal, cyan: suboptimal, red: not suitable")
bg.legend <- c("blue", "cyan", "red")
points(GBIFpres.suboptimal, pch=21, cex=1.2, bg=bg.legend[2])
points(GBIFpres.optimal, pch=21, cex=1.2, bg=bg.legend[1])
points(GBIFpres.not, pch=21, cex=1.2, bg=bg.legend[3])
graphics::par(par.old)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.