forked from eco4cast/neon4cast-terrestrial
-
Notifications
You must be signed in to change notification settings - Fork 3
/
data_explore.Rmd
181 lines (138 loc) · 4.04 KB
/
data_explore.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
---
title: "Terrestrial_data_example"
output:
html_document: default
pdf_document: default
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
```{r}
renv::restore()
library(neonUtilities)
library(neonstore)
library(tidyverse)
library(lubridate)
library(contentid)
```
Load Flux data
```{r}
# Terrestrial
#DP4.00200.001 & DP1.00094.001
neon_store(product = "DP4.00200.001", n = 500)
flux_data <- neon_table(table = "nsae-basic")
flux_data <- flux_data %>%
mutate(time = as_datetime(timeBgn))
```
## CO2 flux data
### (turblent + storage flux): ALL data
```{r}
flux_data %>%
ggplot(aes(x = time, y = data.fluxCo2.nsae.flux)) +
geom_point() +
scale_x_datetime(date_labels = "%Y-%m") +
facet_wrap(~siteID)
```
### (turblent + storage flux): Pass QAQC
Requires both the turbulent and storage flux to pass the QAQC
```{r}
flux_data %>% filter(qfqm.fluxCo2.turb.qfFinl == 0 &
qfqm.fluxCo2.stor.qfFinl == 0) %>%
ggplot(aes(x = time, y = data.fluxCo2.nsae.flux)) +
geom_point() +
scale_x_datetime(date_labels = "%Y-%m") +
facet_wrap(~siteID)
```
### use only turblent fluxes: Pass QAQC
Requires only turbulent pass the QAQC
```{r}
flux_data %>% filter(qfqm.fluxH2o.turb.qfFinl == 0) %>%
ggplot(aes(x = time, y = data.fluxH2o.turb.flux)) +
geom_point() +
scale_x_datetime(date_labels = "%Y-%m") +
facet_wrap(~siteID)
```
## Latent heat flux data
### (turblent + storage flux): ALL data
```{r}
flux_data %>%
ggplot(aes(x = time, y = data.fluxH2o.nsae.flux)) +
geom_point() +
scale_x_datetime(date_labels = "%Y-%m") +
facet_wrap(~siteID)
```
### (turblent + storage flux): Pass QAQC
Requires both the turbulent and storage flux to pass the QAQC
```{r}
flux_data %>% filter(qfqm.fluxH2o.turb.qfFinl == 0 &
qfqm.fluxH2o.stor.qfFinl == 0) %>%
ggplot(aes(x = time, y = data.fluxH2o.nsae.flux)) +
geom_point() +
scale_x_datetime(date_labels = "%Y-%m") +
facet_wrap(~siteID)
```
### Only use turblent fluxes: Pass QAQC
Requires only turbulent pass the QAQC
```{r}
flux_data %>% filter(qfqm.fluxH2o.turb.qfFinl == 0) %>%
ggplot(aes(x = time, y = data.fluxH2o.turb.flux)) +
geom_point() +
scale_x_datetime(date_labels = "%Y-%m") +
facet_wrap(~siteID)
```
## Soil moisture
Load data
```{r}
neon_store(table = "SWS_30_minute", n = 500)
d2 <- neon_read(table = "sensor_positions")
sm30 <- neon_table(table = "SWS_30_minute")
neon_store(table = "sensor_positions", n = 500)
sensor_positions <- neon_table(table = "sensor_positions")
```
Clean up sensor positions
```{r}
sensor_positions <- sensor_positions %>%
mutate(horizontalPosition = str_sub(sensor_positions$HOR.VER, 1, 3),
verticalPosition = str_sub(HOR.VER, 5, 7),
siteID = str_sub(file, 10, 13)) %>%
rename(sensorDepths = zOffset) %>%
filter(siteID %in% c("KONZ", "BART", "OSBS", "SRER")) %>%
select(sensorDepths, horizontalPosition, verticalPosition, siteID)
sm30 <- left_join(sm30, sensor_positions, by = c("siteID", "verticalPosition", "horizontalPosition"))
```
Clean soil moisture with QC flag
```{r}
sm30 <- sm30 %>%
select(startDateTime, endDateTime, VSWCMean, siteID, horizontalPosition, verticalPosition, VSWCFinalQF, sensorDepths) %>%
mutate(VSWCMean = as.numeric(VSWCMean)) %>%
filter(VSWCFinalQF == 0)
```
### BART
Panels are depth
```{r}
sm30 %>% filter(siteID == "BART" & horizontalPosition == "001") %>%
ggplot(aes(x = startDateTime, y = VSWCMean)) +
geom_point() +
facet_wrap(~sensorDepths)
```
### KONZ
```{r}
sm30 %>% filter(siteID == "KONZ" & horizontalPosition == "001") %>%
ggplot(aes(x = startDateTime, y = VSWCMean)) +
geom_point()+
facet_wrap(~factor(sensorDepths))
```
### OSBS
```{r}
sm30 %>% filter(siteID == "OSBS" & horizontalPosition == "001") %>%
ggplot(aes(x = startDateTime, y = VSWCMean)) +
geom_point()+
facet_wrap(~factor(sensorDepths))
```
### SRER
```{r}
sm30 %>% filter(siteID == "SRER" & horizontalPosition == "001") %>%
ggplot(aes(x = startDateTime, y = VSWCMean)) +
geom_point()+
facet_wrap(~factor(sensorDepths))
```