Package 'wdiEF'

Title: Calculation of the Water Deficit Index (WDI) and the Evaporative Fraction (EF) on Rasters
Description: Provides functions to calculate the Water Deficit Index (WDI) and the Evaporative Fraction (EF) using geospatial raster data such as fractional vegetation cover (FVC) and surface-air temperature difference (TS-TA). The package automates regression-based edge fitting and produces continuous spatial maps of surface moisture and evaporative dynamics.
Authors: Gaelle Hamelin [aut, cre] (ORCID: <https://orcid.org/0009-0007-2148-7937>)
Maintainer: Gaelle Hamelin <[email protected]>
License: GPL-3
Version: 1.0.4
Built: 2026-05-18 08:23:41 UTC
Source: https://github.com/cran/wdiEF

Help Index


Calculate the Evaporative Fraction (EF)

Description

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

Usage

calculate_EF(
  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 EF 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

  • The input rasters (FVC and TS-TA) must have the same CRS (Coordinate Reference System) and extent.

  • If they differ, the function will attempt to reproject and resample the rasters automatically.

Value

A raster object representing the Evaporative Fraction (EF).

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_EF(
  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)

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

  • The input rasters (FVC and TS-TA) must have the same CRS (Coordinate Reference System) and extent.

  • If they differ, the function will attempt to reproject and resample the rasters automatically.

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)