detect_forages: Detect forages

View source: R/detect_forages.R

detect_foragesR Documentation

Detect forages

Description

Experimental function to detect forages (time series characterised by a high "instability"). Already detected cycles are labelled as "forage" (adjacent ones are dissolved) basing on arguments diff_thr and ncuts_thr (see).

Usage

detect_forages(
  ts,
  pheno,
  win = NULL,
  diff_thr = 10,
  ncuts_thr = 10,
  sliding = 90,
  reldiff = TRUE,
  byyear = TRUE
)

Arguments

ts

Time series in s2ts format (generated using fill_s2ts()).

pheno

Cycle allocation (data table generated by extract_pheno() or cut_cycles()).

win

List with the allowed ranges for the dates of start of cycle (see pop_seasons for details about the format).

diff_thr

First threshold to detect forages (TODO improve description)

ncuts_thr

Second threshold to detect forages (TODO improve description)

sliding

Length (in days) of the sliding window in which diff_thr and ncuts_thr must be evaluated.

reldiff

Logical: should argument diff_thr refer to relative (default) or absolute values?

byyear

Logical: compute aggregation by year (default) or globally (this should make sense in case of permanent crops).

Value

A data table in the format of the input pheno, in which adjacent forage cycles are merged. An additional logical field forage discriminates forages from non-forages.

Author(s)

Luigi Ranghetti, PhD (2021) luigi@ranghetti.info


ranghetti/sen2rts documentation built on March 31, 2024, 1:18 a.m.