Skip to contents

This function analyzes root growth directions in relation to depth gradients. It calculates the ratio of root pixels growing in the direction of the steepest depth slope compared to all root pixels.

Usage

deep_drive(
  DepthMap = NULL,
  AngleMap = NULL,
  RootMap = NULL,
  select.layerRM = NULL,
  select.layerDM = NULL,
  select.layerAM = NULL
)

Arguments

DepthMap

SpatRast object containing depth information

AngleMap

Optional SpatRast with D8 root angles (from terra::terrain(v="flowdir"))

RootMap

Optional SpatRast containing segmented, presence-absence root image

select.layerRM

Integer. Specifies which layer to use if the input is a multi-band image. Default is `2`.

select.layerDM

Integer. Specifies which layer to use if the input is a multi-band image. Default is `NULL`.

select.layerAM

Integer. Specifies which layer to use if the input is a multi-band image. Default is `NULL`.

Value

If return_diagnostics=FALSE, returns numeric value representing the ratio of aligned root pixels to total root pixels. If TRUE, returns a list containing the ratio and diagnostic information.

Examples

data(skl_Oulanka2023_Session01_T067)
im = ceiling(terra::rast(skl_Oulanka2023_Session01_T067)/255)
DepthMap = terra::t(create_depthmap(im,center.offset=0,tube.thicc=3.5))
#> Processing row 100 of 4900
#> Processing row 200 of 4900
#> Processing row 300 of 4900
#> Processing row 400 of 4900
#> Processing row 500 of 4900
#> Processing row 600 of 4900
#> Processing row 700 of 4900
#> Processing row 800 of 4900
#> Processing row 900 of 4900
#> Processing row 1000 of 4900
#> Processing row 1100 of 4900
#> Processing row 1200 of 4900
#> Processing row 1300 of 4900
#> Processing row 1400 of 4900
#> Processing row 1500 of 4900
#> Processing row 1600 of 4900
#> Processing row 1700 of 4900
#> Processing row 1800 of 4900
#> Processing row 1900 of 4900
#> Processing row 2000 of 4900
#> Processing row 2100 of 4900
#> Processing row 2200 of 4900
#> Processing row 2300 of 4900
#> Processing row 2400 of 4900
#> Processing row 2500 of 4900
#> Processing row 2600 of 4900
#> Processing row 2700 of 4900
#> Processing row 2800 of 4900
#> Processing row 2900 of 4900
#> Processing row 3000 of 4900
#> Processing row 3100 of 4900
#> Processing row 3200 of 4900
#> Processing row 3300 of 4900
#> Processing row 3400 of 4900
#> Processing row 3500 of 4900
#> Processing row 3600 of 4900
#> Processing row 3700 of 4900
#> Processing row 3800 of 4900
#> Processing row 3900 of 4900
#> Processing row 4000 of 4900
#> Processing row 4100 of 4900
#> Processing row 4200 of 4900
#> Processing row 4300 of 4900
#> Processing row 4400 of 4900
#> Processing row 4500 of 4900
#> Processing row 4600 of 4900
#> Processing row 4700 of 4900
#> Processing row 4800 of 4900
#> Processing row 4900 of 4900

deep_drive(DepthMap = DepthMap, RootMap = im, select.layerRM = 2, select.layerAM = 2)
#> Warning: Warning in main function: No valid pixels found for calculation