Skip to contents

Calculates the spectral derivative at a specific wavelength using one of three methods:

  • "central": Central difference method, f'(x) ≈ f(x+h1) - f(x-h2)/(h1+h2)

  • "forward": Forward difference method, f'(x) ≈ f(x+h) - f(x)/h

  • "backward": Backward difference method, f'(x) ≈ f(x) - f(x-h)/h

Where h, h1, and h2 are wavelength differences between bands. The derivative provides information about the rate of change in reflectance, which can be useful for identifying absorption features and inflection points.

Usage

calculate_derivative(
  raster,
  derivative_name,
  band,
  method = "central",
  extent = NULL,
  extension = NULL,
  filename = NULL
)

Arguments

raster

terra SpatRaster of normalized capture data.

derivative_name

a character, lower case name of calculated derivative.

band

numeric, wavelength at which to calculate the derivative.

method

character, method to use for derivative calculation. One of "central" (default), "forward", or "backward".

extent

an extent or SpatVector used to subset SpatRaster. Defaults to the entire SpatRaster.

extension

character, a graphic format extension.

filename

NULL (default) to write automatically into products, provide full path and extension to override.

Value

one layer terra SpatRaster with calculated derivative values.