Skip to content

Commit

Permalink
use groups; #659
Browse files Browse the repository at this point in the history
  • Loading branch information
edzer committed Jan 4, 2024
1 parent 1ee07b6 commit 065d57b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
9 changes: 5 additions & 4 deletions R/mdim.R
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ mdim_use_bounds = function(dims, x, bnds, center = TRUE) {
#' Read or write data using GDAL's multidimensional array API
#' @name mdim
#' @param filename name of the source or destination file or data source
#' @param variable name of the array to be read
#' @param variable name of the array to be read; if `"?"`, a list of array names is returned, with group name as list element names.
#' @param groups character vector with group sequence to be opened to find the named array (by default, the root group is opened)
#' @param options character; driver specific options regarding the opening (read_mdim) or creation (write_mdim) of the dataset
#' @param raster names of the raster variables (default: first two dimensions)
#' @param offset integer; offset for each dimension (pixels) of sub-array to read, defaults to 0 for each dimension(requires sf >= 1.0-9)
Expand All @@ -119,15 +120,15 @@ mdim_use_bounds = function(dims, x, bnds, center = TRUE) {
#' @param ... ignored
#' @seealso \link[sf]{gdal_utils}, in particular util \code{mdiminfo} to query properties of a file or data source containing arrays
#' @export
read_mdim = function(filename, variable = character(0), ..., options = character(0), raster = NULL,
offset = integer(0), count = integer(0), step = integer(0), proxy = FALSE,
read_mdim = function(filename, variable = character(0), ..., groups = character(0), options = character(0),
raster = NULL, offset = integer(0), count = integer(0), step = integer(0), proxy = FALSE,
debug = FALSE, bounds = TRUE, curvilinear = NA) {

if (proxy)
stop("proxy not yet implemented in read_mdim()")

stopifnot(is.character(filename), is.character(variable), is.character(options))
ret = gdal_read_mdim(filename, variable, options, rev(offset), rev(count), rev(step), proxy, debug)
ret = gdal_read_mdim(filename, variable, groups, options, rev(offset), rev(count), rev(step), proxy, debug)
ret = recreate_geometry(ret)
if (isTRUE(bounds) || is.character(bounds))
ret$dimensions = mdim_use_bounds(ret$dimensions, filename, bounds)
Expand Down
5 changes: 4 additions & 1 deletion man/mdim.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 065d57b

Please sign in to comment.