Skip to content

Commit b57ee84

Browse files
Merge pull request #1186 from M3nin0/feature/deaustralia-interdital
include deaustralia intertidal data
2 parents 46bf219 + 993dab9 commit b57ee84

File tree

4 files changed

+110
-22
lines changed

4 files changed

+110
-22
lines changed

R/api_source_deafrica.R

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
stac_query,
1919
tiles = NULL,
2020
platform = NULL) {
21+
.check_that(is.null(tiles))
2122
# Convert roi to bbox
2223
roi <- .stac_intersects_as_bbox(stac_query)
2324
stac_query[["params"]][["intersects"]] <- NULL

R/api_source_deaustralia.R

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
stac_query,
1919
tiles = NULL,
2020
platform = NULL) {
21+
.check_that(is.null(tiles))
2122
# Convert roi to bbox
2223
roi <- .stac_intersects_as_bbox(stac_query)
2324
stac_query[["params"]][["intersects"]] <- NULL

inst/extdata/sources/config_source_deaustralia.yml

+70-22
Original file line numberDiff line numberDiff line change
@@ -431,9 +431,9 @@ sources:
431431
<<: *deaustralia_ls5_geomedian_band_30m
432432
band_name: "swir2"
433433
EDEV : &deaustralia_ls5_geomedian_product_30m
434-
missing_value : -32768
435-
minimum_value : 0
436-
maximum_value : 65536
434+
missing_value : -3.402823466385288e+37
435+
minimum_value : -3.402823466385288e+37
436+
maximum_value : 1.7014118346015974e+37
437437
scale_factor : 1
438438
offset_value : 0
439439
resampling : "bilinear"
@@ -486,9 +486,9 @@ sources:
486486
<<: *deaustralia_ls7_geomedian_band_30m
487487
band_name: "swir2"
488488
EDEV : &deaustralia_ls7_geomedian_product_30m
489-
missing_value : -32768
490-
minimum_value : 0
491-
maximum_value : 65536
489+
missing_value : -3.402823466385288e+37
490+
minimum_value : -3.402823466385288e+37
491+
maximum_value : 1.7014118346015974e+37
492492
scale_factor : 1
493493
offset_value : 0
494494
resampling : "bilinear"
@@ -541,9 +541,9 @@ sources:
541541
<<: *deaustralia_ls8_geomedian_band_30m
542542
band_name: "swir2"
543543
EDEV : &deaustralia_ls8_geomedian_product_30m
544-
missing_value : -32768
545-
minimum_value : 0
546-
maximum_value : 65536
544+
missing_value : -3.402823466385288e+37
545+
minimum_value : -3.402823466385288e+37
546+
maximum_value : 1.7014118346015974e+37
547547
scale_factor : 1
548548
offset_value : 0
549549
resampling : "bilinear"
@@ -580,7 +580,7 @@ sources:
580580
resampling : "bilinear"
581581
resolution : 30
582582
band_name : "bs"
583-
data_type : "INT2S"
583+
data_type : "INT1U"
584584
PV :
585585
<<: *deaustralia_fc_band_30m
586586
band_name: "pv"
@@ -602,23 +602,71 @@ sources:
602602

603603
GA_S2LS_INTERTIDAL_CYEAR_3 :
604604
bands :
605-
BS : &deaustralia_fc_band_30m
605+
ELEVATION : &deaustralia_intertidal_elevation_10m
606+
missing_value : -3.402823466385288e+37
607+
minimum_value : -3.402823466385288e+37
608+
maximum_value : 1.7014118346015974e+37
609+
scale_factor : 1
610+
offset_value : 0
611+
resampling : "bilinear"
612+
resolution : 10
613+
band_name : "elevation"
614+
data_type : "FLT4S"
615+
ELEVATION-UNCERTAINTY :
616+
<<: *deaustralia_intertidal_elevation_10m
617+
band_name : "elevation_uncertainty"
618+
EXPOSURE : &deaustralia_intertidal_exposure_10m
606619
missing_value : 255
607620
minimum_value : 0
608621
maximum_value : 254
609622
scale_factor : 1
610623
offset_value : 0
611624
resampling : "bilinear"
612-
resolution : 30
613-
band_name : "bs"
614-
data_type : "INT2S"
615-
PV :
616-
<<: *deaustralia_fc_band_30m
617-
band_name: "pv"
618-
NPV :
619-
<<: *deaustralia_fc_band_30m
620-
band_name: "npv"
621-
satellite : "LANDSAT"
625+
resolution : 10
626+
band_name : "exposure"
627+
data_type : "INT1U"
628+
TA-HAT : &deaustralia_intertidal_ta_10m
629+
missing_value : -3.402823466385288e+37
630+
minimum_value : -3.402823466385288e+37
631+
maximum_value : 1.7014118346015974e+37
632+
scale_factor : 1
633+
offset_value : 0
634+
resampling : "bilinear"
635+
resolution : 10
636+
band_name : "ta_hat"
637+
data_type : "FLT4S"
638+
TA-HOT :
639+
<<: *deaustralia_intertidal_ta_10m
640+
band_name : "ta_hot"
641+
TA-LOT :
642+
<<: *deaustralia_intertidal_ta_10m
643+
band_name : "ta_lot"
644+
TA-LAT :
645+
<<: *deaustralia_intertidal_ta_10m
646+
band_name : "ta_lat"
647+
TA-OFFSET-HIGH : &deaustralia_intertidal_ta_int_10m
648+
missing_value : 255
649+
minimum_value : 0
650+
maximum_value : 254
651+
scale_factor : 1
652+
offset_value : 0
653+
resampling : "bilinear"
654+
resolution : 10
655+
band_name : "ta_offset_high"
656+
data_type : "INT1U"
657+
TA-OFFSET-LOW :
658+
<<: *deaustralia_intertidal_ta_int_10m
659+
band_name : "ta_offset_low"
660+
TA-SPREAD :
661+
<<: *deaustralia_intertidal_ta_int_10m
662+
band_name : "ta_spread"
663+
QA-NDWI-CORR :
664+
<<: *deaustralia_intertidal_ta_10m
665+
band_name : "qa_ndwi_corr"
666+
QA-NDWI-FREQ :
667+
<<: *deaustralia_intertidal_ta_int_10m
668+
band_name : "qa_ndwi_freq"
669+
satellite : "LANDSAT-SENTINEL"
622670
sensor : "INTERTIDAL"
623671
collection_name : "ga_s2ls_intertidal_cyear_3"
624672
access_vars :
@@ -629,4 +677,4 @@ sources:
629677
open_data_token : false
630678
metadata_search : "tile"
631679
ext_tolerance : 0
632-
grid_system : "WRS-2"
680+
grid_system : ""

tests/testthat/test-cube-deaustralia.R

+38
Original file line numberDiff line numberDiff line change
@@ -479,3 +479,41 @@ test_that("Creating GA_LS_FC_3 cubes from DEAustralia", {
479479
cube_nrows <- .tile_nrows(landsat_cube)
480480
expect_true(.raster_nrows(r_obj) == cube_nrows)
481481
})
482+
483+
test_that("Creating GA_S2LS_INTERTIDAL_CYEAR_3 cubes from DEAustralia", {
484+
intertidal_cube <- .try(
485+
{
486+
sits_cube(
487+
source = "DEAUSTRALIA",
488+
collection = "GA_S2LS_INTERTIDAL_CYEAR_3",
489+
bands = c("ELEVATION", "EXPOSURE"),
490+
roi = c(
491+
lon_min = 137.15991,
492+
lon_max = 138.18467,
493+
lat_min = -33.85777,
494+
lat_max = -32.56690
495+
),
496+
start_date = "2016-01-01",
497+
end_date = "2019-06-01",
498+
progress = FALSE
499+
)
500+
},
501+
.default = NULL
502+
)
503+
504+
testthat::skip_if(purrr::is_null(intertidal_cube),
505+
message = "DEAustralia is not accessible"
506+
)
507+
508+
expect_true(all(sits_bands(intertidal_cube) %in% c(
509+
"ELEVATION", "EXPOSURE"
510+
)))
511+
expect_equal(nrow(intertidal_cube), 14)
512+
bbox_cube <- sits_bbox(intertidal_cube, as_crs = "EPSG:4326")
513+
bbox_cube_1 <- sits_bbox(.tile(intertidal_cube), as_crs = "EPSG:4326")
514+
expect_true(bbox_cube["xmax"] >= bbox_cube_1["xmax"])
515+
expect_true(bbox_cube["ymax"] >= bbox_cube_1["ymax"])
516+
r_obj <- .raster_open_rast(intertidal_cube$file_info[[1]]$path[1])
517+
cube_nrows <- .tile_nrows(intertidal_cube)
518+
expect_true(.raster_nrows(r_obj) == cube_nrows)
519+
})

0 commit comments

Comments
 (0)