Radon concentration from INESC TEC station (Porto) - 2020

In [4]:
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))
In [5]:
myfile <- getURL('https://rdm.inesctec.pt/dataset/8e80ec16-8124-4305-9d75-d0816ddc15b2/resource/efdeb2a4-1277-42f3-8b89-be6f57875aab/download/radoninesc202001.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))

Rn=dat$V3

# check for continuity of record [0 --> continuous record]; result=number of gaps
# 6h measurements --> 21600 sec
ngaps=length(which(c(1,round(diff(unclass(dat.times)/21600)))!=1))
gaps=which(c(1,round(diff(unclass(dat.times)/21600)))!=1)

#fill-in gaps by adding missing times as NA values 
all.times <- seq.POSIXt(from=start.time, to=end.time, by=21600)
df <- data.frame(dat.times=all.times,stringsAsFactors=FALSE)
data2020.01 <- full_join(df,data.frame(dat.times=dat.times, Rn=Rn))
[1] "data from 2020-01-01 to 2020-01-31 18:00:00"
Joining, by = "dat.times"

In [6]:
ts.zoo=zoo(data2020.01$Rn,data2020.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 = "Rn (Bq/m3)",xlab="day",col="darkmagenta", main="January 2020",xaxt="n",type="b",pch=20)
axis(1, at = ticks,labels=labs, tcl = -0.3)
In [7]:
myfile <- getURL('https://rdm.inesctec.pt/dataset/8e80ec16-8124-4305-9d75-d0816ddc15b2/resource/ce5b12fc-a3ab-4206-9bef-58031859ad48/download/radoninesc202002.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))

Rn=dat$V3

# check for continuity of record [0 --> continuous record]; result=number of gaps
# 6h measurements --> 21600 sec
ngaps=length(which(c(1,round(diff(unclass(dat.times)/21600)))!=1))
gaps=which(c(1,round(diff(unclass(dat.times)/21600)))!=1)

#fill-in gaps by adding missing times as NA values 
all.times <- seq.POSIXt(from=start.time, to=end.time, by=21600)
df <- data.frame(dat.times=all.times,stringsAsFactors=FALSE)
data2020.02 <- full_join(df,data.frame(dat.times=dat.times, Rn=Rn))
[1] "data from 2020-02-01 to 2020-02-29 18:00:00"
Joining, by = "dat.times"

In [8]:
ts.zoo=zoo(data2020.02$Rn,data2020.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 = "Rn (Bq/m3)",xlab="day",col="darkmagenta", main="February 2020",xaxt="n",type="b",pch=20)
axis(1, at = ticks,labels=labs, tcl = -0.3)