diff --git a/rainlink.nb.html b/rainlink.nb.html deleted file mode 100644 index 361aa8c..0000000 --- a/rainlink.nb.html +++ /dev/null @@ -1,2160 +0,0 @@ - - - - -
- - - - - - - - -The RAINLINK package. Retrieval algorithm for rainfall mapping from microwave links in a cellular communication network.
-Version 1.14 Copyright (C) 2019 Aart Overeem
-This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
-This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
-Note that it is not necessarily a problem if a function argument is not supplied to the function. If the function argument is not used, then there is no problem. Only be aware that you should use e.g. MaxFrequency=MaxFrequency. I.e. if you only supply MaxFrequency and the function argument before MaxFrequency is missing, than the function will not execute properly.
-This also loads the RAINLINK package.
- - -If the time zone of the employed microwave link dataset is not the same as the (local) time zone used by R on your computer, set the time zone of the microwave link dataset: (this is important for functions RefLevelMinMaxRSL, WetDryNearbyLinkApMinMaxRSL and Interpolation):
- - - -Sys.setenv(TZ='UTC')
-
-
-
-Otherwise RAINLINK can derive a wrong time interval length due to going to or from daylight saving time (DST). Timing of DST may be different between time zones, or one time zone may not have a change to/from DST.
-# Load data:
-load("data/Linkdata_vodafone2016.RData")
-# summary(Linkdata)
-# Add column with polarization if this column is not supplied in the link data:
-if ("Polarization" %in% names(Linkdata)==FALSE)
-{
- Linkdata$Polarization <- rep(NA,nrow(Linkdata))
-}
-
-
-
-When no information on polarization is provided, the above code creates a column of NA for Polarization. In the function “RainRetrievalMinMaxRSL.R” links with NA values for polarization are processed with a & b values determined for vertically polarized signals. If information on polarization of links is available, use H for horizontally polarized & V for vertically polarized in “Linkdata Polarization”. H, V & NA may occur in the same Linkdata file.
- - - -# Run R function:
-StartTime <- proc.time()
-DataPreprocessed <- PreprocessingMinMaxRSL(Data=Linkdata,
- MaxFrequency=MaxFrequency,
- MinFrequency=MinFrequency,
- verbose=TRUE)
-cat(sprintf("Finished. (%.1f seconds)\n",round((proc.time()-StartTime)[3],digits=1))) # ~ 360 s
-
-
-Finished. (319.6 seconds)
-
-
-summary(DataPreprocessed)
-
-
- Frequency DateTime Pmin Pmax PathLength
- Min. : 6.00 201606290945: 641 Min. :-108.00 Min. :-100.00 Min. : 0.1618
- 1st Qu.:17.75 201606291015: 641 1st Qu.: -49.00 1st Qu.: -48.00 1st Qu.: 1.9777
- Median :19.53 201606291030: 641 Median : -44.00 Median : -44.00 Median : 4.0783
- Mean :23.38 201606291100: 641 Mean : -44.95 Mean : -43.98 Mean : 5.4344
- 3rd Qu.:23.05 201606291115: 641 3rd Qu.: -40.00 3rd Qu.: -39.00 3rd Qu.: 7.1872
- Max. :42.59 201606291130: 641 Max. : -21.00 Max. : -16.00 Max. :29.7374
- (Other) :5481725
- XStart YStart XEnd YEnd Label
- Min. : 9.617 Min. :44.09 Min. : 9.617 Min. :44.09 2-Q6885/2-Q6886: 24684
- 1st Qu.:10.328 1st Qu.:44.37 1st Qu.:10.328 1st Qu.:44.37 2-Q7825/2-Q7826: 24680
- Median :11.147 Median :44.51 Median :11.147 Median :44.51 2-P9739/2-P9740: 24670
- Mean :10.915 Mean :44.52 Mean :10.915 Mean :44.52 2-Q7935/2-Q7936: 24660
- 3rd Qu.:11.347 3rd Qu.:44.69 3rd Qu.:11.347 3rd Qu.:44.69 2-Q2081/2-Q2082: 24654
- Max. :11.753 Max. :45.01 Max. :11.753 Max. :45.01 2-Q3655/2-Q3656: 24648
- (Other) :5337575
- Polarization ATPCflag ATPCvalue Direction ID
- H :1234217 Mode :logical Min. :-11 forward:2728159 Min. : 2.0
- V :4032743 FALSE:1055009 1st Qu.: -4 back :2757412 1st Qu.:161.0
- NA's: 218611 TRUE :4430562 Median : -2 Median :359.0
- Mean : -3 Mean :344.5
- 3rd Qu.: -2 3rd Qu.:517.0
- Max. : -1 Max. :713.0
- NA's :5349675
-
-
-
-# Run R function:
-StartTime <- proc.time()
-WetDry <- WetDryNearbyLinkApMinMaxRSL(Data=DataPreprocessed,
- CoorSystemInputData=NULL,
- MinHoursPmin=MinHoursPmin,
- PeriodHoursPmin=PeriodHoursPmin,
- Radius=Radius,
- Step8=Step8,
- ThresholdMedian=ThresholdMedian,
- ThresholdMedianL=ThresholdMedianL,
- ThresholdNumberLinks=ThresholdNumberLinks,
- ThresholdWetDry=ThresholdWetDry)
-cat(sprintf("Finished. (%.1f seconds)\n",round((proc.time()-StartTime)[3],digits=1))) # ~ 3100 s
-
-
-Finished. (4087.7 seconds)
-
-
-summary(WetDry)
-
-
- Dry F
- Min. :0.00 Min. :-2511.369
- 1st Qu.:1.00 1st Qu.: -5.669
- Median :1.00 Median : -0.768
- Mean :0.96 Mean : -6.304
- 3rd Qu.:1.00 3rd Qu.: 1.092
- Max. :1.00 Max. : 49.223
- NA's :223621 NA's :5512
-
-
-
-# Run R function:
-StartTime <- proc.time()
-Pref <- RefLevelMinMaxRSL(Data=DataPreprocessed,
- Dry=WetDry$Dry,
- HoursRefLevel=HoursRefLevel,
- PeriodHoursRefLevel=PeriodHoursRefLevel)
-cat(sprintf("Finished. (%.1f seconds)\n",round((proc.time()-StartTime)[3],digits=1))) # ~ 5610 s
-
-
-Finished. (7180.0 seconds)
-
-
-summary(Pref)
-
-
- Min. 1st Qu. Median Mean 3rd Qu. Max. NA's
--102.50 -48.00 -44.00 -44.17 -39.50 -21.00 229560
-
-
-
-# Run R function:
-DataOutlierFiltered <- OutlierFilterMinMaxRSL(Data=DataPreprocessed,
- F=WetDry$F,
- FilterThreshold=FilterThreshold)
-summary(DataOutlierFiltered)
-
-
- Frequency DateTime Pmin Pmax PathLength
- Min. : 6.00 201606290945: 641 Min. :-108.00 Min. :-100.00 Min. : 0.1618
- 1st Qu.:17.75 201606291015: 641 1st Qu.: -49.00 1st Qu.: -48.00 1st Qu.: 1.9777
- Median :19.53 201606291030: 641 Median : -44.00 Median : -44.00 Median : 4.0783
- Mean :23.38 201606291100: 641 Mean : -44.92 Mean : -43.98 Mean : 5.4344
- 3rd Qu.:23.05 201606291115: 641 3rd Qu.: -40.00 3rd Qu.: -39.00 3rd Qu.: 7.1872
- Max. :42.59 201606291130: 641 Max. : -21.00 Max. : -16.00 Max. :29.7374
- (Other) :5481725 NA's :259220
- XStart YStart XEnd YEnd Label
- Min. : 9.617 Min. :44.09 Min. : 9.617 Min. :44.09 2-Q6885/2-Q6886: 24684
- 1st Qu.:10.328 1st Qu.:44.37 1st Qu.:10.328 1st Qu.:44.37 2-Q7825/2-Q7826: 24680
- Median :11.147 Median :44.51 Median :11.147 Median :44.51 2-P9739/2-P9740: 24670
- Mean :10.915 Mean :44.52 Mean :10.915 Mean :44.52 2-Q7935/2-Q7936: 24660
- 3rd Qu.:11.347 3rd Qu.:44.69 3rd Qu.:11.347 3rd Qu.:44.69 2-Q2081/2-Q2082: 24654
- Max. :11.753 Max. :45.01 Max. :11.753 Max. :45.01 2-Q3655/2-Q3656: 24648
- (Other) :5337575
- Polarization ATPCflag ATPCvalue Direction ID
- H :1234217 Mode :logical Min. :-11 forward:2728159 Min. : 2.0
- V :4032743 FALSE:1055009 1st Qu.: -4 back :2757412 1st Qu.:161.0
- NA's: 218611 TRUE :4430562 Median : -2 Median :359.0
- Mean : -3 Mean :344.5
- 3rd Qu.: -2 3rd Qu.:517.0
- Max. : -1 Max. :713.0
- NA's :5349675
-
-
-
-# Run R function:
-Pcor <- CorrectMinMaxRSL(Data=DataOutlierFiltered,
- Dry=WetDry$Dry,
- Pref=Pref)
-summary(Pcor)
-
-
- PminCor PmaxCor
- Min. :-106.0 Min. :-102.5
- 1st Qu.: -48.0 1st Qu.: -48.0
- Median : -44.0 Median : -44.0
- Mean : -44.3 Mean : -44.2
- 3rd Qu.: -40.0 3rd Qu.: -39.5
- Max. : -21.0 Max. : -21.0
- NA's :478700 NA's :478700
-
-
-
-kRPowerLawDataH <- read.table(FileRainRetrHorizontal)
-colnames(kRPowerLawDataH) <- c("f", "a", "b")
-kRPowerLawDataV <- read.table(FileRainRetrVertical)
-colnames(kRPowerLawDataV) <- c("f", "a", "b")
-# Run R function:
-StartTime <- proc.time()
-Rmean <- RainRetrievalMinMaxRSL(Aa=Aa,
- alpha=alpha,
- Data=DataOutlierFiltered,
- kRPowerLawDataH=kRPowerLawDataH,
- kRPowerLawDataV=kRPowerLawDataV,
- PmaxCor=Pcor$PmaxCor,
- PminCor=Pcor$PminCor,
- Pref=Pref)
-cat(sprintf("Finished. (%.1f seconds)\n",round((proc.time()-StartTime)[3],digits=1))) # ~ 20 s
-
-
-Finished. (23.3 seconds)
-
-
-summary(Rmean)
-
-
- Min. 1st Qu. Median Mean 3rd Qu. Max. NA's
- 0.0 0.0 0.0 0.1 0.0 208.3 478700
-
-
-hist(log(Rmean))
-
-
-
-
-
-
-ID <- unique(DataPreprocessed$ID)
-t <- sort(unique(DataPreprocessed$DateTime))
-t_sec <- as.numeric(as.POSIXct(as.character(t), format = "%Y%m%d%H%M"))
-dt <- min(diff(t_sec))
-save(list=ls(), file = "Cmldata_ER2016.RData")
-## merge in a single dataset for analyses
-CmlRainfall <- DataPreprocessed
-CmlRainfall$Pref <- Pref
-CmlRainfall$PminCor <- Pcor$PminCor
-CmlRainfall$PmaxCor <- Pcor$PmaxCor
-CmlRainfall$DryClass <- WetDry$Dry
-CmlRainfall$RainfallMeanInt <- Rmean
-CmlRainfall$RainfallDepthPath <- Rmean * dt / 3600
-save(CmlRainfall, file = "CmlRainfall_ER2016.RData")
-save(CmlRainfall, file = "CmlRainfall_ER2016v2.RData", version = 2)
-# write.csv(x = CmlRainfall, file = "CmlRainfall_ER2016.csv")
-
-
-
-
-
-
-r
r ## slow write-to-file, use tidyverse::write_delim() instead ToFile = F if (ToFile) {
-# Location of output link data: FolderRainEstimates <- paste(,TIMESTEP,,sep=\)
# Create directory for output files: if(!dir.exists(FolderRainEstimates)){ dir.create(FolderRainEstimates) }
-# Write output to file
-for (i in 1 : length(t)) { ind <- which(DataPreprocessed\(DateTime == t[i]) int_data <- data.frame(ID = DataPreprocessed\)ID[ind], RainfallDepthPath = Rmean[ind] * dt / 3600, PathLength = DataPreprocessed\(PathLength[ind], XStart = DataPreprocessed\)XStart[ind], YStart = DataPreprocessed\(YStart[ind], XEnd = DataPreprocessed\)XEnd[ind], YEnd = DataPreprocessed\(YEnd[ind], IntervalNumber = rep(i, length(ind)), Frequency = DataPreprocessed\)Frequency[ind])
-Filename <- paste(FolderRainEstimates, \/linkdata_\, t[i], \.dat\, sep=\\)
-write.table(int_data, Filename, row.names = FALSE, col.names = TRUE, append = FALSE, quote = FALSE)
-} }
-
-
-
-
-Note that the output files contain rainfall depths (mm). If these data are to be used for the interpolation, they must first be read (“Interpolation.R” does not read these files). Using the data for “Interpolation.R” requires a conversion from rainfall depth (mm) to rainfall intensity (mm/h).
-Interpolation will be performed for hourly accumulated rainfall, so cumulative sums have to be performed
- - - -summary(CmlHourlyData)
-
-
-
- DateTime Frequency PathLength XStart YStart
- 201606291200: 641 Min. : 6.00 Min. : 0.1618 Min. : 9.617 Min. :44.09
- 201606292100: 640 1st Qu.:17.75 1st Qu.: 1.9777 1st Qu.:10.328 1st Qu.:44.37
- 201606300000: 640 Median :19.42 Median : 4.0783 Median :11.147 Median :44.51
- 201606300100: 640 Mean :23.37 Mean : 5.4384 Mean :10.915 Mean :44.52
- 201606271700: 639 3rd Qu.:23.05 3rd Qu.: 7.1872 3rd Qu.:11.347 3rd Qu.:44.69
- 201606271800: 639 Max. :42.59 Max. :29.7374 Max. :11.753 Max. :45.01
- (Other) :1354216
- XEnd YEnd Label Polarization Direction
- Min. : 9.617 Min. :44.09 2-Q6885/2-Q6886: 6109 H :305594 forward:675791
- 1st Qu.:10.328 1st Qu.:44.37 2-Q7825/2-Q7826: 6105 V :998048 back :682264
- Median :11.147 Median :44.51 2-P9739/2-P9740: 6103 NA's: 54413
- Mean :10.915 Mean :44.52 2-Q2081/2-Q2082: 6097
- 3rd Qu.:11.347 3rd Qu.:44.69 2-Q6581/2-Q6582: 6095
- Max. :11.753 Max. :45.01 2-Q7935/2-Q7936: 6093
- (Other) :1321453
- ID HourlyRainfallDepth
- Min. : 2.0 Min. : 0.00
- 1st Qu.:161.0 1st Qu.: 0.00
- Median :359.0 Median : 0.00
- Mean :344.5 Mean : 0.08
- 3rd Qu.:517.0 3rd Qu.: 0.00
- Max. :713.0 Max. :109.30
- NA's :119922
-
-
-
-Interpolation over the grid
- - -Rasters
- - - - - - - - -