-
Notifications
You must be signed in to change notification settings - Fork 10
/
README.Rmd
72 lines (60 loc) · 2.85 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r setup, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# rTIMESAT
[![Travis Build Status](https://travis-ci.org/kongdd/rTIMESAT.svg?branch=master)](https://travis-ci.org/kongdd/rTIMESAT)
[![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/kongdd/rTIMESAT?branch=master&svg=true)](https://ci.appveyor.com/project/kongdd/rTIMESAT)
[![codecov](https://codecov.io/gh/kongdd/rTIMESAT/branch/master/graph/badge.svg)](https://codecov.io/gh/kongdd/rTIMESAT)
[![License](http://img.shields.io/badge/license-GPL%20%28%3E=%202%29-brightgreen.svg?style=flat)](http://www.gnu.org/licenses/gpl-2.0.html)
[![CRAN](http://www.r-pkg.org/badges/version/rTIMESAT)](https://cran.r-project.org/package=rTIMESAT)
[![DOI](https://zenodo.org/badge/171882895.svg)](https://zenodo.org/badge/latestdoi/171882895)
R package: Extract Remote Sensing Vegetation Phenology by TIMESAT Fortran library.
## Installation
You can install the released version of rTIMESAT from GitHub with:
<!-- [CRAN](https://CRAN.R-project.org) with: -->
```{r, eval=FALSE}
# install.packages("rTIMESAT")
devtools::install_github("kongdd/rTIMESAT")
```
## Example
This is a basic example which shows you how to use `rTIMESAT`:
```{r}
## 1. TIMESAT options
# Note the length of `FUN` should be one.
# see details of every parameter in `write_setting`.
nptperyear = 23
options <- list(
ylu = c(0, 9999), # Valid data range (lower upper)
qc_1 = c(0, 0, 1), # Quality range 1 and weight
qc_2 = c(1, 1, 0.5), # Quality range 2 and weight
qc_3 = c(2, 3, 0.2), # Quality range 3 and weight
A = 0.1, # Amplitude cutoff value
output_type = c(1, 1, 0), # Output files (1/0 1/0 1/0), 1: seasonality data; 2: smoothed time-series; 3: original time-series
seasonpar = 1.0, # Seasonality parameter (0-1)
iters = 2, # No. of envelope iterations (3/2/1)
FUN = 2, # Fitting method (1/2/3): (SG/AG/DL)
half_win = 7, # half Window size for Sav-Gol.
meth_pheno = 1, # (1: seasonal amplitude, 2: absolute value, 3: relative amplitude, 4: STL trend)
trs = c(0.5, 0.5) # Season start / end values
)
```
```{r}
library(rTIMESAT)
library(phenofit)
data("MOD13A1")
sitename <- "US-KS2"
# sitename <- "CA-NS6"
d <- subset(MOD13A1$dt, date >= as.Date("2004-01-01") & date <= as.Date("2010-12-31") & site == sitename)
r <- TSF_main(y = d$EVI/1e4, qc = d$SummaryQA, nptperyear,
jobname = sitename, options, cache = FALSE)
print(str(r))
```