set and get phenofit option

set_options(..., options = NULL)

get_options(names = NULL)

Arguments

...

list of phenofit options FUN_season: character, season_mov or season rFUN: character, rough fitting function. smooth_wWHIT, smooth_wSG or smooth_wHANTs.

options

If not NULL, options will overwrite the default parameters (get_options()).

  • qcFUN : function to process qc flag, see qcFUN() for details.

  • nptperyear : Integer, number of images per year.

  • wFUN : character (default wTSM), the name of weights updating functions, can be one of c("wTSM", "wChen", "wBisquare", "wSELF"). See wTSM(), wChen(), wBisquare() and wSELF() for details.

    • If options$season$wFUN or options$season$wFUN is NULL, the options$wFUN will overwrite it.

  • wmin : double, the minimum weigth of bads points (i.e. snow, ice and cloud).

    • If options$season$wmin or options$season$wmin is NULL, the options$wmin will overwrite it.

  • season : See the following part: options for season for details.

  • fitting : See the following part: options for fitting for details.

names

vector of character, names of options

options for season

(a) Parameters for rough fitting

  • rFUN : character (default smooth_wWHIT), the name of rough curve fitting function, can be one of c("smooth_wSG", "smooth_wWHIT", "smooth_wHANTS"), which are corresponding to smooth_wSG(), smooth_wWHIT() and smooth_wHANTS().

  • wFUN : character (default wTSM), the name of weights updating functions, can be one of c("wTSM", "wChen", "wBisquare", "wSELF"). See wTSM(), wChen(), wBisquare() and wSELF() for details.

  • iters : integer (default 2), the number of rough fitting iterations.

  • wmin : double, the minimum weight of bad points (i.e. snow, ice and cloud).

  • verbose : logical (default FALSE). If TRUE, options$season will be printed on the console.

  • lambda : double (default NULL), the smoothing parameter of smooth_wWHIT().

    • If lambda = NULL, V-curve theory will be employed to find the optimal lambda. See lambda_vcurve() for details.

  • frame : integer (default NULL), the parameter of smooth_wSG(), moving window size.

    • If frame = NULL, frame will be reset as floor(nptperyear/5)*2 + 1 (refered by TIMESAT).

  • nf : integer (default 4), the number of frequencies in smooth_wHANTS().

  • maxExtendMonth: integer (default 12), previous and subsequent maxExtendMonth (in month) data were added to the current year for rough fitting.

  • nextend : integer (default NULL), same as maxExtendMonth, but in points.

    • If nextend provided, maxExtendMonth will be ignored.

    • If nextend = NULL, nextend will be reset as ceiling(maxExtendMonth/12*nptperyear)

(b) Parameters for growing season division

  • minpeakdistance : double (default NULL), the minimum distance of two peaks (in points). If the distance of two maximum extreme value less than minpeakdistance, only the maximum one will be kept.

    • If minpeakdistance = NULL, it will be reset as nptperyear/6.

  • r_max : double (default 0.2; in (0, 1)). r_max and r_min are used to eliminate fake peaks and troughs.

    • The real peaks should satisfy:

      1. \(max(h_{peak, L}, h_{peak, R}) > r_{max} A\)

      2. \(min(h_{peak, L}, h_{peak, R}) > r_{min} A,\) where \(h_{peak, L}, h_{peak, R}\) are height difference from the peak to the left- and right-hand troughs.

    • The troughs should satisfy:

      1. \(max(h_{trough, L}, h_{trough, R}) > r_{max} A,\) where \(h_{trough, L}, h_{trough, R}\) are height difference from the trough to the left- and right-hand peaks.

  • r_min : double (default 0.05; in (0, 1)), see above r_max for details. r_min < r_max.

  • rtrough_max : double (default 0.6, in (0, 1)), \(y_{peak} <= rtrough_max * A + ylu[1]\).

  • ypeak_min : double 0.1 (in VI unit), \(y_{peak} >= ypeak_min\).

  • .check_season : logical (default TRUE). check the growing season length according to len_min and len_max. If FALSE, len_min and len_max will lose their effect.

  • len_min : integer (default 45), the minimum length (in days) of growing season

  • len_max : integer (default 650), the minimum length (in days) of growing season

  • adj.param : logical. If TRUE (default), if there are too many or too less peaks and troughs, phenofit will automatically adjust rough curve fitting function parameters. See MaxPeaksPerYear and MaxTroughsPerYear for details.

  • MaxPeaksPerYear (optional) : integer (default 2), the max number of peaks per year. If PeaksPerYear > MaxPeaksPerYear, then lambda = lambda*2.

  • MaxTroughsPerYear (optional) : integer (default 3), the max number of troughs per year. If TroughsPerYear > MaxTroughsPerYear, then lambda = lambda*2.

  • calendarYear : logical (default FALSE). If TRUE, the start and end of a calendar year will be regarded as growing season division (North Hemisphere is from 01 Jan to 31 Dec; South Hemisphere is from 01 Jul to 30 Jun).

  • rm.closed : logical (default TRUE). If TRUE, closed peaks (or troughs) will be further tidied. Only the maximum

  • is.continuous (not used): logical (default TRUE). This parameter is for fluxnet2015 fluxsite data, where the input might be not continuous.

