From bc5415c52aecbfd9a75f4b86fccf8abfaff6a460 Mon Sep 17 00:00:00 2001 From: Felipe Carlos Date: Fri, 19 Jul 2024 21:37:17 +0000 Subject: [PATCH] handle empty samples values from base_cube --- R/api_data.R | 8 +++++++- inst/extdata/sources/config_source_mpc.yml | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/R/api_data.R b/R/api_data.R index 962f4dd53..e0ffc01cf 100644 --- a/R/api_data.R +++ b/R/api_data.R @@ -101,12 +101,18 @@ base_tbl <- base_tbl |> dplyr::select("longitude", "latitude", "time_series") |> dplyr::rename("base_data" = "time_series") + # Assuming `ts_tbl` as the source of truth, the size of the following + # `join` must be the same as the current `ts_tbl`. + ts_tbl_size <- nrow(ts_tbl) # joining samples data from cube and base_cube by longitude / latitude ts_tbl <- dplyr::left_join( x = ts_tbl, y = base_tbl, by = c("longitude", "latitude") - ) + ) |> + tidyr::drop_na() + # checking samples consistency + .data_check(ts_tbl_size, nrow(ts_tbl)) # add base class class(ts_tbl) <- c("sits_base", class(ts_tbl)) } diff --git a/inst/extdata/sources/config_source_mpc.yml b/inst/extdata/sources/config_source_mpc.yml index 61db415df..32cc93594 100644 --- a/inst/extdata/sources/config_source_mpc.yml +++ b/inst/extdata/sources/config_source_mpc.yml @@ -128,7 +128,7 @@ sources: resolution : 30 data_type : "FLT4S" missing_value : -32768 - minimum_value : 0 + minimum_value : -32767 maximum_value : 65534 scale_factor : 1 offset_value : 0