Package 'bioclim'

Title: Bioclimatic Analysis and Classification
Description: Using numeric or raster data, this package contains functions to calculate: complete water balance, bioclimatic balance, bioclimatic intensities, reports for individual locations, multi-layered rasters for spatial analysis.
Authors: Roberto Serrano-Notivoli
Maintainer: Roberto Serrano-Notivoli <[email protected]>
License: GPL-3
Version: 0.4.0
Built: 2024-12-25 06:30:55 UTC
Source: CRAN

Help Index


Bioclimatic Balance

Description

A SpatRaster containing the bioclimatic balance of the Alps.

Usage

bbRast

Format

A PackedSpatRaster with 12 monthly values of 4 variables: B, b, bc and bl.


Computation of Bioclimatic Balance

Description

Computes bioclimatic balance from water balance.

Usage

biobal(balhid, CC)

Arguments

balhid

Water balance.

CC

Field capacity. It depends on water retention capacity and depth of roots. 400 as default value.

Value

data frame with 12 variables: 'p', 'Tm', 'PET', 'e', 'D', 'S', 'Cd', 'T_75', 'B', 'b', 'bl', 'bc'.

Examples

wb <- watbal(t = rnorm(12, 18, 6), p = rnorm(12, 50, 30), lat = 35, CC = 400)
biobal(wb, 400)

Computation of Bioclimatic Balance (raster mode)

Description

Computes bioclimatic balance from water balance in raster format.

Usage

biobalRaster(bh, CC, path = NULL, ncpu = 1)

Arguments

bh

Water balance in raster format.

CC

Field capacity. It depends on water retention capacity and depth of roots. 400 as default value. It can be a SpatRaster layer.

path

Optional. Path (folder) where the output raster files and look-up-tables will be saved.

ncpu

Number of CPUs to use. By default, sequential mode (1 cpu) is used.

Value

SpatRaster with 48 layers corresponding to the 12 monthly values of 'B', 'b','bc','bl'.

Examples

wb <- terra::rast(wbRast)
bb <- biobalRaster(wb, CC = 400, path=NULL, ncpu = 2)

Function to create individual complete report

Description

This function creates a complete report for a specific location, from temperature and precipitation data series.

Usage

bioclim_report(t, p, nam, lat, CC, output)

Arguments

t

Monthly average temperature data (12 nueric values).

p

Monthly average precipitation data (12 nueric values).

nam

Name of the location. It will be used as name of output file

lat

Latitude in degrees. For southern latitudes use negative values.

CC

Field capacity. It depends on water retention capacity and depth of roots. Use 400 as default value.

output

Path of the output pdf file.

Value

data frame with 20 variables: 'p', 'Tm', 'PET', 'e', 'D', 'S', 's_e_D', 'sum_s', 'c_D_e', 'sum_c', 'Q', 'x', 'E_e', 'D_e', 'Cd', 'T_75', 'B', 'b', 'bl', 'bc'.

Examples

bioclim_report(t = c(10, 11.5, 14, 16.5, 20, 24.5, 27.5, 28, 24.5, 19.5, 14.5, 11),
p = c(55, 73, 84, 58, 33, 23, 2, 2, 28, 66, 94, 71),
lat = 35, nam = 'Seville', CC = 400, output ='./seville.pdf')

Computation of Bioclimatic Intensities

Description

Computes bioclimatic intensities from bioclimatic balance.

Usage

bioint(bb)

Arguments

bb

Bioclimatic balance.

Details

The function yields 10 variables at monthly scale corresponding with the warm (w) and cold (c) variants of 5 bioclimatic intensities: PBI (Potential bioclimatic intensity), RBI (Real bioclimatic intensity), CBI (Conditioned bioclimatic intensity), FBI (Free bioclimatic intensity), and DBI (Dry bioclimatic intensity).

Value

data.frame with 10 variables. See details.

Examples

wb <- watbal(t = rnorm(12, 18, 6), p = rnorm(12, 50, 30), lat = 35, CC = 400)
bb <- biobal(wb, 400)
bi <- bioint(bb)

Computation of Bioclimatic Intensities (raster mode)

Description

Computes bioclimatic intensities from bioclimatic balance.

Usage

biointRaster(bb, path = NULL)

Arguments

bb

Bioclimatic balance in raster format.

path

Optional. Path (folder) where the output raster files will be saved.

Value

SpatRaster with 120 layers corresponding to the 12 monthly values of "IBPc","IBCc","IBLc","IBRc","IBSc","IBPf","IBCf","IBLf","IBRf","IBSf".

Examples

