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).
detect_forages(
ts,
pheno,
win = NULL,
diff_thr = 10,
ncuts_thr = 10,
sliding = 90,
reldiff = TRUE,
byyear = TRUE
)Time series in s2ts format (generated using fill_s2ts()).
Cycle allocation (data table generated by extract_pheno()
or cut_cycles()).
List with the allowed ranges for the dates of
start of cycle (see pop_seasons for details about the format).
First threshold to detect forages (TODO improve description)
Second threshold to detect forages (TODO improve description)
Length (in days) of the sliding window in which diff_thr
and ncuts_thr must be evaluated.
Logical: should argument diff_thr refer to relative (default)
or absolute values?
Logical: compute aggregation by year (default) or globally (this should make sense in case of permanent crops).
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.