options for fitting

  • methods (default c('AG', 'Beck', 'Elmore', 'Zhang')``): Fine curve fitting methods, can be one or more of c('AG', 'Beck', 'Elmore', 'Zhang', 'Gu', 'Klos')`. Note that 'Gu' and 'Klos' are very slow.

  • iters (default 2): max iterations of fine fitting.

  • wFUN (default wTSM): Character or function, weights updating function of fine fitting function.

  • wmin (default 0.1): min weights in the weights updating procedure.

  • use.rough (default FALSE): Whether to use rough fitting smoothed time-series as input? If false, smoothed VI by rough fitting will be used for Phenological metrics extraction; If true, original input y will be used (rough fitting is used to divide growing seasons and update weights.

  • use.y0 (default TRUE): boolean. whether to use original y0 as the input of plot_input, note that not for curve fitting. y0 is the original value before the process of check_input.

  • nextend (default 2): Extend curve fitting window, until nextend good or marginal points are found in the previous and subsequent growing season.

  • maxExtendMonth (default 1): Search good or marginal good values in previous and subsequent maxExtendMonth period.

  • minExtendMonth (default 0.5): Extend period defined by nextend and maxExtendMonth, should be no shorter than minExtendMonth. When all points of the input time-series are good value, then the extending period will be too short. In that situation, we can't make sure the connection between different growing seasons is smoothing.

  • minPercValid: (default 0, not use). If the percentage of good- and marginal- quality points is less than minPercValid, curve fiting result is set to NA.

  • minT: (not use). If Tn not provided in INPUT, minT will not be used. minT use night temperature Tn to define backgroud value (days with Tn < minT treated as ungrowing season).

Examples

set_options(verbose = FALSE) 
get_options("season") %>% str()
#> List of 24
#>  $ rFUN             : chr "smooth_wWHIT"
#>  $ iters            : num 2
#>  $ wmin             : num 0.1
#>  $ wFUN             :function (y, yfit, w, iter = 2, nptperyear, wfact = 0.5, ...)  
#>   ..- attr(*, "name")= chr "wTSM"
#>  $ verbose          : logi TRUE
#>  $ lambda           : num 10
#>  $ frame            : num 9
#>  $ nf               : num 4
#>  $ minpeakdistance  : NULL
#>  $ ypeak_min        : num 0.05
#>  $ r_max            : num 0.2
#>  $ r_min            : num 0.05
#>  $ rtrough_max      : num 0.6
#>  $ MaxPeaksPerYear  : num 2
#>  $ MaxTroughsPerYear: num 3
#>  $ calendarYear     : logi FALSE
#>  $ adj.param        : logi TRUE
#>  $ rm.closed        : logi TRUE
#>  $ is.continuous    : logi TRUE
#>  $ .check_season    : logi TRUE
#>  $ maxExtendMonth   : num 12
#>  $ nextend          : NULL
#>  $ len_min          : num 45
#>  $ len_max          : num 650