bb <- terra::rast(bbRast)
bi <- biointRaster(bb, path=NULL)

Bioclimatic classification

Description

Calculates bioclimatic classification based on bioclimatic balance.

Usage

biotype(t = NULL, p = NULL, lat = NULL, wb = NULL, bb = NULL, CC = NULL, mode)

Arguments

t

Numeric. Monthly temperature required for water balance calculation.

p

Numeric. Monthly precipitation required for water balance calculation.

lat

Numeric. Latitude required for water balance calculation.

wb

Water balance in data.frame format from watbal() function. If provided, 't' and 'p' are not used.

bb

Bioclimatic balancein data.frame format from biobal() function. If provided, 't', 'p' and 'wb' are not used.

CC

Field capacity. It depends on water retention capacity and depth of roots. 400 as default value.

mode

Type of output: "TBR", "sub", or "zonal". See details.

Details

Argument "mode" defines the type of return ("TBR": Types of Bioclimatic Regime; "zonal": zonal units; "sub": bioclimatic regime subtypes)

Value

character defining the type of climate.

Examples

# calculation of water balance
wb <- watbal(t = rnorm(12, 18, 6), p = rnorm(12, 50, 30), lat = 35, CC = 400)
# calculation of bioclimatic balance
bb <- biobal(wb, 400)

# bioclimatic classification at TBR levels
biotype(bb = bb, mode = 'TBR')

# bioclimatic classification at zonal levels
biotype(bb = bb, mode = 'zonal')

# bioclimatic classification at subtypes levels (requires water balance)
wb <- watbal(t = rnorm(12, 18, 6), p = rnorm(12, 50, 30), lat = 35, CC = 400)
biotype(wb = wb, CC = 400, mode = 'sub')

Bioclimatic classification (raster mode)

Description

Calculates bioclimatic classification based on bioclimatic balance.

Usage

biotypeRaster(
  temp = NULL,
  prec = NULL,
  CC = NULL,
  path = NULL,
  ncpu = 1,
  PET = NULL,
  bh = NULL
)

Arguments

temp

SpatRaster object with 12 layers representing temperature from January to December.

prec

SpatRaster object with 12 layers representing precipitation from January to December.

CC

Field capacity. It can be numeric (1 value) or a SpatRaster object.

path

Optional. Path (folder) where the output raster files and look-up-tables will be saved.

ncpu

number of cores to use in calculation. If not provided, sequential mode is used (1 core).

PET

Potential evapotranspiration. Optional. It must be a SpatRaster object.

bh

Water balance. Optional. It must be a SpatRaster object.

Value

SpatRaster with 3 variables ("TBR": Types of Bioclimatic Regime; "zonal": zonal units; "sub": bioclimatic regime subtypes).

Examples

wb <- terra::rast(wbRast)
btr <- biotypeRaster(bh = wb)

Function to calculate Thornthwaite’s index

Description

This function calculates Thornthwaite’s index to refine the bioclimatic classification.

Usage

ith(bh)

Arguments

bh

Water balance in data.frame format from watbal() function.

Value

Character, describing the humid characteristics of the climate.

Examples

wb <- watbal(t = rnorm(12, 18, 6), p = rnorm(12, 50, 30), lat = 35, CC = 400)
ith(wb)

Function to calculate Thornthwaite’s index (raster format)

Description

This function calculates Thornthwaite’s index to refine the bioclimatic classification.

Usage

ithRaster(bh)

Arguments

bh

Water balance in SpatRaster format from watbalRaster() function.

Value

Numeric, describing the humid characteristics of the climate. 1: 'HyperArid', 2: 'Arid', 3: 'Semiarid', 4: 'Dry humid', 5: 'Moist humid', 6 'Low humid', 7: 'Moderate humid', 8: 'Highly humid', 9: 'Very humid', 10: 'Perhumid'.

Examples

wb <- terra::rast(wbRast)
itr <- ithRaster(wb)

Function to plot bioclimatic balance

Description

Function to plot bioclimatic balance.

Usage

plotBiobal(intens)

Arguments

intens

bioclimatic intensities in data.frame format from bioint() function.

Value

Plot of bioclimatic balance

Examples

wb <- watbal(t = c(10, 11.5, 14, 16.5, 20, 24.5, 27.5, 28, 24.5, 19.5, 14.5, 11),
             p = c(55, 73, 84, 58, 33, 23, 2, 2, 28, 66, 94, 71), lat = 35, CC = 400)
bb <- biobal(wb, 400)
bi <- bioint(bb)
plotBiobal(bi)

Function to plot water balance

Description

Function to plot water balance.

Usage

plotWatbal(bh)

Arguments

