options(jupyter.plot_mimetypes = c("text/plain", "image/png" ))
options(repr.plot.width=8, repr.plot.height=4)
suppressPackageStartupMessages(library(dplyr))
suppressPackageStartupMessages(library(zoo))
suppressPackageStartupMessages(library(lubridate))
suppressPackageStartupMessages(library(RCurl))
myfile <- getURL('https://rdm.inesctec.pt/dataset/ab12761a-8169-4622-ba73-c8ddc9eaddb7/resource/813c118c-852e-4e6f-814a-77c4a9da685d/download/efieldinesc201901.txt',ssl.verifyhost=FALSE, ssl.verifypeer=FALSE)
dat=read.table(textConnection(myfile),header=FALSE,sep=" ",stringsAsFactors=FALSE)
# data date/time as POSIXct
dat.times=as.POSIXct(paste(dat$V1,dat$V2),format="%Y-%m-%d %H:%M:%S",tz="UTC")
start.time=dat.times[1]
end.time=dat.times[length(dat.times)]
print(paste("data from", start.time, "to", end.time))
V=dat$V3
# check for continuity of record [0 --> continuous record]; result=number of gaps
# 1-minute measurements --> 60 sec
ngaps=length(which(c(1,round(diff(unclass(dat.times)/60)))!=1))
gaps=which(c(1,round(diff(unclass(dat.times)/60)))!=1)
print(paste("number of gaps in data:", ngaps))
#fill-in gaps by adding missing times as NA values
all.times <- seq.POSIXt(from=start.time, to=end.time, by=60)
df <- data.frame(dat.times=all.times,stringsAsFactors=FALSE)
data2019.01 <- full_join(df,data.frame(dat.times=dat.times, V=V))
[1] "data from 2019-01-01 to 2019-01-31 23:59:00" [1] "number of gaps in data: 0"
Joining, by = "dat.times"
ts.zoo=zoo(data2019.01$V,data2019.01$dat.times)
times <- time(zoo(ts.zoo))
ticks <- seq(times[1], times[length(times)], by = "days")
fmt <- "%d-%m" # format for axis labels
labs <- format(ticks, fmt)
plot(ts.zoo,ylab = "Efield (V/m)",xlab="",col="darkorange", main="January 2019",xaxt="n")
axis(1, at = ticks,labels=labs, tcl = -0.3)
myfile <- getURL('https://rdm.inesctec.pt/dataset/ab12761a-8169-4622-ba73-c8ddc9eaddb7/resource/e2ff9e33-5113-462a-a8a5-e9fb03dacd8a/download/efieldinesc201902.txt',ssl.verifyhost=FALSE, ssl.verifypeer=FALSE)
dat=read.table(textConnection(myfile),header=FALSE,sep=" ",stringsAsFactors=FALSE)
# data date/time as POSIXct
dat.times=as.POSIXct(paste(dat$V1,dat$V2),format="%Y-%m-%d %H:%M:%S",tz="UTC")
start.time=dat.times[1]
end.time=dat.times[length(dat.times)]
print(paste("data from", start.time, "to", end.time))
V=dat$V3
# check for continuity of record [0 --> continuous record]; result=number of gaps
# 1-minute measurements --> 60 sec
ngaps=length(which(c(1,round(diff(unclass(dat.times)/60)))!=1))
gaps=which(c(1,round(diff(unclass(dat.times)/60)))!=1)
print(paste("number of gaps in data:", ngaps))
#fill-in gaps by adding missing times as NA values
all.times <- seq.POSIXt(from=start.time, to=end.time, by=60)
df <- data.frame(dat.times=all.times,stringsAsFactors=FALSE)
data2019.02 <- full_join(df,data.frame(dat.times=dat.times, V=V))
[1] "data from 2019-02-01 to 2019-02-28 23:59:00" [1] "number of gaps in data: 0"
Joining, by = "dat.times"
ts.zoo=zoo(data2019.02$V,data2019.02$dat.times)
times <- time(zoo(ts.zoo))
ticks <- seq(times[1], times[length(times)], by = "days")
fmt <- "%d-%m" # format for axis labels
labs <- format(ticks, fmt)
plot(ts.zoo,ylab = "Efield (V/m)",xlab="",col="darkorange", main="February 2019",xaxt="n")
axis(1, at = ticks,labels=labs, tcl = -0.3)
myfile <- getURL('https://rdm.inesctec.pt/dataset/ab12761a-8169-4622-ba73-c8ddc9eaddb7/resource/ad66ee90-4cc8-438a-b210-bc9256444338/download/efieldinesc201903.txt',ssl.verifyhost=FALSE, ssl.verifypeer=FALSE)
dat=read.table(textConnection(myfile),header=FALSE,sep=" ",stringsAsFactors=FALSE)
# data date/time as POSIXct
dat.times=as.POSIXct(paste(dat$V1,dat$V2),format="%Y-%m-%d %H:%M:%S",tz="UTC")
start.time=dat.times[1]
end.time=dat.times[length(dat.times)]
print(paste("data from", start.time, "to", end.time))
V=dat$V3
# check for continuity of record [0 --> continuous record]; result=number of gaps
# 1-minute measurements --> 60 sec
ngaps=length(which(c(1,round(diff(unclass(dat.times)/60)))!=1))
gaps=which(c(1,round(diff(unclass(dat.times)/60)))!=1)
print(paste("number of gaps in data:", ngaps))
#fill-in gaps by adding missing times as NA values
all.times <- seq.POSIXt(from=start.time, to=end.time, by=60)
df <- data.frame(dat.times=all.times,stringsAsFactors=FALSE)
data2019.03 <- full_join(df,data.frame(dat.times=dat.times, V=V))
[1] "data from 2019-03-01 to 2019-03-31 23:59:00" [1] "number of gaps in data: 0"
Joining, by = "dat.times"
ts.zoo=zoo(data2019.03$V,data2019.03$dat.times)
times <- time(zoo(ts.zoo))
ticks <- seq(times[1], times[length(times)], by = "days")
fmt <- "%d" # format for axis labels
labs <- format(ticks, fmt)
plot(ts.zoo,ylab = "Efield (V/m)",xlab="day",col="darkorange", main="March 2019",xaxt="n")
axis(1, at = ticks,labels=labs, tcl = -0.3)
myfile <- getURL('https://rdm.inesctec.pt/dataset/ab12761a-8169-4622-ba73-c8ddc9eaddb7/resource/eb7445b6-fbbb-42a1-a2b5-1662021c150d/download/efieldinesc201904.txt',ssl.verifyhost=FALSE, ssl.verifypeer=FALSE)
dat=read.table(textConnection(myfile),header=FALSE,sep=" ",stringsAsFactors=FALSE)
# data date/time as POSIXct
dat.times=as.POSIXct(paste(dat$V1,dat$V2),format="%Y-%m-%d %H:%M:%S",tz="UTC")
start.time=dat.times[1]
end.time=dat.times[length(dat.times)]
print(paste("data from", start.time, "to", end.time))
V=dat$V3
# check for continuity of record [0 --> continuous record]; result=number of gaps
# 1-minute measurements --> 60 sec
ngaps=length(which(c(1,round(diff(unclass(dat.times)/60)))!=1))
gaps=which(c(1,round(diff(unclass(dat.times)/60)))!=1)
print(paste("number of gaps in data:", ngaps))
#fill-in gaps by adding missing times as NA values
all.times <- seq.POSIXt(from=start.time, to=end.time, by=60)
df <- data.frame(dat.times=all.times,stringsAsFactors=FALSE)
data2019.04 <- full_join(df,data.frame(dat.times=dat.times, V=V))
[1] "data from 2019-04-01 to 2019-04-30 23:59:00" [1] "number of gaps in data: 0"
Joining, by = "dat.times"
ts.zoo=zoo(data2019.04$V,data2019.04$dat.times)
times <- time(zoo(ts.zoo))
ticks <- seq(times[1], times[length(times)], by = "days")
fmt <- "%d" # format for axis labels
labs <- format(ticks, fmt)
plot(ts.zoo,ylab = "Efield (V/m)",xlab="day",col="darkorange", main="April 2019",xaxt="n")
axis(1, at = ticks,labels=labs, tcl = -0.3)
myfile <- getURL('https://rdm.inesctec.pt/dataset/ab12761a-8169-4622-ba73-c8ddc9eaddb7/resource/58dfe983-5b43-4145-99be-c39ad96b9158/download/efieldinesc201905.txt',ssl.verifyhost=FALSE, ssl.verifypeer=FALSE)
dat=read.table(textConnection(myfile),header=FALSE,sep=" ",stringsAsFactors=FALSE)
# data date/time as POSIXct
dat.times=as.POSIXct(paste(dat$V1,dat$V2),format="%Y-%m-%d %H:%M:%S",tz="UTC")
start.time=dat.times[1]
end.time=dat.times[length(dat.times)]
print(paste("data from", start.time, "to", end.time))
V=dat$V3
# check for continuity of record [0 --> continuous record]; result=number of gaps
# 1-minute measurements --> 60 sec
ngaps=length(which(c(1,round(diff(unclass(dat.times)/60)))!=1))
gaps=which(c(1,round(diff(unclass(dat.times)/60)))!=1)
print(paste("number of gaps in data:", ngaps))
#fill-in gaps by adding missing times as NA values
all.times <- seq.POSIXt(from=start.time, to=end.time, by=60)
df <- data.frame(dat.times=all.times,stringsAsFactors=FALSE)
data2019.05 <- full_join(df,data.frame(dat.times=dat.times, V=V))
[1] "data from 2019-05-01 to 2019-05-19 23:58:00" [1] "number of gaps in data: 0"
Joining, by = "dat.times"
ts.zoo=zoo(data2019.05$V,data2019.05$dat.times)
times <- time(zoo(ts.zoo))
ticks <- seq(times[1], times[length(times)], by = "days")
fmt <- "%d" # format for axis labels
labs <- format(ticks, fmt)
plot(ts.zoo,ylab = "Efield (V/m)",xlab="day",col="darkorange", main="May 2019",xaxt="n")
axis(1, at = ticks,labels=labs, tcl = -0.3)