|
30 | 30 | # select the file to be plotted
|
31 | 31 | bw_file <- .tile_path(tile, band, date)
|
32 | 32 | # size of data to be read
|
33 |
| - max_size <- .conf("view_max_size") |
| 33 | + max_size <- .conf("view", "max_size") |
34 | 34 | sizes <- .tile_overview_size(tile = tile, max_size)
|
35 | 35 | # scale and offset
|
36 | 36 | band_conf <- .tile_band_conf(tile, band)
|
|
46 | 46 | # extract the values
|
47 | 47 | vals <- terra::values(rast)
|
48 | 48 | # obtain the quantiles
|
| 49 | + fst_quant <- .as.numeric(.conf("plot", "first_quantile")) |
| 50 | + lst_quant <- .as.numeric(.conf("plot", "last_quantile")) |
49 | 51 | quantiles <- stats::quantile(
|
50 | 52 | vals,
|
51 |
| - probs = c(0, 0.02, 0.98, 1), |
| 53 | + probs = c(0, fst_quant, lst_quant, 1), |
52 | 54 | na.rm = TRUE
|
53 | 55 | )
|
54 | 56 | minv <- quantiles[[1]]
|
|
70 | 72 | }
|
71 | 73 |
|
72 | 74 | # tmap params
|
73 |
| - labels_size <- as.numeric(.conf("tmap", "graticules_labels_size")) |
74 |
| - legend_bg_color <- .conf("tmap", "legend_bg_color") |
75 |
| - legend_bg_alpha <- as.numeric(.conf("tmap", "legend_bg_alpha")) |
76 |
| - legend_title_size <- as.numeric(.conf("tmap", "legend_title_size")) |
77 |
| - legend_text_size <- as.numeric(.conf("tmap", "legend_text_size")) |
| 75 | + labels_size <- as.numeric(.conf("plot", "graticules_labels_size")) |
| 76 | + legend_bg_color <- .conf("plot", "legend_bg_color") |
| 77 | + legend_bg_alpha <- as.numeric(.conf("plot", "legend_bg_alpha")) |
| 78 | + legend_title_size <- as.numeric(.conf("plot", "legend_title_size")) |
| 79 | + legend_text_size <- as.numeric(.conf("plot", "legend_text_size")) |
78 | 80 |
|
79 | 81 | # generate plot
|
80 | 82 | p <- tmap::tm_shape(rast, raster.downsample = FALSE) +
|
|
135 | 137 | green_file <- .tile_path(tile, band, dates[[2]])
|
136 | 138 | blue_file <- .tile_path(tile, band, dates[[3]])
|
137 | 139 | # size of data to be read
|
138 |
| - max_size <- .conf("plot_max_size") |
| 140 | + max_size <- .conf("plot", "max_size") |
139 | 141 | sizes <- .tile_overview_size(tile = tile, max_size)
|
140 | 142 | # get the max values
|
141 | 143 | band_params <- .tile_band_conf(tile, band)
|
|
197 | 199 | band_params <- .tile_band_conf(tile, red)
|
198 | 200 | max_value <- .max_value(band_params)
|
199 | 201 | # size of data to be read
|
200 |
| - max_size <- .conf("plot_max_size") |
| 202 | + max_size <- .conf("plot", "max_size") |
201 | 203 | sizes <- .tile_overview_size(tile = tile, max_size)
|
202 | 204 | # used for SAR images
|
203 | 205 | if (tile[["tile"]] == "NoTilingSystem") {
|
|
257 | 259 | ),
|
258 | 260 | proxy = FALSE
|
259 | 261 | )
|
| 262 | + fst_quant <- .as.numeric(.conf("plot", "first_quantile")) |
| 263 | + lst_quant <- .as.numeric(.conf("plot", "last_quantile")) |
260 | 264 | # open RGB stars
|
261 | 265 | rgb_st <- stars::st_rgb(rgb_st[, , , 1:3],
|
262 | 266 | dimension = "band",
|
263 | 267 | maxColorValue = max_value,
|
264 | 268 | use_alpha = FALSE,
|
265 |
| - probs = c(0.05, 0.95), |
| 269 | + probs = c(fst_quant, las_quant), |
266 | 270 | stretch = TRUE
|
267 | 271 | )
|
268 | 272 | # tmap params
|
269 |
| - labels_size <- as.numeric(.conf("tmap", "graticules_labels_size")) |
| 273 | + labels_size <- as.numeric(.conf("plot", "graticules_labels_size")) |
270 | 274 |
|
271 | 275 | p <- tmap::tm_shape(rgb_st, raster.downsample = FALSE) +
|
272 | 276 | tmap::tm_raster() +
|
|
306 | 310 | # verifies if stars package is installed
|
307 | 311 | .check_require_packages("stars")
|
308 | 312 | # verifies if tmap package is installed
|
309 |
| - .check_require_packages("tmap") |
| 313 | + .check_require_packages("plot") |
310 | 314 |
|
311 | 315 | # deal with color palette
|
312 | 316 | .check_palette(palette)
|
|
321 | 325 | )
|
322 | 326 | names(colors) <- names(labels)
|
323 | 327 | # size of data to be read
|
324 |
| - max_size <- .conf("plot_max_size") |
| 328 | + max_size <- .conf("plot", "max_size") |
325 | 329 | sizes <- .tile_overview_size(tile = tile, max_size)
|
326 | 330 | # select the image to be plotted
|
327 | 331 | class_file <- .tile_path(tile)
|
|
340 | 344 | stars_obj <- stats::setNames(stars_obj, "labels")
|
341 | 345 |
|
342 | 346 | # tmap params
|
343 |
| - labels_size <- as.numeric(.conf("tmap", "graticules_labels_size")) |
344 |
| - legend_bg_color <- .conf("tmap", "legend_bg_color") |
345 |
| - legend_bg_alpha <- as.numeric(.conf("tmap", "legend_bg_alpha")) |
346 |
| - legend_title_size <- as.numeric(.conf("tmap", "legend_title_size")) |
347 |
| - legend_text_size <- as.numeric(.conf("tmap", "legend_text_size")) |
| 347 | + labels_size <- as.numeric(.conf("plot", "graticules_labels_size")) |
| 348 | + legend_bg_color <- .conf("plot", "legend_bg_color") |
| 349 | + legend_bg_alpha <- as.numeric(.conf("plot", "legend_bg_alpha")) |
| 350 | + legend_title_size <- as.numeric(.conf("plot", "legend_title_size")) |
| 351 | + legend_text_size <- as.numeric(.conf("plot", "legend_text_size")) |
348 | 352 |
|
349 | 353 | # plot using tmap
|
350 | 354 | p <- suppressMessages(
|
|
390 | 394 | # verifies if stars package is installed
|
391 | 395 | .check_require_packages("stars")
|
392 | 396 | # verifies if tmap package is installed
|
393 |
| - .check_require_packages("tmap") |
| 397 | + .check_require_packages("plot") |
394 | 398 | # precondition - check color palette
|
395 | 399 | .check_palette(palette)
|
396 | 400 | # revert the palette
|
|
408 | 412 | .check_that(all(labels_plot %in% labels))
|
409 | 413 | }
|
410 | 414 | # size of data to be read
|
411 |
| - max_size <- .conf("plot_max_size") |
| 415 | + max_size <- .conf("plot", "max_size") |
412 | 416 | sizes <- .tile_overview_size(tile = tile, max_size)
|
413 | 417 | # get the path
|
414 | 418 | probs_path <- .tile_path(tile)
|
|
432 | 436 | # select stars bands to be plotted
|
433 | 437 | bds <- as.numeric(names(labels[labels %in% labels_plot]))
|
434 | 438 |
|
435 |
| - labels_size <- as.numeric(.conf("tmap", "graticules_labels_size")) |
436 |
| - legend_bg_color <- .conf("tmap", "legend_bg_color") |
437 |
| - legend_bg_alpha <- as.numeric(.conf("tmap", "legend_bg_alpha")) |
438 |
| - legend_title_size <- as.numeric(.conf("tmap", "legend_title_size")) |
439 |
| - legend_text_size <- as.numeric(.conf("tmap", "legend_text_size")) |
| 439 | + labels_size <- as.numeric(.conf("plot", "graticules_labels_size")) |
| 440 | + legend_bg_color <- .conf("plot", "legend_bg_color") |
| 441 | + legend_bg_alpha <- as.numeric(.conf("plot", "legend_bg_alpha")) |
| 442 | + legend_title_size <- as.numeric(.conf("plot", "legend_title_size")) |
| 443 | + legend_text_size <- as.numeric(.conf("plot", "legend_text_size")) |
440 | 444 |
|
441 | 445 | p <- tmap::tm_shape(probs_st[, , , bds]) +
|
442 | 446 | tmap::tm_raster(
|
|
0 commit comments