Skip to content

Commit

Permalink
band names for DEAUSTRALIA collections
Browse files Browse the repository at this point in the history
  • Loading branch information
gilbertocamara committed Aug 4, 2024
1 parent 54273ab commit 7a3f7e9
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 63 deletions.
102 changes: 51 additions & 51 deletions inst/extdata/sources/config_source_deaustralia.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ sources:
collections :
GA_LS5T_ARD_3 :
bands :
NBART_BLUE : &deaustralia_ls5_tm_30m
BLUE : &deaustralia_ls5_tm_30m
missing_value : -999
minimum_value : 0
maximum_value : 65536
Expand All @@ -20,19 +20,19 @@ sources:
resolution : 30
band_name : "nbart_blue"
data_type : "INT2S"
NBART_GREEN :
GREEN :
<<: *deaustralia_ls5_tm_30m
band_name: "nbart_green"
NBART_RED :
RED :
<<: *deaustralia_ls5_tm_30m
band_name: "nbart_red"
NBART_NIR :
NIR :
<<: *deaustralia_ls5_tm_30m
band_name: "nbart_nir"
NBART_SWIR_1 :
SWIR_1 :
<<: *deaustralia_ls5_tm_30m
band_name: "nbart_swir_1"
NBART_SWIR_2 :
SWIR_2 :
<<: *deaustralia_ls5_tm_30m
band_name: "nbart_swir_2"
CLOUD :
Expand Down Expand Up @@ -63,7 +63,7 @@ sources:
grid_system : "WRS-2"
GA_LS7E_ARD_3 :
bands :
NBART_BLUE : &deaustralia_ls7_etm_30m
BLUE : &deaustralia_ls7_etm_30m
missing_value : -999
minimum_value : 0
maximum_value : 65536
Expand All @@ -73,22 +73,22 @@ sources:
resolution : 30
band_name : "nbart_blue"
data_type : "INT2S"
NBART_GREEN :
GREEN :
<<: *deaustralia_ls7_etm_30m
band_name: "nbart_green"
NBART_RED :
RED :
<<: *deaustralia_ls7_etm_30m
band_name: "nbart_red"
NBART_NIR :
NIR :
<<: *deaustralia_ls7_etm_30m
band_name: "nbart_nir"
NBART_SWIR_1 :
SWIR_1 :
<<: *deaustralia_ls7_etm_30m
band_name: "nbart_swir_1"
NBART_SWIR_2 :
SWIR_2 :
<<: *deaustralia_ls7_etm_30m
band_name: "nbart_swir_2"
NBART_PANCHROMATIC :
PANCHROMATIC :
<<: *deaustralia_ls7_etm_30m
resolution : 15
band_name: "nbart_panchromatic"
Expand Down Expand Up @@ -121,7 +121,7 @@ sources:

GA_LS8C_ARD_3 :
bands :
NBART_COASTAL_AEROSOL : &deaustralia_ls8_oli_30m
COASTAL-AEROSOL : &deaustralia_ls8_oli_30m
missing_value : -999
minimum_value : 0
maximum_value : 65536
Expand All @@ -131,25 +131,25 @@ sources:
resolution : 30
band_name : "nbart_coastal_aerosol"
data_type : "INT2U"
NBART_BLUE :
BLUE :
<<: *deaustralia_ls8_oli_30m
band_name : "nbart_blue"
NBART_GREEN :
GREEN :
<<: *deaustralia_ls8_oli_30m
band_name : "nbart_green"
NBART_RED :
RED :
<<: *deaustralia_ls8_oli_30m
band_name : "nbart_red"
NBART_NIR :
NIR :
<<: *deaustralia_ls8_oli_30m
band_name : "nbart_nir"
NBART_SWIR_1 :
SWIR-1 :
<<: *deaustralia_ls8_oli_30m
band_name : "nbart_swir_1"
NBART_SWIR_2 :
SWIR-2 :
<<: *deaustralia_ls8_oli_30m
band_name : "nbart_swir_2"
NBART_PANCHROMATIC:
PANCHROMATIC:
<<: *deaustralia_ls8_oli_30m
resolution : 15
band_name : "nbart_panchromatic"
Expand Down Expand Up @@ -181,7 +181,7 @@ sources:
grid_system : "WRS-2"
GA_LS9C_ARD_3 :
bands :
NBART_COASTAL_AEROSOL : &deaustralia_ls9_oli_30m
COASTAL-AEROSOL : &deaustralia_ls9_oli_30m
missing_value : -999
minimum_value : 0
maximum_value : 65536
Expand All @@ -191,25 +191,25 @@ sources:
resolution : 30
band_name : "nbart_coastal_aerosol"
data_type : "INT2U"
NBART_BLUE :
BLUE :
<<: *deaustralia_ls9_oli_30m
band_name : "nbart_blue"
NBART_GREEN :
GREEN :
<<: *deaustralia_ls9_oli_30m
band_name : "nbart_green"
NBART_RED :
RED :
<<: *deaustralia_ls9_oli_30m
band_name : "nbart_red"
NBART_NIR :
NIR :
<<: *deaustralia_ls9_oli_30m
band_name : "nbart_nir"
NBART_SWIR_1 :
SWIR-1 :
<<: *deaustralia_ls9_oli_30m
band_name : "nbart_swir_1"
NBART_SWIR_2 :
SWIR-2 :
<<: *deaustralia_ls9_oli_30m
band_name : "nbart_swir_2"
NBART_PANCHROMATIC:
PANCHROMATIC:
<<: *deaustralia_ls9_oli_30m
resolution : 15
band_name : "nbart_panchromatic"
Expand Down Expand Up @@ -242,7 +242,7 @@ sources:

