forked from JBrenn/DataBaseAlpEnvEURAC
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.Rhistory
512 lines (512 loc) · 23.4 KB
/
.Rhistory
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
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
str(dummy)
names(out_data)[name_spec]
names(dummy) <- names(out_data[grep(substr(i,3,6),names(out_data))])
dummy <- zoo(NA, time(out_data[grep(substr(i,3,6),names(out_data))][[min2]][[min1[[min2]]]]))
i
dat
str(data)
str(out_data)
Helper4me::help_updateGITlib("DataBaseAlpEnvEURAC")
library(DataBaseAlpEnvEURAC)
TAG <- dB_readZRX2station(files = dir(), write_csv = T, output_path = getwd(), do.hourly = F, do.quality = F, chron = T, multivar = F, multistation = F, saveRData = T)
dir()
setwd("../60A/")
A60 <- dB_readZRX2station(files = dir(), write_csv = T, output_path = getwd(), do.hourly = F, do.quality = F, chron = T, multivar = F, multistation = F, saveRData = T)
getwd()
A60 <- dB_readZRX2station(files = dir(), write_csv = T, output_path = getwd(), do.hourly = F, do.quality = F, chron = T, multivar = F, multistation = F, saveRData = T)
A60 <- dB_readZRX2station(files = dir(), write_csv = T, output_path = getwd(), do.hourly = F, do.quality = F, chron = T, multivar = F, multistation = F, saveRData = T)
setwd("../30A/")
A30 <- dB_readZRX2station(files = dir(), write_csv = T, output_path = getwd(), do.hourly = F, do.quality = F, chron = T, multivar = F, multistation = F, saveRData = T)
setwd("../10A/")
A10 <- dB_readZRX2station(files = dir(), write_csv = T, output_path = getwd(), do.hourly = F, do.quality = F, chron = T, multivar = F, multistation = F, saveRData = T)
setwd("../5A/")
A5 <- dB_readZRX2station(files = dir(), write_csv = T, output_path = getwd(), do.hourly = F, do.quality = F, chron = T, multivar = F, multistation = F, saveRData = T)
setwd("../F1")
F1 <- dB_readZRX2station(files = dir(), write_csv = T, output_path = getwd(), do.hourly = T, do.quality = F, chron = T, multivar = F, multistation = F, saveRData = T)
load("/home/jbre/Schreibtisch/zrx/DEBUG/Test2/F1/data.RData")
plot(station_data$st0039)
load("/home/jbre/Schreibtisch/zrx/Monalisa/data.RData")
plot(station_data$st8512)
library(zoo)
plot(station_data$st8512)
plot(station_data$st8730)
plot(station_data$st7848)
load("/media/alpenv/Projekte/MONALISA/05_Arbeitsbereiche/BrJ/01_data/SMC/meteo/data.RData")
?create.geotop.meteo.files
str(station_data)
names(station_data$st8512)
names(station_data)
tokeep <- list(st8512=c(T,T,T,F,T,T,T,T), st8730=c(T,T), st7848=c(T,T,T,T,T,F,F,F,F,T,T,T))
namesGEO <- list(st8512=c("Swglobal","RelHum", "AirT", "DewT", "WindSp", "WindDir", "IPrec"),
st8730=c("AirT", "IPrec"),
st7848=c("Swglobal", "SnowHeight", "AirP", "AirT", "WindSp", "WindDir", "IPrec"))
inGEO <- list()
for (i in names(station_data))
{
inGEO[[i]] <- station_data[[i]][,tokeep[[i]]]
names(inGEO[[i]]) <- namesGEO[[i]]
}
i
inGEO <- list()
for (i in names(station_data))
{
inGEO[[i]] <- station_data[[i]][,tokeep[[i]]]
names(inGEO[[i]]) <- namesGEO[[i]]
}
tokeep <- list(st8512=c(T,T,T,F,T,T,T,T), st8730=c(T,T), st7848=c(T,T,T,T,T,F,F,F,F,T,T,T))
namesGEO <- list(st8512=c("Swglobal","RelHum", "AirT", "DewT", "WindSp", "WindDir", "IPrec"),
st8730=c("AirT", "IPrec"),
st7848=c("Swglobal", "SnowHeight", "AirP","RelHum", "AirT", "WindSp", "WindDir", "IPrec"))
inGEO <- list()
for (i in names(station_data))
{
inGEO[[i]] <- station_data[[i]][,tokeep[[i]]]
names(inGEO[[i]]) <- namesGEO[[i]]
}
str(inGEO)
# LD - AirP
tokeep <- list(st8512=c(T,T,T,F,T,T,T,T), st8730=c(T,T), st7848=c(T,T,T,T,T,F,F,F,F,T,T,T))
namesGEO <- list(st8512=c("Swglobal","RelHum", "AirT", "DewT", "WindSp", "WindDir", "IPrec"),
st8730=c("AirT", "IPrec"),
st7848=c("Swglobal", "SnowHeight", "AirP","RelHum", "AirT", "WindSp", "WindDir", "IPrec"))
inGEO <- list()
for (i in names(station_data))
{
inGEO[[i]] <- station_data[[i]][,tokeep[[i]]]
names(inGEO[[i]]) <- namesGEO[[i]]
if (any(name(inGEO[[i]]=="Iprec"))) coredata(inGEO[[i]])[,"Iprec"] <- ifelse(coredata(inGEO[[i]])[,"Iprec"] > 100, NA, coredata(inGEO[[i]])[,"Iprec"])
}
tokeep <- list(st8512=c(T,T,T,F,T,T,T,T), st8730=c(T,T), st7848=c(T,T,T,T,T,F,F,F,F,T,T,T))
namesGEO <- list(st8512=c("Swglobal","RelHum", "AirT", "DewT", "WindSp", "WindDir", "IPrec"),
st8730=c("AirT", "IPrec"),
st7848=c("Swglobal", "SnowHeight", "AirP","RelHum", "AirT", "WindSp", "WindDir", "IPrec"))
inGEO <- list()
for (i in names(station_data))
{
inGEO[[i]] <- station_data[[i]][,tokeep[[i]]]
names(inGEO[[i]]) <- namesGEO[[i]]
if (any(names(inGEO[[i]]=="Iprec"))) coredata(inGEO[[i]])[,"Iprec"] <- ifelse(coredata(inGEO[[i]])[,"Iprec"] > 100, NA, coredata(inGEO[[i]])[,"Iprec"])
}
i
tokeep <- list(st8512=c(T,T,T,F,T,T,T,T), st8730=c(T,T), st7848=c(T,T,T,T,T,F,F,F,F,T,T,T))
namesGEO <- list(st8512=c("Swglobal","RelHum", "AirT", "DewT", "WindSp", "WindDir", "IPrec"),
st8730=c("AirT", "IPrec"),
st7848=c("Swglobal", "SnowHeight", "AirP","RelHum", "AirT", "WindSp", "WindDir", "IPrec"))
inGEO <- list()
for (i in names(station_data))
{
inGEO[[i]] <- station_data[[i]][,tokeep[[i]]]
names(inGEO[[i]]) <- namesGEO[[i]]
if (any(names(inGEO[[i]])=="Iprec")) coredata(inGEO[[i]])[,"Iprec"] <- ifelse(coredata(inGEO[[i]])[,"Iprec"] > 100, NA, coredata(inGEO[[i]])[,"Iprec"])
}
plot(inGEO$st8730)
tokeep <- list(st8512=c(T,T,T,F,T,T,T,T), st8730=c(T,T), st7848=c(T,T,T,T,T,F,F,F,F,T,T,T))
namesGEO <- list(st8512=c("Swglobal","RelHum", "AirT", "DewT", "WindSp", "WindDir", "Iprec"),
st8730=c("AirT", "IPrec"),
st7848=c("Swglobal", "SnowHeight", "AirP","RelHum", "AirT", "WindSp", "WindDir", "Iprec"))
inGEO <- list()
for (i in names(station_data))
{
inGEO[[i]] <- station_data[[i]][,tokeep[[i]]]
names(inGEO[[i]]) <- namesGEO[[i]]
if (any(names(inGEO[[i]])=="Iprec")) coredata(inGEO[[i]])[,"Iprec"] <- ifelse(coredata(inGEO[[i]])[,"Iprec"] > 100, NA, coredata(inGEO[[i]])[,"Iprec"])
}
plot(inGEO$st8730)
tokeep <- list(st8512=c(T,T,T,F,T,T,T,T), st8730=c(T,T), st7848=c(T,T,T,T,T,F,F,F,F,T,T,T))
namesGEO <- list(st8512=c("Swglobal","RelHum", "AirT", "DewT", "WindSp", "WindDir", "Iprec"),
st8730=c("AirT", "Iprec"),
st7848=c("Swglobal", "SnowHeight", "AirP","RelHum", "AirT", "WindSp", "WindDir", "Iprec"))
inGEO <- list()
for (i in names(station_data))
{
inGEO[[i]] <- station_data[[i]][,tokeep[[i]]]
names(inGEO[[i]]) <- namesGEO[[i]]
if (any(names(inGEO[[i]])=="Iprec")) coredata(inGEO[[i]])[,"Iprec"] <- ifelse(coredata(inGEO[[i]])[,"Iprec"] > 100, NA, coredata(inGEO[[i]])[,"Iprec"])
}
plot(inGEO$st8730)
str(inGEO$st8512)
time(inGEO$st8512)
as.POSIXct(time(inGEO$st8512))
as.POSIXct(time(inGEO$st8512), origin=as.POSIXct("1970-01-01"))
library(chron)
str(inGEO$st8512)
library(geotopbricks)
library(chron)
load("/media/alpenv/Projekte/MONALISA/05_Arbeitsbereiche/BrJ/01_data/SMC/meteo/data.RData")
str(station_data)
tokeep <- list(st8512=c(T,T,T,F,T,T,T,T), st8730=c(T,T), st7848=c(T,T,T,T,T,F,F,F,F,T,T,T))
namesGEO <- list(st8512=c("Swglobal","RelHum", "AirT", "DewT", "WindSp", "WindDir", "Iprec"),
st8730=c("AirT", "Iprec"),
st7848=c("Swglobal", "SnowHeight", "AirP","RelHum", "AirT", "WindSp", "WindDir", "Iprec"))
inGEO <- list()
for (i in names(station_data))
{
inGEO[[i]] <- station_data[[i]][,tokeep[[i]]]
names(inGEO[[i]]) <- namesGEO[[i]]
if (any(names(inGEO[[i]])=="Iprec")) coredata(inGEO[[i]])[,"Iprec"] <- ifelse(coredata(inGEO[[i]])[,"Iprec"] > 100, NA, coredata(inGEO[[i]])[,"Iprec"])
}
plot(inGEO$st8730)
setwd("/media/alpenv/Projekte/MONALISA/05_Arbeitsbereiche/BrJ/01_data/SMC/meteo")
geotopbricks::create.geotop.meteo.files(x = inGEO, file_prefix = "meteo")
setwd("/media/alpenv/Projekte/MONALISA/05_Arbeitsbereiche/BrJ/01_data/SMC/meteo")
tokeep <- list(st8512=c(T,T,T,F,T,T,T,T), st8730=c(T,T), st7848=c(T,T,T,T,T,F,F,F,F,T,T,T))
namesGEO <- list(st8512=c("Swglobal","RelHum", "AirT", "DewT", "WindSp", "WindDir", "Iprec"),
st8730=c("AirT", "Iprec"),
st7848=c("Swglobal", "SnowHeight", "AirP","RelHum", "AirT", "WindSp", "WindDir", "Iprec"))
inGEO <- list()
for (i in names(station_data))
{
inGEO[[i]] <- station_data[[i]][,tokeep[[i]]]
names(inGEO[[i]]) <- namesGEO[[i]]
if (any(names(inGEO[[i]])=="Iprec")) coredata(inGEO[[i]])[,"Iprec"] <- ifelse(coredata(inGEO[[i]])[,"Iprec"] > 100, NA, coredata(inGEO[[i]])[,"Iprec"])
# to GEOtop format
df <- data.frame(Date=format(time(inGEO[[i]])), coredata(inGEO[[i]]))
write.csv(df, file = paste("meteo",i,sep="_"), quote = F, sep = ",", row.names = F)
}
# LD - AirP
tokeep <- list(st8512=c(T,T,T,F,T,T,T,T), st8730=c(T,T), st7848=c(T,T,T,T,T,F,F,F,F,T,T,T))
namesGEO <- list(st8512=c("Swglobal","RelHum", "AirT", "DewT", "WindSp", "WindDir", "Iprec"),
st8730=c("AirT", "Iprec"),
st7848=c("Swglobal", "SnowHeight", "AirP","RelHum", "AirT", "WindSp", "WindDir", "Iprec"))
inGEO <- list()
for (i in names(station_data))
{
inGEO[[i]] <- station_data[[i]][,tokeep[[i]]]
names(inGEO[[i]]) <- namesGEO[[i]]
if (any(names(inGEO[[i]])=="Iprec")) coredata(inGEO[[i]])[,"Iprec"] <- ifelse(coredata(inGEO[[i]])[,"Iprec"] > 100, NA, coredata(inGEO[[i]])[,"Iprec"])
# to GEOtop format
df <- data.frame(Date=format(time(inGEO[[i]]), "%d/%m/%Y %H:%M"), coredata(inGEO[[i]]))
write.csv(df, file = paste("meteo",i,sep="_"), quote = F, sep = ",", row.names = F)
}
smc_files <- dir("../raw/")
setwd("../")
setwd("/media/alpenv/Projekte/MONALISA/05_Arbeitsbereiche/BrJ/01_data/SMC/meteo")
setwd("../raw")
smc_files <- dir()
smc_data <- list()
i <- smc_files[1]
i
header <- readLines(i, n = 1)
header
header <- readLines(i, n = 2)
header <- readLines(con(i), n = 2)
header <- readLines(i)
header <- read.csv(i, nrows=1)
header <- read.csv(i, nrows=2)
i
data <- read.csv(file = i, header = F, skip=2)
header <- read.csv(i, nrows=2)
header <- read.csv(i, nrows=2)
header <- read.csv(i, nrows=1)
View(header)
data <- read.csv(file = i, header = F, skip=2)
names(data) <- header
View(data)
header
header <- read.csv(i, nrows=1, header=F)
header
names(data) <- header
View(data)
colnames(data) <- header
names(data) <- header
str(header)
header <- c(read.csv(i, nrows=1, header=F))
header <- as.vector(read.csv(i, nrows=1, header=F))
View(header)
header <- c(read.csv(i, nrows=1, header=F))
header <- unlist(c(read.csv(i, nrows=1, header=F)))
header <- as.character(read.csv(i, nrows=1, header=F))
header <- read.csv(i, nrows=1, header=F)
devtools::load_all("~/GitHub/DataBaseAlpEnvEURAC")
header <- readLines(i, n = 1)
header <- strsplit(readLines(i, n = 1),",")
header <- strsplit(readLines(i, n = 1),",")[[1]]
header
data <- read.csv(file = i, header = F, skip=2)[,length(header)]
str(data)
data <- read.csv(file = i, header = F, skip=2)
data <- read.csv(file = i, header = F, skip=2)[,1:length(header)]
names(data) <- header
apply(X = data, MARGIN = 2, FUN = function(x) all(is.na(x)) )
data <- data[,apply(X = data, MARGIN = 2, FUN = function(x) all(is.na(x)))]
smc_data <- list()
for (i in smc_files)
{
header <- strsplit(readLines(i, n = 1),",")[[1]]
data <- read.csv(file = i, header = F, skip=2)[,1:length(header)]
names(data) <- header
smc_data[[i]] <- data[,apply(X = data, MARGIN = 2, FUN = function(x) all(is.na(x)))]
}
i
header <- strsplit(readLines(i, n = 1),",")[[1]]
data <- read.csv(file = i, header = F, skip=2)[,1:length(header)]
names(data) <- header
data <- data[,apply(X = data, MARGIN = 2, FUN = function(x) all(is.na(x)))]
str(data)
header <- strsplit(readLines(i, n = 1),",")[[1]]
data <- read.csv(file = i, header = F, skip=2)[,1:length(header)]
names(data) <- header
apply(X = data, MARGIN = 2, FUN = function(x) all(is.na(x)))
data <- data[,!apply(X = data, MARGIN = 2, FUN = function(x) all(is.na(x)))]
str(data)
header <- strsplit(readLines(i, n = 1),",")[[1]]
data <- read.csv(file = i, header = F, skip=2, na.strings = c("NA","NaN"))[,1:length(header)]
names(data) <- header
data <- data[,!apply(X = data, MARGIN = 2, FUN = function(x) all(is.na(x)))]
str(data)
datetime <- Helper4me::help_parseDateTime(x.date = substr(data$TIMESTEP,1,10), x.time = substr(data$TIMESTEP,12,16))
datetime[1]
datetime <- Helper4me::help_parseDateTime(x.date = substr(data$TIMESTEP,1,10), x.time = substr(data$TIMESTEP,12,16), format = list(date="%Y-%m-%d",time="%H:%M")
)
datetime[1]
datetime <- Helper4me::help_parseDateTime(x.date = substr(data$TIMESTEP,1,10), x.time = substr(data$TIMESTEP,12,16),
format = list(date="y-m-d",time="h:m"))
datetime[1]
datetime <- Helper4me::help_parseDateTime(x.date = substr(data$TIMESTEP,1,10), x.time = substr(data$TIMESTEP,12,16),
format = list(date="y-m-d",time="h:m:s"))
substr(data$TIMESTEP,12,16)
substr(as.character(data$TIMESTEP),1,10)
as.character(data$TIMESTEP)
View(data)
substr(as.character(data$TIMESTAMP,12,16))
substr(as.character(data$TIMESTAMP),12,16)
datetime <- Helper4me::help_parseDateTime(x.date = substr(as.character(data$TIMESTAMP),1,10),
x.time = substr(as.character(data$TIMESTAMP),12,16),
format = list(date="y-m-d",time="h:m:s"))
datetime <- Helper4me::help_parseDateTime(x.date = substr(as.character(data$TIMESTAMP),1,10),
x.time = substr(as.character(data$TIMESTAMP),12,16),
format = list(date="y-m-d",time="h:m"))
datetime <- chron(dates = substr(as.character(data$TIMESTAMP),1,10),
times = paste(substr(as.character(data$TIMESTAMP),12,16),":00",sep=""),
out.format = list(date="y-m-d",time="h:m:s"))
datetime <- chron(dates = substr(as.character(data$TIMESTAMP),1,10),
times = paste(substr(as.character(data$TIMESTAMP),12,16),":00",sep=""),
format = list(dates="y-m-d", times="h:m:s"))
datetime <- chron(dates = substr(as.character(data$TIMESTAMP),1,10),
times = paste(substr(as.character(data$TIMESTAMP),12,16),":00",sep=""),
format = list(dates="y-m-d", times="h:m:s"),
out.format = list(date="y-m-d",time="h:m:s"))
datetime[1]
smc_data[[i]] <- zoo(data[,-1], datetime)
plot(smc_data[[i]])
hour <- DataBaseAlpEnvEURAC::dB_trunc.minutes(x = datetime, n.minutes = 60)
data <- zoo(data[,-1], datetime)
data <- aggregate(data, hour)
plot(data)
header <- strsplit(readLines(i, n = 1),",")[[1]]
data <- read.csv(file = i, header = F, skip=2, na.strings = c("NA","NaN"))[,1:length(header)]
names(data) <- header
data <- data[,!apply(X = data, MARGIN = 2, FUN = function(x) all(is.na(x)))]
datetime <- chron(dates = substr(as.character(data$TIMESTAMP),1,10),
times = paste(substr(as.character(data$TIMESTAMP),12,16),":00",sep=""),
format = list(dates="y-m-d", times="h:m:s"),
out.format = list(date="y-m-d",time="h:m:s"))
data <- zoo(data[,-1], datetime)
hour <- DataBaseAlpEnvEURAC::dB_trunc.minutes(x = datetime, n.minutes = 60)
data <- aggregate(data, hour, mean)
plot(data)
load("/run/user/1000/gvfs/smb-share:server=sdcalp01.eurac.edu,share=data2/Simulations/Simulation_GEOtop_1_225_ZH/Vinschgau/SimTraining/BrJ/HiResAlp/1D/B2_P2_Calibration/B2_BeG_017/obs/observation_cal.RData")
str(observation$day)
plot(observation$day)
smc_data <- list()
for (i in smc_files)
{
header <- strsplit(readLines(i, n = 1),",")[[1]]
data <- read.csv(file = i, header = F, skip=2, na.strings = c("NA","NaN"))[,1:length(header)]
names(data) <- header
data <- data[,!apply(X = data, MARGIN = 2, FUN = function(x) all(is.na(x)))]
datetime <- chron(dates = substr(as.character(data$TIMESTAMP),1,10),
times = paste(substr(as.character(data$TIMESTAMP),12,16),":00",sep=""),
format = list(dates="y-m-d", times="h:m:s"),
out.format = list(date="y-m-d",time="h:m:s"))
data <- zoo(data[,-1], datetime)
hour <- DataBaseAlpEnvEURAC::dB_trunc.minutes(x = datetime, n.minutes = 60)
smc_data[[i]] <- aggregate(data, hour, mean)
}
plot(smc_data$domef1500_2015_calibrated.csv)
setwd("/media/alpenv/Projekte/MONALISA/05_Arbeitsbereiche/BrJ/01_data/SMC/meteo")
load("data.RData")
names(station_data)
read.csv("meta_st7848.csv")
read.csv("../meta.csv")
read.csv("../meta.csv")
meta_st <- read.csv("../meta.csv")
library(rgdal)
project(xy = cbind(meta_st$lat, meta_st$long), proj = "+proj=utm +zone=32 ellps=WGS84")
project(xy = cbind(meta_st$long, meta_st$lat), proj = "+proj=utm +zone=32 ellps=WGS84")
setwd("/media/alpenv/GIS/Arbeitsbereich/BrJ/Monalisa/horizon/")
library(horizons)
library(raster)
dem <- raster("/media/alpenv/GIS/Daten/Suedtirol/DEM/dgm_20m_ETRF_1989.tif")
r_dem <- raster("/media/alpenv/GIS/Daten/Suedtirol/DEM/dgm_20m_ETRF_1989.tif")
stations <- read.csv(file = "H:/GIS/Arbeitsbereich/BrJ/Monalisa/Stations/Stations.txt", header=TRUE, sep = ",")
stations <- read.csv(file = "/media/alpenv/GIS/Arbeitsbereich/BrJ/Monalisa/Stations/Stations.txt", header=TRUE, sep = ",")
stations <- read.csv(file = "/media/alpenv/GIS/Arbeitsbereich/BrJ/Monalisa/Stations/Stations.txt", header=TRUE, sep = ",")
hor <- horizon(r = r_dem, points = data.frame(x=stations$x, y=stations$y), names = as.character(stations$name), n=144)
library(horizons)
library(devtools)
install_github("ecor/horizons")
library(horizons)
hor <- horizon(r = r_dem, points = data.frame(x=stations$x, y=stations$y), names = as.character(stations$name), n=144)
for (i in names(hor_mazia))
{
write.csv(x=hor_mazia[[i]], file=paste("horizon_",i,".txt",sep=""), row.names=FALSE, quote=FALSE)
}
for (i in names(hor_mazia))
{
write.csv(x=hor[[i]], file=paste("horizon_",i,".txt",sep=""), row.names=FALSE, quote=FALSE)
}
for (i in names(ho))
for (i in names(hor))
{
write.csv(x=hor[[i]], file=paste("horizon_",i,".txt",sep=""), row.names=FALSE, quote=FALSE)
}
0.2*2.54
Helper4me::help_updateGITlib("DataBaseAlpEnvEURAC")
library(DataBaseAlpEnvEURAC)
swc <- dB_getSWC(station = "DOMEF1")
swc <- dB_getSWC(station = "DOMEF1", path2data = "/media/alpenv/Projekte/MONALISA/05_Arbeitsbereiche/BrJ/01_data/Stations/")
swc <- dB_getSWC(station = "DOMEF1", path2data = "/media/alpenv/Projekte/MONALISA/05_Arbeitsbereiche/BrJ/01_data/Stations/")
str(swc)
Helper4me::help_updateGITlib("DataBaseAlpEnvEURAC")
library(DataBaseAlpEnvEURAC)
swc <- dB_getSWC(station = "DOMEF1", path2data = "/media/alpenv/Projekte/MONALISA/05_Arbeitsbereiche/BrJ/01_data/Stations/")
str(swc)
swc <- dB_getSWC(station = "DOMEF1", path2data = "/media/alpenv/Projekte/MONALISA/05_Arbeitsbereiche/BrJ/01_data/Stations/", aggregation = "h")
plot(swc)
library(DataBaseAlpEnvEURAC)
swc <- dB_getSWC(station = "DOMEF1", path2data = "/media/alpenv/Projekte/MONALISA/05_Arbeitsbereiche/BrJ/01_data/Stations/", aggregation = "h")
soilT <- dB_getSoilTemp(station = "DOMEF1", path2data = "/media/alpenv/Projekte/MONALISA/05_Arbeitsbereiche/BrJ/01_data/Stations/", aggregation = "h")
str(soilT)
plot(soilT)
load("/run/user/1000/gvfs/smb-share:server=sdcalp01.eurac.edu,share=data2/Simulations/Simulation_GEOtop_1_225_ZH/Vinschgau/SimTraining/BrJ/HiResAlp/1D/Montecini_pnt_1_225_B2_006/point.RData")
wpath <- "/run/user/1000/gvfs/smb-share:server=sdcalp01.eurac.edu,share=data2/Simulations/Simulation_GEOtop_1_225_ZH/Vinschgau/SimTraining/BrJ/MonaLisa//1D/DOMEF_1500/sim000/"
# obs data
wpath <- "/run/user/1000/gvfs/smb-share:server=sdcalp01.eurac.edu,share=data2/Simulations/Simulation_GEOtop_1_225_ZH/Vinschgau/SimTraining/BrJ/MonaLisa//1D/DOMEF_1500/sim000/"
# obs data
wpath <- "/run/user/1000/gvfs/smb-share:server=sdcalp01.eurac.edu,share=data2/Simulations/Simulation_GEOtop_1_225_ZH/Vinschgau/SimTraining/BrJ/MonaLisa//1D/DOMEF_1500/sim000/"
load(file.path(wpath, "obs", "observation.RData"))
exists("obs")
if (!exists("obs")) obs <- observation
names(obs) <- c("hour", "day")
library(AnalyseGeotop)
data("lookup_tbl_observation")
View(lookup_tbl_observation)
wpath <- "/run/user/1000/gvfs/smb-share:server=sdcalp01.eurac.edu,share=data2/Simulations/Simulation_GEOtop_1_225_ZH/Vinschgau/SimTraining/BrJ/MonaLisa//1D/DOMEF_1500/sim000/"
# obs data
load(file.path(wpath, "obs", "observation.RData"))
if (!exists("obs")) obs <- observation
names(obs) <- c("hour", "day")
if (file.exists(file.path(wpath,"PointOutValidation.RData"))) {
load(file.path(wpath,"PointOutValidation.RData"))
} else {
var_out <- GEOtop_ReadValidationData(wpath = wpath, obs = obs, save_rData = T)
}
str(obs)
wpath <- "/run/user/1000/gvfs/smb-share:server=sdcalp01.eurac.edu,share=data2/Simulations/Simulation_GEOtop_1_225_ZH/Vinschgau/SimTraining/BrJ/MonaLisa//1D/DOMEF_1500/sim000/"
load(file.path(wpath, "obs", "observation.RData"))
if (!exists("obs")) obs <- observation
names(obs) <- c("hour", "day")
if (file.exists(file.path(wpath,"PointOutValidation.RData"))) {
load(file.path(wpath,"PointOutValidation.RData"))
} else {
var_out <- GEOtop_ReadValidationData(wpath = wpath, obs = obs, save_rData = T)
}
str(obs)
soil_files=TRUE
save_rData=TRUE
data(lookup_tbl_observation)
if (any(names(obs)=="hour") & any(names(obs)=="day")) Donly <- which(! dimnames(obs$day)[2][[1]] %in% dimnames(obs$hour)[2][[1]]) else Donly <- NULL
# get x- , y-coordinates of output points
if (file.exists(file.path(wpath,"listpoints.txt")))
{
listpoints <- read.csv(file.path(wpath,"listpoints.txt"))
xpoints <- listpoints$xcoord
ypoints <- listpoints$ycoord
} else {
xpoints <- get.geotop.inpts.keyword.value("CoordinatePointX",wpath=wpath,numeric=T)
ypoints <- get.geotop.inpts.keyword.value("CoordinatePointY",wpath=wpath,numeric=T)
}
if (!is.null(Donly)) base <- obs$day else base <- obs$hour
df_names <- as.data.frame(dimnames(base)[2][[1]])
names(df_names) <- "name"
varPointIn <- merge(df_names, lookup_tbl_observation, by.x="name", by.y = "obs_var")
varPointIn_what_direct <- varPointIn$geotop_what[varPointIn$geotop_where=="PointOutputFile"]
varPointIn_name_direct <- varPointIn$name[varPointIn$geotop_where=="PointOutputFile"]
level <- 1:length(xpoints)
library(geotopbricks)
# read point data with specified keyword
point_data <- get.geotop.inpts.keyword.value(keyword="PointOutputFile", wpath=wpath,
raster=FALSE,
data.frame=TRUE,
level=level,
date_field="Date12.DDMMYYYYhhmm.",
tz="Etc/GMT+1")
1:length(varPointIn_what_direct)
varPointIn_what_direct
df_names <- as.data.frame(dimnames(base)[2][[1]])
View(df_names)
varPointIn <- merge(df_names, lookup_tbl_observation, by.x="name", by.y = "obs_var")
names(df_names) <- "name"
varPointIn <- merge(df_names, lookup_tbl_observation, by.x="name", by.y = "obs_var")
varPointIn
View(lookup_tbl_observation)
str(varPointIn)
lenght(varPointIn)
length(varPointIn)
dim(varPointIn)
dim(varPointIn)[1]
source('~/GitHub/AnalyseGEOtop/R/GEOtop_readValidationData.R')
#time(obs$hour) <- as.POSIXlt(time(obs$hour))
# sim data
if (file.exists(file.path(wpath,"PointOutValidation.RData"))) {
load(file.path(wpath,"PointOutValidation.RData"))
} else {
var_out <- GEOtop_ReadValidationData(wpath = wpath, obs = obs, save_rData = T)
}
str(var_out)
Helper4me::help_updateGITlib("AnalyseGeotop")
wpath <- "/run/user/1000/gvfs/smb-share:server=sdcalp01.eurac.edu,share=data2/Simulations/Simulation_GEOtop_1_225_ZH/Vinschgau/SimTraining/BrJ/MonaLisa//1D/DOMEF_1500/sim000/"
load(file.path(wpath, "obs", "observation.RData"))
if (!exists("obs")) obs <- observation
names(obs) <- c("hour", "day")
if (file.exists(file.path(wpath,"PointOutValidation.RData"))) {
load(file.path(wpath,"PointOutValidation.RData"))
} else {
var_out <- GEOtop_ReadValidationData(wpath = wpath, obs = obs, save_rData = T)
}
names(obs$hour)
input=c()
input$variable <- "soil_moisture_content_20"
input$add_variable <- NA
input$aggregation <-"day"
input$flux_amount <- flux
input$flux_amount <- "flux"
ng/BrJ/HiResAlp/1D/B2_P2_Dynamic/B2_BrJ_017_DVM_002/"
wpath <- "/run/user/1000/gvfs/smb-share:server=sdcalp01.eurac.edu,share=data2/Simulations/Simulation_GEOtop_1_225_ZH/Vinschgau/SimTraining/BrJ/MonaLisa//1D/DOMEF_1500/sim000/"
# obs data
load(file.path(wpath, "obs", "observation.RData"))
if (!exists("obs")) obs <- observation
names(obs) <- c("hour", "day")
#time(obs$hour) <- as.POSIXlt(time(obs$hour))
# sim data
if (file.exists(file.path(wpath,"PointOutValidation.RData"))) {
load(file.path(wpath,"PointOutValidation.RData"))
} else {
var_out <- GEOtop_ReadValidationData(wpath = wpath, obs = obs, save_rData = T)
}
varout <- var_out
# adjust datetime: observations -1 hour
time(obs$hour) <- as.POSIXlt(time(obs$hour))
time(obs$hour)$mday <- time(obs$hour)$mday - 1
time(obs$day) <- time(obs$day) - 1
# get hourly lag between obs and sim
if ("air_temperature" %in% names(obs$hour)) {
ccf_temp <- stats::ccf(var_out[["air_temperature"]], obs$hour[,"air_temperature"], plot = F, na.action = na.pass)
lag <- round(ccf_temp$acf[which.max(ccf_temp$acf)],0)
time(obs$hour)$hour <- time(obs$hour)$hour + lag
}
# load lookup table
data("lookup_tbl_observation")
library(AnalyseGeotop)
data("lookup_tbl_observation")