calculate_WDI {wdiEF}R Documentation

Calculate the Water Deficit Index (WDI)

Description

This function calculates the WDI from two rasters: fractional vegetation cover (FVC) and the surface-air temperature difference (TS-TA). It saves the resulting WDI raster to the specified output path.

Usage

calculate_WDI(
  FVC_path,
  TS_TA_path,
  output_path,
  n_intervals = 20,
  percentile = 0.01
)

Arguments

FVC_path

Character. File path to the FVC raster.Must have the same CRS and extent as the TS-TA raster.

TS_TA_path

Character. File path to the raster of TS-TA (surface-air temperature difference). TS and TA must have the same unit of measurement (Kelvin preferably).

output_path

Character. File path where the WDI raster will be saved.

n_intervals

Integer. Number of intervals for splitting FVC values (default: 20).

percentile

Numeric. Percentage used for identifying wet and dry edges (default: 0.01).

Details

Value

A raster object representing the Water Deficit Index (WDI).

Examples

# Paths to example data included in the package
library(terra)

FVC_raster <- rast(system.file("extdata", "FVC_reduced.tif", package = "wdiEF"))
TS_TA_raster <- rast(system.file("extdata", "TS_TA_reduced.tif", package = "wdiEF"))


# Output path (temporary file for example purposes)
output_path <- tempfile(fileext = ".tif")

# Run the function
calculate_WDI(
  FVC_path = FVC_raster,
  TS_TA_path = TS_TA_raster,
  output_path = output_path,
  n_intervals = 20,
  percentile = 0.01
)

# Print the output path
print(output_path)


[Package wdiEF version 1.0.3 Index]