GA_S2AM_ARD_3 :
bands :
NBART_COASTAL_AEROSOL : &deaustralia_s2a_msi_60m
COASTAL-AEROSOL : &deaustralia_s2a_msi_60m
missing_value : -999
minimum_value : 0
maximum_value : 10000
Expand All @@ -251,7 +251,7 @@ sources:
resolution : 60
band_name : "nbart_coastal_aerosol"
data_type : "INT2S"
NBART_BLUE : &deaustralia_s2a_msi_10m
BLUE : &deaustralia_s2a_msi_10m
missing_value : -999
minimum_value : 0
maximum_value : 10000
Expand All @@ -260,13 +260,13 @@ sources:
resolution : 10
band_name : "nbart_blue"
data_type : "INT2S"
NBART_GREEN :
GREEN :
<<: *deaustralia_s2a_msi_10m
band_name : "nbart_green"
NBART_RED :
RED :
<<: *deaustralia_s2a_msi_10m
band_name : "nbart_red"
NBART_RED_EDGE_1 : &deaustralia_s2a_msi_20m
RED-EDGE-1 : &deaustralia_s2a_msi_20m
missing_value : -999
minimum_value : 0
maximum_value : 10000
Expand All @@ -275,22 +275,22 @@ sources:
resolution : 20
band_name : "nbart_red_edge_1"
data_type : "INT2S"
NBART_RED_EDGE_2 :
RED_EDGE_2 :
<<: *deaustralia_s2a_msi_20m
band_name : "nbart_red_edge_2"
NBART_RED_EDGE_3 :
RED_EDGE_3 :
<<: *deaustralia_s2a_msi_20m
band_name : "nbart_red_edge_3"
NBART_NIR_1 :
NIR-1 :
<<: *deaustralia_s2a_msi_10m
band_name : "nbart_nir_1"
NBART_NIR_2 :
NIR-2 :
<<: *deaustralia_s2a_msi_20m
band_name : "nbart_nir_2"
NBART_SWIR_2 :
SWIR-2 :
<<: *deaustralia_s2a_msi_20m
band_name : "nbart_swir_2"
NBART_SWIR_3 :
SWIR-3 :
<<: *deaustralia_s2a_msi_20m
band_name : "nbart_swir_3"
CLOUD :
Expand Down Expand Up @@ -323,7 +323,7 @@ sources:
grid_system : "MGRS"
GA_S2BM_ARD_3 :
bands :
NBART_COASTAL_AEROSOL : &deaustralia_s2a_msi_60m
COASTAL-AEROSOL : &deaustralia_s2a_msi_60m
missing_value : -999
minimum_value : 0
maximum_value : 10000
Expand All @@ -332,7 +332,7 @@ sources:
resolution : 60
band_name : "nbart_coastal_aerosol"
data_type : "INT2U"
NBART_BLUE : &deaustralia_s2a_msi_10m
BLUE : &deaustralia_s2a_msi_10m
missing_value : -999
minimum_value : 0
maximum_value : 10000
Expand All @@ -341,13 +341,13 @@ sources:
resolution : 10
band_name : "nbart_blue"
data_type : "INT2S"
NBART_GREEN :
GREEN :
<<: *deaustralia_s2a_msi_10m
band_name : "nbart_green"
NBART_RED :
RED :
<<: *deaustralia_s2a_msi_10m
band_name : "nbart_red"
NBART_RED_EDGE_1 : &deaustralia_s2a_msi_20m
RED-EDGE-1 : &deaustralia_s2a_msi_20m
missing_value : -999
minimum_value : 0
maximum_value : 10000
Expand All @@ -356,22 +356,22 @@ sources:
resolution : 20
band_name : "nbart_red_edge_1"
data_type : "INT2S"
NBART_RED_EDGE_2 :
RED-EDGE-2 :
<<: *deaustralia_s2a_msi_20m
band_name : "nbart_red_edge_2"
NBART_RED_EDGE_3 :
RED-EDGE-3 :
<<: *deaustralia_s2a_msi_20m
band_name : "nbart_red_edge_3"
NBART_NIR_1 :
NIR-1 :
<<: *deaustralia_s2a_msi_10m
band_name : "nbart_nir_1"
NBART_NIR_2 :
NIR-2 :
<<: *deaustralia_s2a_msi_20m
band_name : "nbart_nir_2"
NBART_SWIR_2 :
SWIR-2 :
<<: *deaustralia_s2a_msi_20m
band_name : "nbart_swir_2"
NBART_SWIR_3 :
SWIR-3 :
<<: *deaustralia_s2a_msi_20m
band_name : "nbart_swir_3"
CLOUD :
Expand Down
21 changes: 11 additions & 10 deletions inst/extdata/tmap/api_tmap_v3.R
Original file line number Diff line number Diff line change
Expand Up @@ -188,15 +188,15 @@
#' @noRd
#' @param st Stars object.
#' @param labels Class labels
#' @param label_plot Class labels to be plotted
#' @param labels_plot Class labels to be plotted
#' @param palette A sequential RColorBrewer palette
#' @param rev Reverse the color palette?
#' @param scale Scale to plot map (0.4 to 1.0)
#' @param tmap_params List with tmap params for detailed plot control
#' @return A plot object
.tmap_probs_map <- function(probs_st,
labels,
label_plot,
labels_plot,
palette,
rev,
scale,
Expand All @@ -212,7 +212,7 @@
#'
.tmap_probs_map.tmap_v3 <- function(probs_st,
labels,
label_plot,
labels_plot,
palette,
rev,
scale,
Expand All @@ -222,15 +222,16 @@
palette <- paste0("-", palette)
}
# select stars bands to be plotted
bds <- as.numeric(names(labels[labels %in% label_plot]))
bds <- as.numeric(names(labels[labels %in% labels_plot]))

p <- tmap::tm_shape(probs_st[, , , bds]) +
tmap::tm_raster(
style = "cont",
palette = palette,
midpoint = NA,
title = labels[labels %in% label_plot]
title = labels[labels %in% labels_plot]
) +
tmap::tm_facets(sync = FALSE) +
tmap::tm_graticules(
labels.size = tmap_params[["graticules_labels_size"]]
) +
Expand Down Expand Up @@ -258,12 +259,12 @@
#' @param palette A sequential RColorBrewer palette
#' @param rev Reverse the color palette?
#' @param labels Class labels
#' @param label_plot Class label to be plotted
#' @param labels_plot Class labels to be plotted
#' @param scale Scale to plot map (0.4 to 1.0)
#' @param tmap_params Tmap parameters
#' @return A plot object
.tmap_vector_probs <- function(sf_seg, palette, rev,
labels, label_plot,
labels, labels_plot,
scale, tmap_params){
if (as.numeric_version(utils::packageVersion("tmap")) < "3.9")
class(sf_seg) <- "tmap_v3"
Expand All @@ -273,7 +274,7 @@
}
#' @export
.tmap_vector_probs.tmap_v3 <- function(sf_seg, palette, rev,
labels, label_plot,
labels, labels_plot,
scale, tmap_params){
# revert the palette?
if (rev) {
Expand All @@ -283,11 +284,11 @@
# plot the segments
p <- tmap::tm_shape(sf_seg) +
tmap::tm_fill(
label_plot,
labels_plot,
style = "cont",
palette = palette,
midpoint = NA,
title = labels[labels %in% label_plot]) +
title = labels[labels %in% labels_plot]) +
tmap::tm_graticules(
labels.size = tmap_params[["graticules_labels_size"]]
) +
Expand Down
2 changes: 1 addition & 1 deletion man/plot.probs_vector_cube.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/testthat/test-plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ test_that("Plot Time Series and Images", {
)
p_probs <- plot(sinop_probs)
expect_equal(p_probs$tm_raster$palette, "YlGn")
expect_equal(length(p_probs$tm_raster$title), 1)
expect_equal(length(p_probs$tm_raster$title), 4)
expect_equal(p_probs$tm_layout$legend.bg.color, "white")

p_probs_f <- plot(sinop_probs, labels = "Forest")
Expand Down

0 comments on commit 7a3f7e9

Please sign in to comment.