Skip to content

Commit

Permalink
improve tests changing MPC to AWS whenever possible
Browse files Browse the repository at this point in the history
  • Loading branch information
gilbertocamara committed Feb 1, 2025
1 parent 108e5aa commit 2c725bc
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 15 deletions.
1 change: 1 addition & 0 deletions sits.Rproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
Version: 1.0
ProjectId: d3d39f0a-3eea-4875-95b4-a71d9c0ce212

RestoreWorkspace: Default
SaveWorkspace: Ask
Expand Down
6 changes: 3 additions & 3 deletions tests/testthat/test-apply.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ test_that("Testing normalized index generation", {
s2_cube <- tryCatch(
{
sits_cube(
source = "MPC",
source = "AWS",
collection = "SENTINEL-2-L2A",
tiles = "20LKP",
bands = c("B05", "B8A", "CLOUD"),
Expand All @@ -18,10 +18,10 @@ test_that("Testing normalized index generation", {

testthat::skip_if(
purrr::is_null(s2_cube),
"MPC is not accessible"
"AWS is not accessible"
)

dir_images <- paste0(tempdir(), "/images/")
dir_images <- paste0(tempdir(), "/images_aws/")
if (!dir.exists(dir_images)) {
suppressWarnings(dir.create(dir_images))
}
Expand Down
6 changes: 3 additions & 3 deletions tests/testthat/test-cube_copy.R
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ test_that("Copy remote cube works (full region)", {
"lon_max" = -40.67849202, "lat_max" = -4.29126327)
# Data cube
cube_s2 <- sits_cube(
source = "MPC",
source = "AWS",
collection = "SENTINEL-2-L2A",
bands = c("B02", "B8A"),
roi = roi,
Expand Down Expand Up @@ -130,7 +130,7 @@ test_that("Copy remote cube works (full region with resampling)", {
"lon_max" = -40.67849202, "lat_max" = -4.29126327)
# Data cube
cube_s2 <- sits_cube(
source = "MPC",
source = "AWS",
collection = "SENTINEL-2-L2A",
bands = c("B02", "B8A"),
roi = roi,
Expand Down Expand Up @@ -171,7 +171,7 @@ test_that("Copy remote cube works (specific region with resampling)", {
"lon_max" = -40.67849202, "lat_max" = -4.29126327)
# Data cube
cube_s2 <- sits_cube(
source = "MPC",
source = "AWS",
collection = "SENTINEL-2-L2A",
bands = c("B02", "B8A"),
roi = roi,
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-data.R
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ test_that("Retrieving points from MPC Base Cube", {
)
# load sentinel-2 cube
s2_cube <- sits_cube(
source = "MPC",
source = "AWS",
collection = "SENTINEL-2-L2A",
start_date = "2019-01-01",
end_date = "2019-01-20",
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-internals.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ test_that("Timeline tests", {
s2_cube <- tryCatch(
{
sits_cube(
source = "MPC",
source = "AWS",
collection = "sentinel-2-l2a",
tiles = "20LKP",
bands = c("B05", "B8A", "CLOUD"),
Expand Down
8 changes: 4 additions & 4 deletions tests/testthat/test-merge.R
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ test_that("sits_merge - different bands case - equal tiles", {
.try(
{
sits_cube(
source = "MPC",
source = "AWS",
collection = "SENTINEL-2-L2A",
bands = c("B02"),
tiles = c("19LEF"),
Expand Down Expand Up @@ -724,7 +724,7 @@ test_that("sits_merge - regularize combined cubes", {
.try(
{
sits_cube(
source = "MPC",
source = "AWS",
collection = "SENTINEL-2-L2A",
bands = c("B02"),
tiles = c("19LEF"),
Expand Down Expand Up @@ -786,7 +786,7 @@ test_that("sits_merge - cubes with different classes", {
s2_cube <- .try(
{
sits_cube(
source = "MPC",
source = "AWS",
collection = "SENTINEL-2-L2A",
bands = c("B02"),
tiles = c("19LEF"),
Expand Down Expand Up @@ -835,7 +835,7 @@ test_that("sits_merge - special case - dem cube", {
.try(
{
sits_cube(
source = "MPC",
source = "AWS",
collection = "SENTINEL-2-L2A",
tiles = "19HBA",
bands = c("B04", "B8A", "B12", "CLOUD"),
Expand Down
2 changes: 0 additions & 2 deletions tests/testthat/test-raster.R
Original file line number Diff line number Diff line change
Expand Up @@ -483,8 +483,6 @@ test_that("Classification with post-processing", {
expect_true(max_lab == 4)
expect_true(min_lab == 1)

expect_equal(.tile_area_freq(sinop_class)[1,3],.tile_area_freq(sinop4)[1,3])

expect_error(.tile_update_label(
sinop_probs,
c("Cerrado", "Floresta", "Pastagem","Soja_Milho")
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-roi.R
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ test_that("bbox as sf", {
s2_cube_s2a <- .try(
{
sits_cube(
source = "MPC",
source = "AWS",
collection = "SENTINEL-2-L2A",
tiles = c("20LKP", "21LTF"),
bands = c("B05"),
Expand Down

0 comments on commit 2c725bc

Please sign in to comment.