Skip to content

Commit

Permalink
Merge pull request #1192 from M3nin0/fix/deaustralia-band-names
Browse files Browse the repository at this point in the history
fix deaustralia products bands
  • Loading branch information
gilbertocamara committed Aug 6, 2024
2 parents 27f4410 + a4c6584 commit 0897010
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 39 deletions.
12 changes: 6 additions & 6 deletions inst/extdata/sources/config_source_deaustralia.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ sources:
NIR :
<<: *deaustralia_ls5_tm_30m
band_name: "nbart_nir"
SWIR_1 :
SWIR-1 :
<<: *deaustralia_ls5_tm_30m
band_name: "nbart_swir_1"
SWIR_2 :
SWIR-2 :
<<: *deaustralia_ls5_tm_30m
band_name: "nbart_swir_2"
CLOUD :
Expand Down Expand Up @@ -82,10 +82,10 @@ sources:
NIR :
<<: *deaustralia_ls7_etm_30m
band_name: "nbart_nir"
SWIR_1 :
SWIR-1 :
<<: *deaustralia_ls7_etm_30m
band_name: "nbart_swir_1"
SWIR_2 :
SWIR-2 :
<<: *deaustralia_ls7_etm_30m
band_name: "nbart_swir_2"
PANCHROMATIC :
Expand Down Expand Up @@ -275,10 +275,10 @@ sources:
resolution : 20
band_name : "nbart_red_edge_1"
data_type : "INT2S"
RED_EDGE_2 :
RED-EDGE-2 :
<<: *deaustralia_s2a_msi_20m
band_name : "nbart_red_edge_2"
RED_EDGE_3 :
RED-EDGE-3 :
<<: *deaustralia_s2a_msi_20m
band_name : "nbart_red_edge_3"
NIR-1 :
Expand Down
64 changes: 31 additions & 33 deletions tests/testthat/test-cube-deaustralia.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ test_that("Creating GA_LS5T_ARD_3 cubes from DEAustralia", {
sits_cube(
source = "DEAUSTRALIA",
collection = "GA_LS5T_ARD_3",
bands = c("NBART_SWIR_1", "CLOUD"),
bands = c("SWIR-1", "CLOUD"),
roi = c(
lon_min = 137.15991,
lon_max = 138.18467,
Expand All @@ -23,7 +23,7 @@ test_that("Creating GA_LS5T_ARD_3 cubes from DEAustralia", {
message = "DEAustralia is not accessible"
)

expect_true(all(sits_bands(landsat_cube) %in% c("NBART_SWIR_1", "CLOUD")))
expect_true(all(sits_bands(landsat_cube) %in% c("SWIR-1", "CLOUD")))
expect_equal(nrow(landsat_cube), 8)
bbox_cube <- sits_bbox(landsat_cube, as_crs = "EPSG:4326")
bbox_cube_1 <- sits_bbox(.tile(landsat_cube), as_crs = "EPSG:4326")
Expand Down Expand Up @@ -75,7 +75,7 @@ test_that("Creating GA_LS7E_ARD_3 cubes from DEAustralia", {
sits_cube(
source = "DEAUSTRALIA",
collection = "GA_LS7E_ARD_3",
bands = c("NBART_SWIR_1", "CLOUD"),
bands = c("SWIR-1", "CLOUD"),
roi = c(
lon_min = 137.15991,
lon_max = 138.18467,
Expand All @@ -94,7 +94,7 @@ test_that("Creating GA_LS7E_ARD_3 cubes from DEAustralia", {
message = "DEAustralia is not accessible"
)

expect_true(all(sits_bands(landsat_cube) %in% c("NBART_SWIR_1", "CLOUD")))
expect_true(all(sits_bands(landsat_cube) %in% c("SWIR-1", "CLOUD")))
expect_equal(nrow(landsat_cube), 8)
bbox_cube <- sits_bbox(landsat_cube, as_crs = "EPSG:4326")
bbox_cube_1 <- sits_bbox(.tile(landsat_cube), as_crs = "EPSG:4326")
Expand Down Expand Up @@ -146,7 +146,7 @@ test_that("Creating GA_LS8C_ARD_3 cubes from DEAustralia", {
sits_cube(
source = "DEAUSTRALIA",
collection = "GA_LS8C_ARD_3",
bands = c("nbart_nir", "CLOUD"),
bands = c("NIR", "CLOUD"),
roi = c(
lon_min = 137.15991,
lon_max = 138.18467,
Expand All @@ -165,7 +165,7 @@ test_that("Creating GA_LS8C_ARD_3 cubes from DEAustralia", {
message = "DEAustralia is not accessible"
)

expect_true(all(sits_bands(landsat_cube) %in% c("NBART_NIR", "CLOUD")))
expect_true(all(sits_bands(landsat_cube) %in% c("NIR", "CLOUD")))
expect_equal(nrow(landsat_cube), 8)
bbox_cube <- sits_bbox(landsat_cube, as_crs = "EPSG:4326")
bbox_cube_1 <- sits_bbox(.tile(landsat_cube), as_crs = "EPSG:4326")
Expand Down Expand Up @@ -217,7 +217,7 @@ test_that("Creating GA_LS9C_ARD_3 cubes from DEAustralia", {
sits_cube(
source = "DEAUSTRALIA",
collection = "GA_LS9C_ARD_3",
bands = c("nbart_nir", "CLOUD"),
bands = c("NIR", "CLOUD"),
roi = c(
lon_min = 137.15991,
lon_max = 138.18467,
Expand All @@ -236,7 +236,7 @@ test_that("Creating GA_LS9C_ARD_3 cubes from DEAustralia", {
message = "DEAustralia is not accessible"
)

expect_true(all(sits_bands(landsat_cube) %in% c("NBART_NIR", "CLOUD")))
expect_true(all(sits_bands(landsat_cube) %in% c("NIR", "CLOUD")))
expect_equal(nrow(landsat_cube), 8)
bbox_cube <- sits_bbox(landsat_cube, as_crs = "EPSG:4326")
bbox_cube_1 <- sits_bbox(.tile(landsat_cube), as_crs = "EPSG:4326")
Expand All @@ -255,9 +255,9 @@ test_that("Creating GA_S2AM_ARD_3 cubes from DEAustralia using ROI", {
source = "DEAUSTRALIA",
collection = "GA_S2AM_ARD_3",
bands = c(
"nbart_coastal_aerosol",
"NBART_RED",
"nbart_red_edge_1"
"COASTAL-AEROSOL",
"RED",
"RED-EDGE-1"
),
roi = c(
lon_min = 137.15991,
Expand All @@ -278,9 +278,9 @@ test_that("Creating GA_S2AM_ARD_3 cubes from DEAustralia using ROI", {
)

expect_true(all(sits_bands(sentinel_cube) %in% c(
"NBART_COASTAL_AEROSOL",
"NBART_RED",
"NBART_RED_EDGE_1"
"COASTAL-AEROSOL",
"RED",
"RED-EDGE-1"
)))
expect_equal(nrow(sentinel_cube), 9)
r <- .raster_open_rast(.tile_path(sentinel_cube))
Expand All @@ -293,7 +293,7 @@ test_that("Creating GA_S2AM_ARD_3 cubes from DEAustralia using tiles", {
sits_cube(
source = "DEAUSTRALIA",
collection = "GA_S2AM_ARD_3",
bands = c("nbart_blue", "nbart_nir_2", "nbart_swir_2"),
bands = c("BLUE", "NIR-2", "SWIR-2"),
tiles = c("53HQE", "53HPE"),
start_date = "2019-01-01",
end_date = "2019-08-28",
Expand All @@ -308,9 +308,9 @@ test_that("Creating GA_S2AM_ARD_3 cubes from DEAustralia using tiles", {
)

expect_true(all(sits_bands(sentinel_cube) %in% c(
"NBART_BLUE",
"NBART_NIR_2",
"NBART_SWIR_2"
"BLUE",
"NIR-2",
"SWIR-2"
)))
expect_equal(nrow(sentinel_cube), 2)
r <- .raster_open_rast(.tile_path(sentinel_cube))
Expand All @@ -327,9 +327,9 @@ test_that("Creating GA_S2BM_ARD_3 cubes from DEAustralia using ROI", {
source = "DEAUSTRALIA",
collection = "GA_S2BM_ARD_3",
bands = c(
"nbart_coastal_aerosol",
"nbart_red",
"nbart_red_edge_1"
"COASTAL-AEROSOL",
"RED",
"RED-EDGE-1"
),
roi = c(
lon_min = 137.15991,
Expand All @@ -350,9 +350,9 @@ test_that("Creating GA_S2BM_ARD_3 cubes from DEAustralia using ROI", {
)

expect_true(all(sits_bands(sentinel_cube) %in% c(
"NBART_COASTAL_AEROSOL",
"NBART_RED",
"NBART_RED_EDGE_1"
"COASTAL-AEROSOL",
"RED",
"RED-EDGE-1"
)))
expect_equal(nrow(sentinel_cube), 9)
r <- .raster_open_rast(.tile_path(sentinel_cube))
Expand All @@ -366,9 +366,9 @@ test_that("Creating GA_S2BM_ARD_3 cubes from DEAustralia using tiles", {
source = "DEAUSTRALIA",
collection = "GA_S2BM_ARD_3",
bands = c(
"NBART_RED_EDGE_1",
"nbart_nir_2",
"nbart_swir_2"
"RED-EDGE-1",
"NIR-2",
"SWIR-2"
),
tiles = c("53HQE","53HPE"),
start_date = "2019-01-01",
Expand All @@ -384,9 +384,7 @@ test_that("Creating GA_S2BM_ARD_3 cubes from DEAustralia using tiles", {
)

expect_true(all(sits_bands(sentinel_cube) %in% c(
"NBART_RED_EDGE_1",
"NBART_NIR_2",
"NBART_SWIR_2"
"RED-EDGE-1", "NIR-2", "SWIR-2"
)))
expect_equal(nrow(sentinel_cube), 2)
r <- .raster_open_rast(.tile_path(sentinel_cube))
Expand All @@ -403,7 +401,7 @@ test_that(
sits_cube(
source = "DEAUSTRALIA",
collection = "ga_s2am_ard_3",
bands = c("nbart_blue", "NBART_NIR_2"),
bands = c("BLUE", "NIR-2"),
tiles = c("53HQE","53HPE"),
start_date = "2019-01-01",
end_date = "2019-08-28",
Expand All @@ -418,7 +416,7 @@ test_that(
sits_cube(
source = "DEAUSTRALIA",
collection = "GA_S2BM_ARD_3",
bands = c("NBART_SWIR_2"),
bands = c("SWIR-2"),
tiles = c("53HQE","53HPE"),
start_date = "2019-01-01",
end_date = "2019-08-28",
Expand All @@ -435,7 +433,7 @@ test_that(
sentinel_cube <- sits_merge(s2a_cube, s2b_cube)

expect_true(all(sits_bands(sentinel_cube) %in% c(
"NBART_BLUE", "NBART_NIR_2", "NBART_SWIR_2"
"BLUE", "NIR-2", "SWIR-2"
)))
expect_equal(nrow(sentinel_cube), 2)
r <- .raster_open_rast(.tile_path(sentinel_cube))
Expand Down

0 comments on commit 0897010

Please sign in to comment.