
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(
+ "2CF7F1C0533002C6",
+ "2CF7F1C0533002C7",
+ "2CF7F1C0533002D0",
+ "2CF7F1C053300300",
+ "2CF7F1C053300308",
+ "2CF7F1C05330032E"
+ )
> 
> 
> LAB <- c(
+ "2C6 hut",
+ "2C7 hut",
+ "2D0 hut",
+ "300 outside & radiation shield 1",
+ "308 outside & radiation shield 2",
+ "32E outside & no shield"
+ )
> 
> 
> COL <- c("cornflowerblue","darkblue","cadetblue","mediumorchid1",
+          "orange","red2","firebrick4","tomato3",
+          "forestgreen","black","tan4","indianred1","darkolivegreen4",
+          "magenta","tan3","lightsalmon","yellowgreen","chartreuse","wheat4","darkgrey",
+          "tan1","seagreen","mediumvioletred","tan2")
> 
> 
> ###################################################################
> 
> 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","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","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-01/2CF7F1C0533002C6_2026-01.csv
done!
filename =https://saqn.geo.uni-augsburg.de/lorawan/2026-01/2CF7F1C0533002C7_2026-01.csv
done!
filename =https://saqn.geo.uni-augsburg.de/lorawan/2026-01/2CF7F1C0533002D0_2026-01.csv
done!
filename =https://saqn.geo.uni-augsburg.de/lorawan/2026-01/2CF7F1C053300300_2026-01.csv
done!
filename =https://saqn.geo.uni-augsburg.de/lorawan/2026-01/2CF7F1C053300308_2026-01.csv
done!
filename =https://saqn.geo.uni-augsburg.de/lorawan/2026-01/2CF7F1C05330032E_2026-01.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.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)
+ }
2CF7F1C0533002C6cornflowerblue
2CF7F1C0533002C7darkblue
2CF7F1C0533002D0cadetblue
2CF7F1C053300300mediumorchid1
2CF7F1C053300308orange
2CF7F1C05330032Ered2
> 
> legend("topleft",LAB, col=COL[1:length(LAB)],lty=1,lwd=0.5)
> dev.off()
null device 
          1 
> 
> #---------------------------------------------------------
> png("sensecap_rhum_igua.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)
+ }
2CF7F1C0533002C6cornflowerblue
2CF7F1C0533002C7darkblue
2CF7F1C0533002D0cadetblue
2CF7F1C053300300mediumorchid1
2CF7F1C053300308orange
2CF7F1C05330032Ered2
> 
> legend("topleft",LAB, col=COL[1:length(LAB)],lty=1,lwd=0.5)
> dev.off()
null device 
          1 
> 
> 
> 
> proc.time()
   user  system elapsed 
  1.207   2.146   0.864 
