diff --git a/R/api_source_deafrica.R b/R/api_source_deafrica.R index 03570452..43aeddab 100644 --- a/R/api_source_deafrica.R +++ b/R/api_source_deafrica.R @@ -18,6 +18,7 @@ stac_query, tiles = NULL, platform = NULL) { + .check_that(is.null(tiles)) # Convert roi to bbox roi <- .stac_intersects_as_bbox(stac_query) stac_query[["params"]][["intersects"]] <- NULL diff --git a/R/api_source_deaustralia.R b/R/api_source_deaustralia.R index f8770eb7..fa3e3d65 100644 --- a/R/api_source_deaustralia.R +++ b/R/api_source_deaustralia.R @@ -18,6 +18,7 @@ stac_query, tiles = NULL, platform = NULL) { + .check_that(is.null(tiles)) # Convert roi to bbox roi <- .stac_intersects_as_bbox(stac_query) stac_query[["params"]][["intersects"]] <- NULL diff --git a/inst/extdata/sources/config_source_deaustralia.yml b/inst/extdata/sources/config_source_deaustralia.yml index 8c3b7eed..b22d2ba5 100644 --- a/inst/extdata/sources/config_source_deaustralia.yml +++ b/inst/extdata/sources/config_source_deaustralia.yml @@ -431,9 +431,9 @@ sources: <<: *deaustralia_ls5_geomedian_band_30m band_name: "swir2" EDEV : &deaustralia_ls5_geomedian_product_30m - missing_value : -32768 - minimum_value : 0 - maximum_value : 65536 + missing_value : -3.402823466385288e+37 + minimum_value : -3.402823466385288e+37 + maximum_value : 1.7014118346015974e+37 scale_factor : 1 offset_value : 0 resampling : "bilinear" @@ -486,9 +486,9 @@ sources: <<: *deaustralia_ls7_geomedian_band_30m band_name: "swir2" EDEV : &deaustralia_ls7_geomedian_product_30m - missing_value : -32768 - minimum_value : 0 - maximum_value : 65536 + missing_value : -3.402823466385288e+37 + minimum_value : -3.402823466385288e+37 + maximum_value : 1.7014118346015974e+37 scale_factor : 1 offset_value : 0 resampling : "bilinear" @@ -541,9 +541,9 @@ sources: <<: *deaustralia_ls8_geomedian_band_30m band_name: "swir2" EDEV : &deaustralia_ls8_geomedian_product_30m - missing_value : -32768 - minimum_value : 0 - maximum_value : 65536 + missing_value : -3.402823466385288e+37 + minimum_value : -3.402823466385288e+37 + maximum_value : 1.7014118346015974e+37 scale_factor : 1 offset_value : 0 resampling : "bilinear" @@ -580,7 +580,7 @@ sources: resampling : "bilinear" resolution : 30 band_name : "bs" - data_type : "INT2S" + data_type : "INT1U" PV : <<: *deaustralia_fc_band_30m band_name: "pv" @@ -602,23 +602,71 @@ sources: GA_S2LS_INTERTIDAL_CYEAR_3 : bands : - BS : &deaustralia_fc_band_30m + ELEVATION : &deaustralia_intertidal_elevation_10m + missing_value : -3.402823466385288e+37 + minimum_value : -3.402823466385288e+37 + maximum_value : 1.7014118346015974e+37 + scale_factor : 1 + offset_value : 0 + resampling : "bilinear" + resolution : 10 + band_name : "elevation" + data_type : "FLT4S" + ELEVATION-UNCERTAINTY : + <<: *deaustralia_intertidal_elevation_10m + band_name : "elevation_uncertainty" + EXPOSURE : &deaustralia_intertidal_exposure_10m missing_value : 255 minimum_value : 0 maximum_value : 254 scale_factor : 1 offset_value : 0 resampling : "bilinear" - resolution : 30 - band_name : "bs" - data_type : "INT2S" - PV : - <<: *deaustralia_fc_band_30m - band_name: "pv" - NPV : - <<: *deaustralia_fc_band_30m - band_name: "npv" - satellite : "LANDSAT" + resolution : 10 + band_name : "exposure" + data_type : "INT1U" + TA-HAT : &deaustralia_intertidal_ta_10m + missing_value : -3.402823466385288e+37 + minimum_value : -3.402823466385288e+37 + maximum_value : 1.7014118346015974e+37 + scale_factor : 1 + offset_value : 0 + resampling : "bilinear" + resolution : 10 + band_name : "ta_hat" + data_type : "FLT4S" + TA-HOT : + <<: *deaustralia_intertidal_ta_10m + band_name : "ta_hot" + TA-LOT : + <<: *deaustralia_intertidal_ta_10m + band_name : "ta_lot" + TA-LAT : + <<: *deaustralia_intertidal_ta_10m + band_name : "ta_lat" + TA-OFFSET-HIGH : &deaustralia_intertidal_ta_int_10m + missing_value : 255 + minimum_value : 0 + maximum_value : 254 + scale_factor : 1 + offset_value : 0 + resampling : "bilinear" + resolution : 10 + band_name : "ta_offset_high" + data_type : "INT1U" + TA-OFFSET-LOW : + <<: *deaustralia_intertidal_ta_int_10m + band_name : "ta_offset_low" + TA-SPREAD : + <<: *deaustralia_intertidal_ta_int_10m + band_name : "ta_spread" + QA-NDWI-CORR : + <<: *deaustralia_intertidal_ta_10m + band_name : "qa_ndwi_corr" + QA-NDWI-FREQ : + <<: *deaustralia_intertidal_ta_int_10m + band_name : "qa_ndwi_freq" + satellite : "LANDSAT-SENTINEL" sensor : "INTERTIDAL" collection_name : "ga_s2ls_intertidal_cyear_3" access_vars : @@ -629,4 +677,4 @@ sources: open_data_token : false metadata_search : "tile" ext_tolerance : 0 - grid_system : "WRS-2" + grid_system : "" diff --git a/tests/testthat/test-cube-deaustralia.R b/tests/testthat/test-cube-deaustralia.R index be4de83f..ed2c956f 100644 --- a/tests/testthat/test-cube-deaustralia.R +++ b/tests/testthat/test-cube-deaustralia.R @@ -479,3 +479,41 @@ test_that("Creating GA_LS_FC_3 cubes from DEAustralia", { cube_nrows <- .tile_nrows(landsat_cube) expect_true(.raster_nrows(r_obj) == cube_nrows) }) + +test_that("Creating GA_S2LS_INTERTIDAL_CYEAR_3 cubes from DEAustralia", { + intertidal_cube <- .try( + { + sits_cube( + source = "DEAUSTRALIA", + collection = "GA_S2LS_INTERTIDAL_CYEAR_3", + bands = c("ELEVATION", "EXPOSURE"), + roi = c( + lon_min = 137.15991, + lon_max = 138.18467, + lat_min = -33.85777, + lat_max = -32.56690 + ), + start_date = "2016-01-01", + end_date = "2019-06-01", + progress = FALSE + ) + }, + .default = NULL + ) + + testthat::skip_if(purrr::is_null(intertidal_cube), + message = "DEAustralia is not accessible" + ) + + expect_true(all(sits_bands(intertidal_cube) %in% c( + "ELEVATION", "EXPOSURE" + ))) + expect_equal(nrow(intertidal_cube), 14) + bbox_cube <- sits_bbox(intertidal_cube, as_crs = "EPSG:4326") + bbox_cube_1 <- sits_bbox(.tile(intertidal_cube), as_crs = "EPSG:4326") + expect_true(bbox_cube["xmax"] >= bbox_cube_1["xmax"]) + expect_true(bbox_cube["ymax"] >= bbox_cube_1["ymax"]) + r_obj <- .raster_open_rast(intertidal_cube$file_info[[1]]$path[1]) + cube_nrows <- .tile_nrows(intertidal_cube) + expect_true(.raster_nrows(r_obj) == cube_nrows) +})