
R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble"
Copyright (C) 2025 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> ###################################################################
> # SELECT TIME PERIOD
> # seconds for  2 days
> daystep <- 60*60*24
> step <- daystep*2
> t2 <- Sys.time()
> t1 <- t2 - step
> runningdate <- seq.Date( from=as.Date(t1), to=as.Date(t2), by="day")
> 
> #IDS <- c("2CF7F1C0532000AA","2CF7F1C0532000BD","2CF7F1C0532000AE","2CF7F1C053200110")
> 
> IDS <- c(
+ "2CF7F1C0532000E6",
+ "2CF7F1C0532000AE"
+ )
> 
> 
> LAB <- c(
+ "0E6 ASA Gehäuse Helena",
+ "0AE PLA Gehäuse Helena"
+ )
> 
> 
> COL <- c("cornflowerblue","darkblue")
> 
> 
> ###################################################################
> 
> data <- data.frame(matrix(ncol = 5, nrow = 0))
> 
> # GET FILES FOR SELECTED DAYS
> init <- 1
> for (j in seq_along(IDS)) {
+   ID <- IDS[j]
+ 
+   mondir1 <- substr(runningdate[1], 1, 7)
+   mondir2 <- substr(runningdate[length(runningdate)], 1, 7)
+   filename1 <- paste(ID,"_",mondir1,".csv",sep="")
+   filename2 <- paste(ID,"_",mondir2,".csv",sep="")
+ 
+     URL=paste("https://saqn.geo.uni-augsburg.de/lorawan/",mondir1,"/",filename1,sep="")
+     message("filename =",URL)
+ 
+    tryCatch(
+     {
+      data1 <- read.table(URL,header=T,sep=",", fill=T)
+      colnames(data1) <- c("date","lon","lat","temp","rhum","batt")
+      data1$id <- ID
+      data <- rbind(data,data1)
+     },
+     error = function(cond) {
+      message(conditionMessage(cond))
+     },
+     warning = function(cond) {
+      message(conditionMessage(cond))
+    },
+     finally = {
+      message("done!")
+     }
+    )
+ 
+    if( mondir1 != mondir2 ){
+ 
+    tryCatch(
+     {
+      # data2 <- read.table(URL,header=F,sep=",", col.names=c("date","temp","rhum","batt"), fill=T, header=T)
+      URL=paste("https://saqn.geo.uni-augsburg.de/lorawan/",mondir2,"/",filename2,sep="")
+      message("filename =",URL)
+      data2 <- read.table(URL,header=T,sep=",", fill=T)
+      colnames(data2) <- c("date","lon","lat","temp","rhum","batt")
+      data2$id <- ID
+      data <- rbind(data,data2)
+     },
+     error = function(cond) {
+      message(conditionMessage(cond))
+     },
+     warning = function(cond) {
+      message(conditionMessage(cond))
+    },
+     finally = {
+      message("done!")
+     }
+    )
+ 
+   }
+ }
filename =https://saqn.geo.uni-augsburg.de/lorawan/2026-08/2CF7F1C0532000E6_2026-08.csv
done!
filename =https://saqn.geo.uni-augsburg.de/lorawan/2026-08/2CF7F1C0532000AE_2026-08.csv
done!
> 
> data[data < -9998] <- NA
> #data$time <- as.POSIXct(data$date)
> data$time <- as.POSIXct(data$date,format="%Y-%m-%dT%H:%M:%OSZ")
> 
> #---------------------------------------------------------
> png("sensecap_temp_igua_rad_shields_2.png",width=1600, height=600, units="px", res=300, pointsize=3)
> tempmin <- min(data$temp[data$time >= t1],na.rm = TRUE) - 1
> tempmax <- max(data$temp[data$time >= t1],na.rm = TRUE) + 1
> plot(data$time,data$temp,xlab=paste("time UTC"),ylab="air temperature (°C)",
+ xlim=c(as.POSIXct(t1),as.POSIXct(t2)),ylim=c(tempmin,tempmax),type="n",xaxs="i",yaxs="i",xaxt="n",
+ main=paste("Air Temperature (S2101) ",t1," - ",t2," UTC" ))
> Axis(x=data$temp,side=4)
> ihours <- round( seq( as.POSIXct(t1), as.POSIXct(t2),by=3600) , units="hours")
> axis.POSIXct(1, x=data$time, at = ihours, format = "%a %m-%d %H:%M")
> abline(v= as.POSIXct(ihours) ,lwd=0.2,col="gray")
> abline(h=seq(-40,tempmax,by=1),lwd=0.2,col="gray")
> abline(h=seq(-40,tempmax,by=5),lwd=0.2,col="black")
> abline(h=0.0,lwd=0.5,col="black")
> 
> for (i in seq_along(IDS)) {
+ ID <- IDS[i]
+ COLOR <- COL[i]
+ message(ID,COLOR)
+ lines(data$time[data$id == ID],data$temp[data$id == ID],col=COLOR,t="l",lwd=0.5)
+ }
2CF7F1C0532000E6cornflowerblue
2CF7F1C0532000AEdarkblue
> 
> legend("topleft",LAB, col=COL[1:length(LAB)],lty=1,lwd=0.5)
> dev.off()
null device 
          1 
> 
> #---------------------------------------------------------
> png("sensecap_rhum_igua_rad_shields_2.png",width=1600, height=600, units="px", res=300, pointsize=3)
> rhummin <- min(data$rhum,na.rm = TRUE) - 2
> rhummax <- max(data$rhum,na.rm = TRUE) + 2
> plot(data$time,data$rhum,xlab=paste("time UTC"),ylab="relative humidity (%)",
+ xlim=c(as.POSIXct(t1),as.POSIXct(t2)),ylim=c(rhummin,rhummax),type="n",xaxs="i",yaxs="i",xaxt="n",
+ main=paste("Relative Humidity (S2101) ",t1," - ",t2," UTC" ))
> Axis(x=data$rhum,side=4)
> ihours <- round( seq( as.POSIXct(t1), as.POSIXct(t2),by=3600) , units="hours")
> axis.POSIXct(1, x=data$time, at = ihours, format = "%a %m-%d %H:%M")
> abline(v= as.POSIXct(ihours) ,lwd=0.2,col="gray")
> abline(h=seq(0,rhummax,by=20),lwd=0.2,col="gray")
> abline(h=seq(0,100,by=10),lwd=0.2,col="black")
> 
> for (i in seq_along(IDS)) {
+ ID <- IDS[i]
+ COLOR <- COL[i]
+ message(ID,COLOR)
+ lines(data$time[data$id == ID],data$rhum[data$id == ID],col=COLOR,t="l",lwd=0.5)
+ }
2CF7F1C0532000E6cornflowerblue
2CF7F1C0532000AEdarkblue
> 
> legend("topleft",LAB, col=COL[1:length(LAB)],lty=1,lwd=0.5)
> dev.off()
null device 
          1 
> 
> 
> 
> proc.time()
   user  system elapsed 
  1.129   2.787   0.664 
