forked from BrennaS/Activity-4_B-Owned
-
Notifications
You must be signed in to change notification settings - Fork 0
/
04_Master.Rmd
52 lines (39 loc) · 1.09 KB
/
04_Master.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
---
title: "04_Master.Rmd"
author: "Radost Stanimirova"
date: "February 17, 2016"
output: html_document
---
## Master script for phenology analysis
## Load required functions
```{r}
if(file.exists("01_download.phenocam.R")) source("01_download.phenocam.R")
if(file.exists("02_plot.phenocam.R")) source("02_plot.phenocam.R")
if(file.exists("03_logistic.R")) source("03_logistic.R")
```
## Download phenology data
```{r}
URL = "http://phenocam.sr.unh.edu/data/archive/uiefprairie/ROI/uiefprairie_GR_0001_1day_v4.csv"
prairie.pheno <- download.phenocam(URL)
```
## Plot overall phenology data
```{r}
plot.phenocam(prairie.pheno)
```
## Create and visualize subset of data for leaf out
```{r}
spring = as.Date(c("2015-01-01","2015-06-01"))
dat = subset(prairie.pheno,date > spring[1] & date < spring[2], select=c(date,gcc_mean,gcc_std))
plot.phenocam(dat)
```
## Fit logistic model
```{r}
dat$doy = as.POSIXlt(dat$date)$yday
par = c(0.33,0.11,-10,0.1)
fit = fit.logistic(dat,par)
```
## Visualize model and data
```{r}
plot.phenocam(dat)
lines(dat$date,pred.logistic(fit$par,dat$doy),col=2)
```