bh

Water balance in data.frame format from watbal() function.

Value

Plot of water balance

Examples

wb <- watbal(t = c(10, 11.5, 14, 16.5, 20, 24.5, 27.5, 28, 24.5, 19.5, 14.5, 11),
p = c(55, 73, 84, 58, 33, 23, 2, 2, 28, 66, 94, 71), lat = 35, CC = 400)
plotWatbal(wb)

Function to plot Walter and Lieth diagram

Description

Function to plot Walter and Lieth diagram.

Usage

plotWL(t, p)

Arguments

t

Monthly average temperature data (12 nueric values).

p

Monthly average precipitation data (12 nueric values).

Value

Plot of Walter and Lieth diagram

Examples

plotWL(t = rnorm(12, 18, 6), p = rnorm(12, 50, 30))

Function to Positive Temperature index

Description

Computes Positive Temperature index from monthly temperature.

Usage

postemp(t)

Arguments

t

Monthly average temperature data (12 nueric values).

Value

Positive Temperature index

Examples

postemp(rnorm(12, 18, 6))

Monthly precipitation

Description

A SpatRaster containing the monthly precipitation of the Alps.

Usage

preRast

Format

A PackedSpatRaster with 12 monthly values precipitation:


Function to Compensated Thermal Index

Description

Computes Compensated Thermal Index from monthly temperature.

Usage

thermind(t)

Arguments

t

Monthly average temperature data (12 nueric values).

Value

Compensated Thermal Index

Examples

thermind(rnorm(12, 18, 6))

Function to calculate Thornthwaite potential evapotranspiration

Description

This function calculates Thornthwaite’s potential evapotranspiration.

Usage

thornthwaite(Tave, lat, na.rm = FALSE)

Arguments

Tave

a numeric vector, matrix or time series of monthly mean temperatures, ºC.

lat

a numeric vector with the latitude of the site or sites, in degrees.

na.rm

optional, a logical value indicating whether NA values should be stripped from the computations.

Details

This function is a modified version of SPEI::thornthwaite() function.

Value

A time series with the values of monthly potential or reference evapotranspiration, in mm. If the input is a matrix or a multivariate time series each column will be treated as independent data (e.g., diferent observatories), and the output will be a multivariate time series.

Author(s)

Santiago Begueria

Examples

thornthwaite(rnorm(12, 18, 6), 35)

Monthly temperature

Description

A SpatRaster containing the monthly temperature of the Alps.

Usage

tmpRast

Format

A PackedSpatRaster with 12 monthly values temperature:


Function to calculate water balance

Description

Computes water balance from temperature and precipitation data.

Usage

watbal(t, p, lat, CC)

Arguments

t

Monthly average temperature data (12 nueric values).

p

Monthly average precipitation data (12 nueric values).

lat

Latitude in degrees. For southern latitudes use negative values.

CC

Field capacity. It depends on water retention capacity and depth of roots. Use 400 as default value.

Value

data frame with 12 variables: 'Tmp', 'Pcp', 'PET', 'P_PET', 'ppa', 'ST', 'i_ST', 'ETR', 'Dh', 'S', 'r', 'rP'.

Examples

watbal(t = rnorm(12, 18, 6), p = rnorm(12, 50, 30),
       lat = 35, CC = 400)

Water balance in raster format

Description

Computes water balance from temperature and precipitation in raster format.

Usage

watbalRaster(temp, prec, PET = NULL, CC, path = NULL, ncpu = 2)

Arguments

temp

SpatRaster containing 12 layers with monthly temperature from January to December.

prec

SpatRaster containing 12 layers with monthlyprecipitation from January to December.

PET

Optional. Potential evapotranspiration in raster format.

CC

Field capacity. It depends on water retention capacity and depth of roots. 400 as default value. It can be a SpatRaster layer.

path

Optional. Path (folder) where the output raster files and look-up-tables will be saved.

ncpu

Number of cores used for the most demanding calculations.

Value

SpatRaster with 144 layers corresponding to the 12 monthly values of 'temp', 'prec','PET','P_PET','PPA','ST','i_ST','RET','HD','HEX','r','rP'.

Examples

tmp <- terra::rast(tmpRast)
pre <- terra::rast(preRast)
wb <- watbalRaster(tmp, pre, PET = NULL, CC = 400, path=NULL, ncpu = 2)

Water Balance

Description

A SpatRaster containing the water balance of the Alps.

Usage

wbRast

Format

A PackedSpatRaster with 12 monthly values of 12 variables: temp, prec, PET, P_PET, PPA, ST, i_ST, RET, HD, HEX, r, rP.