Closed kongdd closed 1 year ago
library(phenofit)
library(data.table)
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:data.table':
##
## between, first, last
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
df = fread("E:/Hainan_SIF_1sp.txt") %>%
rename(t = Date, y = SIF)
df$t <- as.Date(df$t) # 转为日期类型
#### 从SIF中提取物候
## 1、预处理
inputs <-check_input(df$t, df$y, nptperyear = 46, south = FALSE,
maxgap = 46/4, alpha = 0.02, wmin = 0.2)
plot_input(inputs) # 查看输入数据
## 2、生长季划分(粗拟合、更新权重)
rFun<-'smooth_wWHIT' # 粗拟合方法,包括:smooth_wHANTS,smooth_wSG,smooth_wWHIT(推荐)
wFun<-'wTSM' # 更新权重方法,包括:wSELF,wTSM(推荐),wBisquare0(推荐),wBisquare(推荐),wChen,wKong
brks2 <- season_mov(inputs,options=list(rFun=rFun,wFun=wFun,
r_min=0.00, ypeak_min=0.05, lambda=NULL,verbose=F))
plot_season(inputs, brks2, df) # 这里会报错,Error in plot.window(...) : 'xlim'值不对
## 3、精拟合(包含更新权重)
fit <- curvefits(inputs, brks2,
options = list(methods = c("AG", "Beck", "Elmore", "Zhang"),
wFUN = wFun,nextend = 2,
maxExtendMonth = 2, minExtendMonth = 1, minPercValid = 0.2))
## 4、提取模拟结果
r_param = get_param(fit)
r_pheno = get_pheno(fit)
r_gof = get_GOF(fit)
d_fit = get_fitting(fit)
g <- plot_curvefits(d_fit, brks2)
grid::grid.newpage(); grid::grid.draw(g)
## save fig using Ipaper
# Ipaper::write_fig(g, "curvefit.pdf", 10, 6)
问题已解决
存在问题:
2、在运行完“生长季划分”并制图时,会报错(代码:plot_season(InputSIF1,brks2,dd) #Error in plot.window(...) : 'xlim'值不对),可能是我数据的问题,但是我和“CA_NS6”数据对照,没有发现问题在哪里。 3、个别年份没有物候信息,如2005年,2006年,2012年,2013年和2017年,是否可以通过调参把没有物候信息的年份弄出来,需要用到哪些参数。 4、单个物候站点的模拟参数如何应用到栅格数据集,做面尺度的物候提取。
Data link
Hainan_SIF_1sp.txt