From 6338f5e8e156e3bd0f1e6f9c53bde4da45df3d39 Mon Sep 17 00:00:00 2001 From: Felipe Carlos Date: Wed, 12 Feb 2025 13:44:33 -0300 Subject: [PATCH 1/3] fix detect change docs --- R/api_detect_change.R | 53 ++++++++++++++++++++++++++++++++++++------- 1 file changed, 45 insertions(+), 8 deletions(-) diff --git a/R/api_detect_change.R b/R/api_detect_change.R index 242c2b41..084bca22 100644 --- a/R/api_detect_change.R +++ b/R/api_detect_change.R @@ -235,14 +235,29 @@ .detect_change_tile_prep <- function(dc_method, tile, ...) { UseMethod(".detect_change_tile_prep", dc_method) } -#' @rdname .detect_change_tile_prep +#' @title Pre-process tile to run detect_change method (default) +#' @name .detect_change_tile_prep.default +#' @keywords internal +#' @noRd +#' @param dc_method Detect change method +#' @param tile Single tile of a data cube. +#' @param ... Additional parameters +#' @param impute_fn Imputation function #' @export .detect_change_tile_prep.default <- function(dc_method, tile, ...) { return(NULL) } -#' @rdname .detect_change_tile_prep +#' @title Pre-process tile to run detect_change method (bayts) +#' @name .detect_change_tile_prep.bayts_model +#' @keywords internal +#' @noRd +#' @param dc_method Detect change method +#' @param tile Single tile of a data cube. +#' @param ... Additional parameters +#' @param impute_fn Imputation function #' @export -.detect_change_tile_prep.bayts_model <- function(dc_method, tile, ..., impute_fn) { +.detect_change_tile_prep.bayts_model <- + function(dc_method, tile, ..., impute_fn) { deseasonlize <- environment(dc_method)[["deseasonlize"]] if (!.has(deseasonlize)) { @@ -273,6 +288,14 @@ }) do.call(cbind, quantile_values) } +#' @title Pre-process tile to run detect_change method (bayts) +#' @name .detect_change_create_timeline +#' @keywords internal +#' @noRd +#' @param dc_method Detect change method +#' @param tile Single tile of a data cube. +#' @param ... Additional parameters +#' @param impute_fn Imputation function .detect_change_create_timeline <- function(tile) { # Get the number of dates in the timeline tile_tl <- .as_chr(.tile_timeline(tile)) @@ -282,7 +305,8 @@ ) tile_tl } - +#' @name .detect_change_as_polygon +#' @noRd .detect_change_as_polygon <- function(values, block, bbox) { # Create a template raster template_raster <- .raster_new_rast( @@ -306,7 +330,13 @@ # Return the segment object return(values) } - +#' @rdname .dc_samples +#' @title Retrieve samples available in a given detect change method. +#' @name .dc_samples +#' @keywords internal +#' @noRd +#' @param dc_method Detect change method +#' @return Samples available in the dc method. .dc_samples <- function(dc_method) { environment(dc_method)[["samples"]] } @@ -319,12 +349,14 @@ .dc_bands <- function(dc_method) { UseMethod(".dc_bands", dc_method) } -#' @rdname .dc_bands +#' @name .dc_bands.sits_model +#' @noRd #' @export .dc_bands.sits_model <- function(dc_method) { .samples_bands(.dc_samples(dc_method)) } -#' @rdname .dc_bands +#' @name .dc_bands.bayts_model +#' @noRd #' @export .dc_bands.bayts_model <- function(dc_method) { if (.has(.dc_samples(dc_method))) { @@ -334,7 +366,12 @@ stats <- unlist(lapply(stats, colnames)) return(unique(stats)) } - +#' @title Retrieve bands associated to detect_change method +#' @name .dc_class +#' @keywords internal +#' @noRd +#' @param dc_method Detect change method +#' @return Class of the model. .dc_class <- function(dc_method) { class(dc_method)[[1]] } From 6638da4bc5bceda96ec9a4b8b7516740167755af Mon Sep 17 00:00:00 2001 From: Felipe Carlos Date: Wed, 12 Feb 2025 14:03:34 -0300 Subject: [PATCH 2/3] fix docs and raster api call --- R/api_detect_change.R | 12 ------------ R/api_raster.R | 2 +- 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/R/api_detect_change.R b/R/api_detect_change.R index 084bca22..d915187e 100644 --- a/R/api_detect_change.R +++ b/R/api_detect_change.R @@ -235,26 +235,14 @@ .detect_change_tile_prep <- function(dc_method, tile, ...) { UseMethod(".detect_change_tile_prep", dc_method) } -#' @title Pre-process tile to run detect_change method (default) #' @name .detect_change_tile_prep.default -#' @keywords internal #' @noRd -#' @param dc_method Detect change method -#' @param tile Single tile of a data cube. -#' @param ... Additional parameters -#' @param impute_fn Imputation function #' @export .detect_change_tile_prep.default <- function(dc_method, tile, ...) { return(NULL) } -#' @title Pre-process tile to run detect_change method (bayts) #' @name .detect_change_tile_prep.bayts_model -#' @keywords internal #' @noRd -#' @param dc_method Detect change method -#' @param tile Single tile of a data cube. -#' @param ... Additional parameters -#' @param impute_fn Imputation function #' @export .detect_change_tile_prep.bayts_model <- function(dc_method, tile, ..., impute_fn) { diff --git a/R/api_raster.R b/R/api_raster.R index baf284ef..91d2fe94 100644 --- a/R/api_raster.R +++ b/R/api_raster.R @@ -429,7 +429,7 @@ .raster_check_block(block = block) } # create raster objects - r_obj <- .raster_open_rast.terra(file = path.expand(files), ...) + r_obj <- .raster_open_rast(file = path.expand(files), ...) # start read if (.has_not(block)) { From 7563c8bc6348533ad3e9faa9ce88a62f404b2e92 Mon Sep 17 00:00:00 2001 From: Felipe Carlos Date: Wed, 12 Feb 2025 14:16:55 -0300 Subject: [PATCH 3/3] update noRd docs --- R/api_detect_change.R | 4 ---- 1 file changed, 4 deletions(-) diff --git a/R/api_detect_change.R b/R/api_detect_change.R index d915187e..12e8d23b 100644 --- a/R/api_detect_change.R +++ b/R/api_detect_change.R @@ -235,13 +235,11 @@ .detect_change_tile_prep <- function(dc_method, tile, ...) { UseMethod(".detect_change_tile_prep", dc_method) } -#' @name .detect_change_tile_prep.default #' @noRd #' @export .detect_change_tile_prep.default <- function(dc_method, tile, ...) { return(NULL) } -#' @name .detect_change_tile_prep.bayts_model #' @noRd #' @export .detect_change_tile_prep.bayts_model <- @@ -337,13 +335,11 @@ .dc_bands <- function(dc_method) { UseMethod(".dc_bands", dc_method) } -#' @name .dc_bands.sits_model #' @noRd #' @export .dc_bands.sits_model <- function(dc_method) { .samples_bands(.dc_samples(dc_method)) } -#' @name .dc_bands.bayts_model #' @noRd #' @export .dc_bands.bayts_model <- function(dc_method) {