Package 'wdiEF'

Title: Calculation of the Water Deficit Index (WDI) and the Evaporative Fraction (EF) on Rasters
Description: Calculates the Water Deficit Index (WDI) and the Evaporative Fraction (EF) using geospatial data, such as fractional vegetation cover (FVC) and surface-air temperature difference (TS-TA). Terms like "raster", "CRS" are part of standard geospatial terminology.
Authors: Gaelle Hamelin [aut, cre]
Maintainer: Gaelle Hamelin <[email protected]>
License: GPL-3
Version: 1.0.2
Built: 2024-12-02 14:06:54 UTC
Source: CRAN

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)