|
920 | 920 | )
|
921 | 921 | # check extension
|
922 | 922 | if (!is.null(extensions)) {
|
923 |
| - .check_chr_within(ext_file(x), |
924 |
| - within = extensions, |
925 |
| - case_sensitive = FALSE, |
926 |
| - local_msg = local_msg, |
927 |
| - msg = .conf("messages", ".check_file_extension") |
928 |
| - ) |
| 923 | + extension <- ext_file(x) |
| 924 | + .check_that(extension %in% extensions, |
| 925 | + local_msg = local_msg) |
929 | 926 | }
|
930 | 927 | if (file_exists) {
|
931 | 928 | existing_files <- file.exists(x)
|
|
1166 | 1163 | #' @noRd
|
1167 | 1164 | .check_int_parameter <- function(x, min = -2^31 + 1, max = 2^31 - 1,
|
1168 | 1165 | len_min = 1, len_max = 2^31 - 1,
|
1169 |
| - is_odd = FALSE, |
| 1166 | + is_odd = FALSE, is_named = FALSE, |
1170 | 1167 | allow_null = FALSE, msg = NULL) {
|
1171 | 1168 | # check parameter name
|
1172 | 1169 | param <- deparse(substitute(x, environment()))
|
|
1181 | 1178 | len_min = len_min,
|
1182 | 1179 | len_max = len_max,
|
1183 | 1180 | is_integer = TRUE,
|
| 1181 | + is_named = is_named, |
1184 | 1182 | is_odd = is_odd,
|
1185 | 1183 | local_msg = local_msg,
|
1186 | 1184 | msg = msg
|
|
1785 | 1783 | .check_that(length(smoothness) == 1 || length(smoothness) == nlabels)
|
1786 | 1784 | return(invisible(smoothness))
|
1787 | 1785 | }
|
1788 |
| -#' @title Check that cube is regular |
1789 |
| -#' @name .check_is_regular |
1790 |
| -#' @keywords internal |
1791 |
| -#' @noRd |
1792 |
| -#' @param cube datacube |
1793 |
| -#' @return Called for side effects. |
1794 |
| -.check_is_regular <- function(cube) { |
1795 |
| - .check_set_caller(".check_is_regular") |
1796 |
| - is_regular <- TRUE |
1797 |
| - if (!.cube_is_complete(cube)) { |
1798 |
| - is_regular <- FALSE |
1799 |
| - } |
1800 |
| - if (!.cube_has_unique_bbox(cube)) { |
1801 |
| - is_regular <- FALSE |
1802 |
| - } |
1803 |
| - if (!.cube_has_unique_tile_size(cube)) { |
1804 |
| - is_regular <- FALSE |
1805 |
| - } |
1806 |
| - if (length(.cube_timeline(cube)) > 1) { |
1807 |
| - is_regular <- FALSE |
1808 |
| - } |
1809 |
| - .check_that(is_regular) |
1810 |
| - return(invisible(cube)) |
1811 |
| -} |
1812 | 1786 | #' @title Check if data contains predicted and reference values
|
1813 | 1787 | #' @name .check_pred_ref_match
|
1814 | 1788 | #' @param reference vector with reference labels
|
|
1924 | 1898 | .check_set_caller(".check_cube_bands")
|
1925 | 1899 | # all bands are upper case
|
1926 | 1900 | bands <- toupper(bands)
|
1927 |
| - cube_bands <- .cube_bands(cube = cube, add_cloud = add_cloud) |
| 1901 | + cube_bands <- toupper(.cube_bands(cube = cube, add_cloud = add_cloud)) |
1928 | 1902 | .check_that(all(bands %in% cube_bands))
|
1929 | 1903 | return(invisible(cube))
|
1930 | 1904 | }
|
|
2148 | 2122 | .check_endmembers_tbl <- function(em) {
|
2149 | 2123 | .check_set_caller(".check_endmembers_tbl")
|
2150 | 2124 | # Pre-condition
|
2151 |
| - .check_that(any(is.na(em))) |
| 2125 | + .check_that(!any(is.na(em))) |
2152 | 2126 | # Pre-condition
|
2153 | 2127 | .check_chr_contains(
|
2154 | 2128 | x = colnames(em),
|
|
2404 | 2378 | #' @noRd
|
2405 | 2379 | .check_filter_fn <- function(filter_fn){
|
2406 | 2380 | .check_set_caller(".check_filter_fn")
|
2407 |
| - name <- deparse(substitute(filter_fn)) |
2408 |
| - |
2409 |
| - .check_that(grepl("whittaker", name) || |
2410 |
| - grepl("sgolay"), name) |
| 2381 | + .check_that(is.function(filter_fn)) |
2411 | 2382 | }
|
2412 | 2383 | .check_dist_method <- function(dist_method){
|
2413 | 2384 | .check_set_caller(".check_dist_method")
|
|
0 commit comments