1- filePath <- " C:/Users/mzamzo/Documents/tmp/pcl/01_data/input/ndtri_openeo/Brates Lake_DS2_20180101-20251201 "
1+ filePath <- " C:/Users/mzamzo/Documents/tmp/pcl/01_data/input/ndtri_openeo/Koerbaer Teich_Example_20180101-20241231 "
22
33# open netcdf connection
44system.time(
@@ -7,7 +7,7 @@ system.time(
77
88# Dynmaic
99DynamicList <- list ()
10- years <- 2018 : 2025
10+ years <- 2018 : 2024
1111for (year in years ){
1212 cat(paste0(" Processing year " , year , " ...\n " ))
1313 imageIndex <- lakeRS :: ndi_per_image(
@@ -22,39 +22,50 @@ for(year in years){
2222 returnSinglePixels = FALSE ,
2323 days_around_ma = 30 )
2424
25- # plot alle years
26- x <- lapply(DynamicList , function (x ){x $ lakeDynamic $ q_0.5 })
27- lakeRS :: plot_dynamic(
28- v_averageList = x ,
29- TSnames = names(x )
30- )
31-
32- d <- lakeRS :: combine_years_dynamic(
33- indexDynamicList = DynamicList ,
34- years = 2018 : 2024
35- )
36-
37- lakeRS :: plot_dynamic(
38- v_averageList = list (d $ mean_of_median ),
39- v_sdList = list (d $ sd_over_median ),
40- TSnames = " Years 2018 - 2024" ,
41- df_reference = data.frame (
42- " doy" = 1 : 365 ,
43- " value" = DynamicList $ y_2025 $ lakeDynamic $ q_0.5 ),
44- RefName = " 2025" ,
45- lakeName = " Lake Brates"
46- )
47-
48-
49-
50-
5125}
5226
27+ # plot alle years
28+ x <- lapply(DynamicList , function (x ){x $ lakeDynamic $ q_0.5 })
29+
30+ lakeRS :: plot_dynamic(
31+ v_averageList = x ,
32+ TSnames = years
33+ )
34+ # without reference year
35+ d <- lakeRS :: combine_years_dynamic(
36+ indexDynamicList = DynamicList ,
37+ years = 2018 : 2024
38+ )
39+ lakeRS :: plot_dynamic(
40+ v_averageList = list (d $ mean_of_median ),
41+ v_sdList = list (d $ sd_over_median ),
42+ TSnames = " Years 2018 - 2024" ,
43+ lakeName = " Körbaer Teich"
44+ )
45+
46+
47+ # with references year
48+ # Exclude reference year from averaging
49+ d <- lakeRS :: combine_years_dynamic(
50+ indexDynamicList = DynamicList ,
51+ years = 2018 : 2023
52+ )
53+ lakeRS :: plot_dynamic(
54+ v_averageList = list (d $ mean_of_median ),
55+ v_sdList = list (d $ sd_over_median ),
56+ TSnames = " Years 2018 - 2023" ,
57+ df_reference = data.frame (
58+ " doy" = 1 : 365 ,
59+ " value" = DynamicList $ y_2024 $ lakeDynamic $ q_0.5 ),
60+ RefName = " 2024" ,
61+ lakeName = " Körbaer Teich"
62+ )
63+
5364# Index per image
5465range(nc $ t_date )
5566
5667lakeIndexList <- list ()
57- years <- 2018 : 2025
68+ years <- 2018 : 2024
5869for (year in years ){
5970 cat(paste0(" Processing year " , year , " ...\n " ))
6071 imageIndex <- lakeRS :: ndi_per_image(
@@ -82,22 +93,29 @@ yearlyLakes <- lakeRS::combine_years_lakeData(lakeIndexList = lakeIndexList)
8293
8394# yearly data set of pixelwise data
8495yearlyPixels <- lakeRS :: combine_years_pixelData(lakeIndexList = lakeIndexList )
96+
8597classData <- lakeRS :: discreteClassAssessment(
8698 yearly_spread = yearlyPixels $ indexTable
8799)
88100
89101
90- {
91- # some plot as above
92- lakeRS :: map_layer(
93- ncLayer = matrix (
94- data = classData $ assessment $ year_2020_class ,
95- nrow = length(nc $ y ), ncol = length(nc $ x )),
96- nc = nc ,
97- lowerLimits = lakeRS :: tenClassColors $ class ,
98- classColors = lakeRS :: tenClassColors $ color ,
99- plotLegend = FALSE )
100- }
102+ lakeRS :: map_layer(
103+ ncLayer = matrix (
104+ data = classData $ assessment $ year_2020_class ,
105+ nrow = length(nc $ y ), ncol = length(nc $ x )),
106+ nc = nc ,
107+ lowerLimits = lakeRS :: tenClassColors $ class ,
108+ classColors = lakeRS :: tenClassColors $ color ,
109+ plotLegend = TRUE )
110+
111+ lakeRS :: plot_layer(
112+ ncLayer = matrix (
113+ data = classData $ assessment $ year_2020_class ,
114+ nrow = length(nc $ y ), ncol = length(nc $ x )),
115+ nc = nc ,
116+ lowerLimits = lakeRS :: tenClassColors $ class ,
117+ classColors = lakeRS :: tenClassColors $ color )
118+
101119
102120numericData <- lakeRS :: numericAssessment(
103121 yearly_spread = yearlyPixels $ indexTable ,
@@ -111,62 +129,15 @@ lakeRS::plot_numeric_assessment(
111129 numericData = numericData ,
112130 rowNumber = fromBadToGood [1 ]
113131)
132+
114133lakeRS :: show_pixels(
115- x = numericData $ assessment $ x [fromBadToGood [1 ]],
116- y = numericData $ assessment $ y [fromBadToGood [1 ]],
117- crs = nc $ crs )
134+ x = numericData $ assessment $ x [fromBadToGood [1 : 10 ]],
135+ y = numericData $ assessment $ y [fromBadToGood [1 : 10 ]],
136+ crs = nc $ crs , labels = 1 : 10 )
118137
119138numericData [rowNumber ,]
120- hist(numericData $ trend_short )
139+ hist(numericData $ assessment $ trend_short )
121140median(numericData $ trend_short , na.rm = TRUE )
122141
123- xScene <- lakeRS :: nc_scene_per_image(
124- nc = nc ,
125- scene = " water"
126- )
127-
128- cMax <- max(xScene $ coverage )
129- dev.new(noRStudioGD = TRUE , width = 13.4 , height = 5.1 )
130- lakeRS :: plot_scene_coverage(
131- vDate = xScene $ date ,
132- vCoverage = xScene $ coverage ,
133- upperLimits = round(
134- c(0.05 * cMax , 0.2 * cMax , 0.5 * cMax , 0.8 * cMax , 0.9 * cMax , cMax ), 3 )
135- )
136-
137- # Scene analysis per pixel
138- nc <- lakeRS :: nc
139-
140- ncf <- lakeRS :: nc_time_filter(
141- nc = nc ,
142- tBeg = " 2020-04-01" ,
143- tEnd = " 2020-12-31"
144- )
145-
146- scl_image <- lapply(
147- seq_along(ncf $ t_date ),
148- lakeRS :: load_bandLayer ,
149- nc = ncf ,
150- bandName = " SCL"
151- )
152- scl_image <- lapply(scl_image , function (x ){
153- x [is.na(x )] <- 0
154- x
155- })
156- sceneProportion <- lakeRS :: waterscene_proportion(
157- scl_image = scl_image
158- )
159-
160- # --> Map Layer muss gemacht werden
161- lakeRS :: map_layer(
162- ncLayer = sceneProportion $ water ,
163- nc = ncf ,
164- lowerLimits = c(0 ,0.1 , 0.3 , 0.5 , 0.7 , 0.8 , 0.9 ),
165- classColors = c(" white" ," gray80" , " gray60" , " chartreuse1" ," chartreuse4" ,
166- " dodgerblue" , " dodgerblue4" ),
167- legendTitle = " Water Classification Quality"
168- )
169142
170- years <- as.numeric(unique(format(x = nc $ t_date , " %Y" )))
171- matrixDim <- c(length(nc $ y ), length(nc $ x ))
172143
0 commit comments