A subdataset is a collection abstraction for a number of variables within a single GDAL source. If there's only one variable the datasource and the variable have the same data source string. If there is more than one the subdatasets have the form DRIVER:"datasourcename":varname. Each subdataset name can stand in place of a data source name that has only one variable, so we always treat a source as a subdataset, even if there's only one.
vapour_sds_names(x)
a data source string, filename, database connection string, or other URL
character vector of subdataset names, or just the source itself if no SDS are present
Returns a character vector of 'subdatasets. In the case of a normal data source, with no subdatasets the value is simply the
datasource`.
If the raw SDS names contain spaces these are replaced by '%20' escape strings. A specific example is "WCS:https://elevation.nationalmap.gov:443" with request "arcgis/services/3DEPElevation/ImageServer/WCSServer?version=2.0.1&coverage=DEP3Elevation_Hillshade Gray". This function will return "..DEP3Elevation_Hillshade%20Gray". See wiki post for more details.
f <- system.file("extdata/gdal", "sds.nc", package = "vapour")
## protect from error with netcdf problems
result <- try(vapour_sds_names(f), silent = TRUE)
if (!inherits(result, "try-error")) {
print(result)
}
#> [1] "NETCDF:\"/Users/runner/work/_temp/Library/vapour/extdata/gdal/sds.nc\":vv"
#> [2] "NETCDF:\"/Users/runner/work/_temp/Library/vapour/extdata/gdal/sds.nc\":vv2"
vapour_sds_names(system.file("extdata", "sst.tif", package = "vapour"))
#> [1] "/Users/runner/work/_temp/Library/vapour/extdata/sst.tif"