Skip to content

Commit

Permalink
Merge pull request #1186 from M3nin0/feature/deaustralia-interdital
Browse files Browse the repository at this point in the history
include deaustralia intertidal data
  • Loading branch information
gilbertocamara authored Jul 31, 2024
2 parents 46bf219 + 993dab9 commit b57ee84
Show file tree
Hide file tree
Showing 4 changed files with 110 additions and 22 deletions.
1 change: 1 addition & 0 deletions R/api_source_deafrica.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions R/api_source_deaustralia.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
92 changes: 70 additions & 22 deletions inst/extdata/sources/config_source_deaustralia.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand All @@ -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 :
Expand All @@ -629,4 +677,4 @@ sources:
open_data_token : false
metadata_search : "tile"
ext_tolerance : 0
grid_system : "WRS-2"
grid_system : ""
38 changes: 38 additions & 0 deletions tests/testthat/test-cube-deaustralia.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})

0 comments on commit b57ee84

Please sign in to comment.