The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.
macroBiome is an R package that provides functions with both point and grid modes for simulating biomes by equilibrium vegetation models, with a special focus on paleoenvironmental applications.
Three widely used equilibrium biome models are currently implemented in the package: the Holdridge Life Zone (HLZ) system (Holdridge 1947), the Köppen-Geiger classification (KGC) system (Köppen 1936) and the BIOME model (Prentice et al. 1992). Three climatic forest-steppe models are also implemented.
An approach for estimating monthly time series of relative sunshine duration from temperature and precipitation data (Yin 1999) is also adapted, allowing process-based biome models to be combined with high-resolution paleoclimate simulation datasets (e.g., CHELSA-TraCE21k v1.0 dataset).
Installing the latest stable version from CRAN:
install.packages("macroBiome")
You can install the development version of macroBiome like so:
if (!require(devtools)) install.packages("devtools")
::install_github("szelepcsenyi/macroBiome") devtools
Create a biome map of the Eastern Mediterranean–Black Sea–Caspian-Corridor region for the period 1991-2020 using the CRU TS v.4.05 dataset (Harris et al. 2020)
<- c("R.utils", "rasterVis", "latticeExtra", "rnaturalearth")
list.of.packages <- list.of.packages[!(list.of.packages %in% installed.packages()[,"Package"])]
new.packages if (length(new.packages)) { install.packages(new.packages) }
library(macroBiome)
library(terra)
library(raster)
library(rasterVis)
# Target domain: Eastern Mediterranean–Black Sea–Caspian-Corridor region
<- raster(crs = "+proj=longlat +datum=WGS84 +no_defs",
e ext = extent(20., 60., 33., 49.),
resolution = 0.5)
# Set some magic numbers and parameters
<- 1991
fiyr <- 12
n_moy <- 3
n_dec <- 10
l_dec <- "https://crudata.uea.ac.uk/cru/data/hrg/cru_ts_4.05/cruts.2103051243.v4.05/"
path <- c("tmp", "pre", "cld")
cv.var_lbl <- paste0(seq(fiyr, by = l_dec, length.out = n_dec), ".",
cv.ts seq(fiyr + l_dec - 1, by = l_dec, length.out = n_dec), ".")
# Download the annual time series of meteorological data, and
# compute their multi-year averages
for (i_var in 1 : length(cv.var_lbl)) {
<- raster::stack()
rstr for (i_ts in 1 : length(cv.ts)) {
<- tempfile(fileext = ".nc.gz")
fileLCL <- paste0(path, cv.var_lbl[i_var], "/cru_ts4.05.",
fileRMT ".dat.nc.gz")
cv.ts[i_ts], cv.var_lbl[i_var], download.file(fileRMT, destfile = fileLCL, mode = "wb")
<- R.utils::gunzip(fileLCL)
nc <- stack(rstr, crop(brick(nc, varname = cv.var_lbl[i_var]), e))
rstr
}<- stackApply(rstr, indices = rep(seq(1, n_moy), (n_dec * l_dec)),
rstr fun = mean, na.rm = FALSE)
assign(cv.var_lbl[i_var], round(rstr, 1))
rm(rstr)
}
# Convert cloudiness values to relative sunshine duration data
# For the approach used, see Doorenbos and Pruitt (1977)
# https://www.fao.org/3/f2430e/f2430e.pdf
<- calc(cld, fun = macroBiome:::cldn2bsdf)
bsd
# Download the altitude data (use the TBASE data)
<- "http://research.jisao.washington.edu/data_sets/elevation/elev.0.5-deg.nc"
url <- tempfile()
tmpy download.file(url, tmpy, mode = "wb")
<- stack(tmpy)
elv <- crop(rotate(elv), e)
elv < 0.] <- 0.
elv[elv
# Apply the BIOME model
<- trunc(mean(seq(fiyr, fiyr + (n_dec * l_dec) - 1)))
year <- cliBIOMEGrid(tmp, pre, bsd, elv, sc.year = year)
rs.BIOME
# Make a color key for vegetation classes used in the BIOME model
<- vegClsNumCodes$Code.BIOME[!is.na(vegClsNumCodes$Code.BIOME)]
Name <- c("#01665E", "#5AB4AC", "#8C510A", "#FB9A99", "#64D264", "#C9FFC9",
Col "#147814", "#6A3D9A", "#22E6FF", "#0000E7", "#E31A1C", "#D8B365",
"#F6E8C3", "#CAB2D6", "#FF7F00", "#FDBF6F", "#D1E5F0")
<- data.frame(Code = seq(1, length(Name)), Name = Name, Col = Col)
bioColours rm(Name, Col)
# Reclassify the raw data of the generated biome map
<- as.numeric(levels(factor(values(rs.BIOME)[!is.na(values(rs.BIOME))])))
slctd <- matrix(c(NA, slctd, NA, seq(1, length(slctd))), ncol = 2)
reclass_mtx <- as.factor(classify(rs.BIOME, reclass_mtx))
biome <- unlist(lapply(reclass_mtx[-1, 1],
class function(i) { subset(bioColours, Code == i, select = Name)}))
<- data.frame(ID = reclass_mtx[-1, 2], class = class)
rat levels(biome)[[1]] <- rat
# Plot the biome map
<- "Eastern Mediterranean–Black Sea–Caspian-Corridor region"
main <- levelplot(biome, main = main, col.regions = bioColours$Col[slctd],
plt colorkey = list(space = "bottom", height = 1.1), pretty = T,
par.settings = list(layout.widths = list(axis.key.padding = 4)))
<- plt + latticeExtra::layer(sp.lines(as(rnaturalearth::countries110, "Spatial"),
plt col = "gray30", lwd = 2.0))
print(plt)
citation("macroBiome")
To cite package ‘macroBiome’ in publications use:
Szelepcsényi Z (2024) macroBiome: A Tool for Mapping the Distribution of the Biomes and Bioclimate. R package version 0.4.0. https://doi.org/10.5281/zenodo.7633367
I have invested a considerable amount of time and effort in creating the package ‘macroBiome’. Please cite it if you use it.
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.