
Fine Curve fitting for INPUT time-series.
curvefits(
INPUT,
brks,
wFUN = wTSM,
iters = 2,
wmin = 0.1,
nextend = 2,
maxExtendMonth = 2,
minExtendMonth = 1,
minT = 0,
methods = c("AG", "Beck", "Elmore", "Gu", "Klos", "Zhang"),
minPercValid = 0.2,
print = TRUE,
use.rough = FALSE,
use.y0 = TRUE,
...
)
A list object with the elements of 't', 'y', 'w', 'Tn' (option)
and 'ylu', returned by check_input
.
A list object with the elements of 'fit' and 'dt', returned by
season
or season_mov
, which contains the growing season
dividing information.
weights updating function, can be one of wTSM()
,
wChen()
, wBisquare()
and wSELF()
.
How many times curve fitting is implemented.
Double, minimum weigth (i.e. weight of snow, ice and cloud).
Extend curve fitting window, until nextend
good or
marginal element are found in previous and subsequent growing season.
Search good or marginal good values in previous and
subsequent maxExtendMonth
period.
Extending perid 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.
Double, use night temperature Tn to define backgroud value. Tn < minT is treated as ungrowing season.
Fine curve fitting methods, can be one or more of
c('AG', 'Beck', 'Elmore', 'Gu', 'Klos', 'Zhang')
.
If the percentage of good and marginal quality points is
less than minPercValid
, curve fiting result is set to NA
.
Whether to print progress information?
Whether to use rough fitting smoothed time-series as input?
boolean. whether to use original y0
, which is before the
process of check_input
.
Other parameters will be ignore.
fits Multiple phenofit object.
# NOT RUN {
library(phenofit)
data("MOD13A1")
df <- tidy_MOD13.gee(MOD13A1$dt)
st <- MOD13A1$st
date_start <- as.Date('2013-01-01')
date_end <- as.Date('2016-12-31')
sitename <- 'CA-NS6' # df$site[1]
d <- df[site == sitename & (date >= date_start & date <= date_end), ]
sp <- st[site == sitename, ]
south <- sp$lat < 0
nptperyear <- 23
# global parameter
IsPlot = TRUE
print = FALSE
ypeak_min = 0.05
wFUN = wTSM
# add one year in head and tail
dnew <- add_HeadTail(d, south = south, nptperyear = nptperyear)
INPUT <- check_input(dnew$t, dnew$y, dnew$w, QC_flag = dnew$QC_flag,
nptperyear = nptperyear, south = south,
maxgap = nptperyear/4, alpha = 0.02, wmin = 0.2)
# Rough fitting and growing season dividing
brks2 <- season_mov(INPUT,
rFUN = smooth_wWHIT, wFUN = wFUN,
plotdat = d, IsPlot = IsPlot, print = FALSE, IsPlot.OnlyBad = FALSE)
# Fine fitting
fit <- curvefits(
INPUT, brks2,
methods = c("AG", "Beck", "Elmore", "Zhang"), #,"klos", "Gu"
wFUN = wFUN,
nextend = 2, maxExtendMonth = 2, minExtendMonth = 1, minPercValid = 0.2,
print = TRUE, verbose = FALSE)
# }
Run the code above in your browser using DataLab