From 755918138fe81816e80b0a567edd0d4d9fe24c95 Mon Sep 17 00:00:00 2001 From: Chris Toney Date: Tue, 23 Jan 2024 19:29:32 -0700 Subject: [PATCH 1/3] fixup --- R/gdal_helpers.R | 26 +++++++++++++------------- R/gdalraster.R | 2 +- man/GDALRaster-class.Rd | 2 +- tests/testthat/test-GDALRaster-class.R | 14 +++++++------- 4 files changed, 22 insertions(+), 22 deletions(-) diff --git a/R/gdal_helpers.R b/R/gdal_helpers.R index ef73a2e9d..d24a147db 100644 --- a/R/gdal_helpers.R +++ b/R/gdal_helpers.R @@ -92,18 +92,18 @@ addFilesInZip <- function( quiet = FALSE) { if (as.integer(gdal_version()[2]) < 3070000) - stop("addFilesInZip() requires GDAL >= 3.7.", call. = FALSE) + stop("`addFilesInZip()` requires GDAL >= 3.7.", call. = FALSE) if (!is.character(zip_file) || length(zip_file) > 1) - stop("zip_file argument must be a string.", call. = FALSE) + stop("`zip_file` must be a string.", call. = FALSE) if (!is.character(add_files)) - stop("add_files must be a character vector of filenames.", + stop("`add_files` must be a character vector of filenames.", call. = FALSE) if (!is.null(overwrite)) { if (!is.logical(overwrite) || length(overwrite) > 1) - stop("overwrite must be an logical scalar.", call. = FALSE) + stop("`overwrite` must be a logical scalar.", call. = FALSE) } else { overwrite <- FALSE @@ -111,7 +111,7 @@ addFilesInZip <- function( if (!is.null(full_paths)) { if (!is.logical(full_paths) || length(full_paths) > 1) - stop("full_paths must be an logical scalar.", call. = FALSE) + stop("`full_paths` must be a logical scalar.", call. = FALSE) } else { full_paths <- FALSE @@ -119,7 +119,7 @@ addFilesInZip <- function( if (!is.null(quiet)) { if (!is.logical(quiet) || length(quiet) > 1) - stop("quiet must be an logical scalar.", call. = FALSE) + stop("`quiet` must be a logical scalar.", call. = FALSE) } else { quiet <- FALSE @@ -128,31 +128,31 @@ addFilesInZip <- function( opt <- NULL if (!is.null(sozip_enabled)) { if (!is.character(sozip_enabled) || length(sozip_enabled) > 1) - stop("sozip_enabled must be a string.", call. = FALSE) + stop("`sozip_enabled` must be a string.", call. = FALSE) sozip_enabled <- toupper(sozip_enabled) if ( !(sozip_enabled %in% c("AUTO", "YES", "NO")) ) - stop("sozip_enabled must be one of AUTO, YES or NO.", call. = FALSE) + stop("`sozip_enabled` must be one of AUTO, YES or NO.", call. = FALSE) else opt <- c(opt, paste0("SOZIP_ENABLED=", sozip_enabled)) } if (!is.null(sozip_chunk_size)) { if (length(sozip_chunk_size) > 1) - stop("sozip_chunk_size must be length-1.", call. = FALSE) + stop("`sozip_chunk_size` must be length-1.", call. = FALSE) opt <- c(opt, paste0("SOZIP_CHUNK_SIZE=", sozip_chunk_size)) } if (!is.null(sozip_min_file_size)) { if (length(sozip_min_file_size) > 1) - stop("sozip_min_file_size must be length-1.", call. = FALSE) + stop("`sozip_min_file_size` must be length-1.", call. = FALSE) opt <- c(opt, paste0("SOZIP_MIN_FILE_SIZE=", sozip_min_file_size)) } if (!is.null(num_threads)) { if (length(num_threads) > 1) - stop("num_threads must be length-1.", call. = FALSE) + stop("`num_threads` must be length-1.", call. = FALSE) opt <- c(opt, paste0("NUM_THREADS=", num_threads)) } if (!is.null(content_type)) { if (!is.character(content_type) || length(content_type) > 1) - stop("content_type must be a string.", call. = FALSE) + stop("`content_type` must be a string.", call. = FALSE) opt <- c(opt, paste0("CONTENT_TYPE=", content_type)) } @@ -225,7 +225,7 @@ addFilesInZip <- function( getCreationOptions <- function(format, filter=NULL) { if (!is.character(format) || length(format) > 1) - stop("format argument must be a string.", call.=FALSE) + stop("`format` must be a string.", call.=FALSE) if (is.null(filter)) filter = "_all_" diff --git a/R/gdalraster.R b/R/gdalraster.R index 01ec49431..bf2f62a72 100644 --- a/R/gdalraster.R +++ b/R/gdalraster.R @@ -410,7 +410,7 @@ #' #' \code{$clearStatistics()} #' Clear statistics. Only implemented for now in PAM supported datasets -#' (Peristable Auxiliary Metadata via .aux.xml file). GDAL >= 3.2. +#' (Persistable Auxiliary Metadata via .aux.xml file). GDAL >= 3.2. #' #' \code{$getHistogram(band, min, max, num_buckets, incl_out_of_range, #' approx_ok)}\cr diff --git a/man/GDALRaster-class.Rd b/man/GDALRaster-class.Rd index 47c1f6307..77c8c95aa 100644 --- a/man/GDALRaster-class.Rd +++ b/man/GDALRaster-class.Rd @@ -429,7 +429,7 @@ cannot be obtained quickly. \code{$clearStatistics()} Clear statistics. Only implemented for now in PAM supported datasets -(Peristable Auxiliary Metadata via .aux.xml file). GDAL >= 3.2. +(Persistable Auxiliary Metadata via .aux.xml file). GDAL >= 3.2. \code{$getHistogram(band, min, max, num_buckets, incl_out_of_range, approx_ok)}\cr diff --git a/tests/testthat/test-GDALRaster-class.R b/tests/testthat/test-GDALRaster-class.R index 40569cb05..095fcffe5 100644 --- a/tests/testthat/test-GDALRaster-class.R +++ b/tests/testthat/test-GDALRaster-class.R @@ -273,17 +273,17 @@ test_that("get/set band color interpretation works", { }) test_that("Int64 data type is detected", { - if (as.integer(gdal_version()[2]) >= 3050000) { - f <- system.file("extdata/int64.tif", package="gdalraster") - expect_warning(ds <- new(GDALRaster, f, TRUE)) - expect_equal(ds$getDataTypeName(1), "Int64") - ds$close() - } + skip_if(as.integer(gdal_version()[2]) < 3050000) + + f <- system.file("extdata/int64.tif", package="gdalraster") + expect_warning(ds <- new(GDALRaster, f, TRUE)) + expect_equal(ds$getDataTypeName(1), "Int64") + ds$close() }) test_that("get/set default RAT works", { evt_file <- system.file("extdata/storml_evt.tif", package="gdalraster") - f <- paste0(tempdir(), "/", "storml_evt_tmp.tif") + f <- tempfile(fileext=".tif") file.copy(evt_file, f) ds <- new(GDALRaster, f, read_only=FALSE) expect_true(is.null(ds$getDefaultRAT(band=1))) From 7ee48925025d51c059f3006767675c86b78d31b3 Mon Sep 17 00:00:00 2001 From: Chris Toney Date: Fri, 26 Jan 2024 14:58:59 -0700 Subject: [PATCH 2/3] add libxml2 in SystemRequirements --- DESCRIPTION | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 668db6e6f..acd15a294 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -56,9 +56,9 @@ Suggests: scales, testthat (>= 3.0.0) NeedsCompilation: yes -SystemRequirements: GDAL (>= 2.4.0), PROJ +SystemRequirements: GDAL (>= 2.4.0), PROJ, libxml2 Encoding: UTF-8 Roxygen: list(markdown = TRUE) -RoxygenNote: 7.3.0 +RoxygenNote: 7.3.1 VignetteBuilder: knitr Config/testthat/edition: 3 From 37b99ab6b0ca2217222052d13e17e01b175b0a5e Mon Sep 17 00:00:00 2001 From: Chris Toney Date: Fri, 26 Jan 2024 14:59:40 -0700 Subject: [PATCH 3/3] update url --- R/gdal_helpers.R | 3 ++- README.Rmd | 2 +- README.md | 3 ++- man/addFilesInZip.Rd | 3 ++- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/R/gdal_helpers.R b/R/gdal_helpers.R index d24a147db..435adccf9 100644 --- a/R/gdal_helpers.R +++ b/R/gdal_helpers.R @@ -15,7 +15,8 @@ #' @details #' A Seek-Optimized ZIP file (SOZip) contains one or more compressed files #' organized and annotated such that a SOZip-aware reader can perform very -#' fast random access within the .zip file (see \url{https://sozip.org/}). +#' fast random access within the .zip file +#' (see \url{https://github.com/sozip/sozip-spec}). #' Large compressed files can be accessed directly from SOZip without prior #' decompression. The .zip file is otherwise fully backward compatible. #' diff --git a/README.Rmd b/README.Rmd index c31c71c8e..f364dc0a9 100644 --- a/README.Rmd +++ b/README.Rmd @@ -34,7 +34,7 @@ Bindings to GDAL are implemented in the exposed C++ class [`GDALRaster`](https:/ * low-level I/O * read/set color tables and raster attribute tables * copy files/move/rename/delete datasets -* create/append to Seek-Optimized ZIP ([SOZip](https://sozip.org/)) +* create/append to Seek-Optimized ZIP ([SOZip](https://github.com/sozip/sozip-spec)) * virtual raster (VRT) for virtual cropping, resampling, kernel filtering, mosaicing * `gdalwarp` wrapper for reproject/resample/crop/mosaic * coordinate transformation diff --git a/README.md b/README.md index 71c6579fd..6373bd97d 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,8 @@ supporting: - low-level I/O - read/set color tables and raster attribute tables - copy files/move/rename/delete datasets - - create/append to Seek-Optimized ZIP ([SOZip](https://sozip.org/)) + - create/append to Seek-Optimized ZIP + ([SOZip](https://github.com/sozip/sozip-spec)) - virtual raster (VRT) for virtual cropping, resampling, kernel filtering, mosaicing - `gdalwarp` wrapper for reproject/resample/crop/mosaic diff --git a/man/addFilesInZip.Rd b/man/addFilesInZip.Rd index df4870c3e..6bb44deb5 100644 --- a/man/addFilesInZip.Rd +++ b/man/addFilesInZip.Rd @@ -70,7 +70,8 @@ in the GDAL \code{sozip} command-line utility \details{ A Seek-Optimized ZIP file (SOZip) contains one or more compressed files organized and annotated such that a SOZip-aware reader can perform very -fast random access within the .zip file (see \url{https://sozip.org/}). +fast random access within the .zip file +(see \url{https://github.com/sozip/sozip-spec}). Large compressed files can be accessed directly from SOZip without prior decompression. The .zip file is otherwise fully backward compatible.