-
Notifications
You must be signed in to change notification settings - Fork 1
/
Format to Ameriflux standards.R
188 lines (132 loc) · 5.16 KB
/
Format to Ameriflux standards.R
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
182
183
184
185
186
187
188
rm(list = ls())
library(data.table)
library(ggplot2)
library(zoo)
Sys.setenv(TZ = "UTC")
setwd('C:/Users/karndt.WHRC/Desktop/sites/YKD/data/unburned/')
########## 2023 ####################
c23 = fread(input = "./YKD_UB_2023_clean.csv")
c23$ts = as.POSIXct(c23$ts,format = '%m/%d/%Y %H:%M')
fullts = seq(from = as.POSIXct('2023-01-01 00:00'), to = as.POSIXct('2023-12-31 23:30'),by = 60*30)
fullts = as.data.frame(fullts)
names(fullts) = 'ts'
c23 = merge(fullts,c23,all = T)
ggplot(data = c23)+
geom_point(aes(ts,co2_flux.c))
ggplot(data = c23)+
geom_point(aes(ts,ch4_flux.c))
ggplot(data = c23)+
geom_point(aes(ts,H.c))
ggplot(data = c23)+
geom_point(aes(ts,LE.c))
names(c23)
c23$ALB_1_1_1.c = ifelse(c23$ALB_1_1_1 < 0 | c23$ALB_1_1_1 > 1, NA, c23$ALB_1_1_1)
ggplot(data = c23)+
geom_point(aes(ts,ALB_1_1_1.c))
ggplot(data = c23)+
geom_point(aes(ts,LWIN_1_1_1,col='LWIN_1_1_1'))+
geom_point(aes(ts,LWOUT_1_1_1,col='LWOUT_1_1_1'))
c23$LWIN_1_1_1.c = c23$LWIN_1_1_1
c23$LWOUT_1_1_1.c = c23$LWOUT_1_1_1
ggplot(data = c23)+
geom_point(aes(ts,PPFD_1_1_1,col='PPFD_1_1_1'))+
geom_point(aes(ts,SWIN_1_1_1,col='SWIN_1_1_1'))+
geom_point(aes(ts,SWOUT_1_1_1,col='SWOUT_1_1_1'))
c23$PPFD_1_1_1.c = c23$PPFD_1_1_1
c23$SWIN_1_1_1.c = c23$SWIN_1_1_1
c23$SWOUT_1_1_1.c = c23$SWOUT_1_1_1
ggplot(data = c23)+
geom_point(aes(ts,SHF_1_1_1,col='SHF_1_1_1'))+
geom_point(aes(ts,SHF_2_1_1,col='SHF_2_1_1'))+
geom_point(aes(ts,SHF_3_1_1,col='SHF_3_1_1'))
c23$SHF_1_1_1.c = c23$SHF_1_1_1
c23$SHF_2_1_1.c = c23$SHF_2_1_1
c23$SHF_3_1_1.c = c23$SHF_3_1_1
ggplot(data = c23)+
geom_point(aes(ts,SWC_1_1_1,col='SWC_1_1_1'))+
geom_point(aes(ts,SWC_2_1_1,col='SWC_2_1_1'))+
geom_point(aes(ts,SWC_3_1_1,col='SWC_3_1_1'))
c23$SWC_1_1_1.c = c23$SWC_1_1_1
c23$SWC_2_1_1.c = c23$SWC_2_1_1
c23$SWC_3_1_1.c = c23$SWC_3_1_1
ggplot(data = c23)+
geom_point(aes(ts,TS_1_1_1,col='TS_1_1_1'))+
geom_point(aes(ts,TS_2_1_1,col='TS_2_1_1'))+
geom_point(aes(ts,TS_3_1_1,col='TS_3_1_1'))
c23$TS_1_1_1.c = c23$TS_1_1_1
c23$TS_2_1_1.c = c23$TS_2_1_1
c23$TS_3_1_1.c = c23$TS_3_1_1
c23$TA_1_1_1.c = ifelse(c23$TA_1_1_1 > c23$air_t_mean + 5 | c23$TA_1_1_1 < c23$air_t_mean - 5,NA,c23$TA_1_1_1)
ggplot(data = c23)+geom_hline(yintercept = 0)+
geom_point(aes(ts,TA_1_1_1.c-273.15))
ggplot(data = c23)+
geom_point(aes(air_t_mean-273.15,TA_1_1_1.c-273.15))+
geom_abline(intercept = 0,slope = 1,col='red')
c23$RH_1_1_1.c = ifelse(is.na(c23$TA_1_1_1.c),NA,c23$RH_1_1_1)
ggplot(data = c23)+geom_hline(yintercept = 0)+
geom_point(aes(ts,RH_1_1_1.c))
c23$date = as.POSIXct(c23$date,format = '%m/%d/%Y')
c23$date.y = as.POSIXct(c23$date.y,format = '%m/%d/%Y')
write.csv(x = c23,file = './YKDUnburned_Cleaned_Met_Flux_2023_Ameriflux.csv',row.names = F)
################# 2024 ############################
c24 = fread("./YKD_UB_2024_clean.csv")
fullts = seq(from = as.POSIXct('2024-01-01 00:00'), to = as.POSIXct('2024-08-31 23:30'),by = 60*30)
fullts = as.data.frame(fullts)
names(fullts) = 'ts'
c24 = merge(fullts,c24,all = T)
ggplot(data = c24)+
geom_point(aes(ts,co2_flux.c))
ggplot(data = c24)+
geom_point(aes(ts,ch4_flux.c))
ggplot(data = c24)+
geom_point(aes(ts,H.c))
ggplot(data = c24)+
geom_point(aes(ts,LE.c))
c24$ALB_1_1_1.c = ifelse(c24$ALB_1_1_1 < 0 | c24$ALB_1_1_1 > 1, NA, c24$ALB_1_1_1)
ggplot(data = c24)+
geom_point(aes(ts,ALB_1_1_1.c))
ggplot(data = c24)+
geom_point(aes(ts,LWIN_1_1_1,col='LWIN_1_1_1'))+
geom_point(aes(ts,LWOUT_1_1_1,col='LWOUT_1_1_1'))
c24$LWIN_1_1_1.c = c24$LWIN_1_1_1
c24$LWOUT_1_1_1.c = c24$LWOUT_1_1_1
ggplot(data = c24)+
geom_point(aes(ts,PPFD_1_1_1,col='PPFD_1_1_1'))+
geom_point(aes(ts,SWIN_1_1_1,col='SWIN_1_1_1'))+
geom_point(aes(ts,SWOUT_1_1_1,col='SWOUT_1_1_1'))
c24$PPFD_1_1_1.c = c24$PPFD_1_1_1
c24$SWIN_1_1_1.c = c24$SWIN_1_1_1
c24$SWOUT_1_1_1.c = c24$SWOUT_1_1_1
ggplot(data = c24)+
geom_point(aes(ts,SHF_1_1_1,col='SHF_1_1_1'))+
geom_point(aes(ts,SHF_2_1_1,col='SHF_2_1_1'))+
geom_point(aes(ts,SHF_3_1_1,col='SHF_3_1_1'))
c24$SHF_1_1_1.c = c24$SHF_1_1_1
c24$SHF_2_1_1.c = c24$SHF_2_1_1
c24$SHF_3_1_1.c = c24$SHF_3_1_1
ggplot(data = c24)+
geom_point(aes(ts,SWC_1_1_1,col='SWC_1_1_1'))+
geom_point(aes(ts,SWC_2_1_1,col='SWC_2_1_1'))+
geom_point(aes(ts,SWC_3_1_1,col='SWC_3_1_1'))
c24$SWC_1_1_1.c = c24$SWC_1_1_1
c24$SWC_2_1_1.c = c24$SWC_2_1_1
c24$SWC_3_1_1.c = c24$SWC_3_1_1
ggplot(data = c24)+
geom_point(aes(ts,TS_1_1_1,col='TS_1_1_1'))+
geom_point(aes(ts,TS_2_1_1,col='TS_2_1_1'))+
geom_point(aes(ts,TS_3_1_1,col='TS_3_1_1'))
c24$TS_1_1_1.c = c24$TS_1_1_1
c24$TS_2_1_1.c = c24$TS_2_1_1
c24$TS_3_1_1.c = c24$TS_3_1_1
c24$TA_1_1_1.c = ifelse(c24$TA_1_1_1 > c24$air_t_mean + 5 | c24$TA_1_1_1 < c24$air_t_mean - 5,NA,c24$TA_1_1_1)
ggplot(data = c24)+geom_hline(yintercept = 0)+
geom_point(aes(ts,TA_1_1_1.c-273.15))
ggplot(data = c24)+
geom_point(aes(air_t_mean-273.15,TA_1_1_1.c-273.15))+
geom_abline(intercept = 0,slope = 1,col='red')
c24$RH_1_1_1.c = ifelse(is.na(c24$TA_1_1_1.c),NA,c24$RH_1_1_1)
ggplot(data = c24)+
geom_point(aes(ts,RH_1_1_1.c))
c24$date = as.POSIXct(c24$date,format = '%m/%d/%Y')
c24$date.y = as.POSIXct(c24$date.y,format = '%m/%d/%Y')
write.csv(x = c24,file = './YKDUnburned_Cleaned_Met_Flux_2024_Ameriflux.csv',row.names = F)