get_subdatasets: get_subdatasets

Description Usage Arguments Details Value Author(s) References Examples

View source: R/get_subdatasets.R

Description

Returns HDF4, HDF5, and NetCDF subdataset names for standardized files.

Usage

1
2
get_subdatasets(datasetname, names_only = TRUE, normalizePath = FALSE,
  verbose = FALSE)

Arguments

datasetname

Character. Input HDF4/5 or NetCDF file.

names_only

Logical. Return subdataset names only? Default=TRUE.

normalizePath

Logical. Normalize the file path? Default=FALSE.

verbose

Logical. Enable verbose execution? Default is FALSE.

Details

Currently, this only returns the subdataset names of HDF4, HDF5, and NetCDF files, assuming they follow the SUBDATASET_n_NAME convention. This can be used with gdal_translate to extract a single subdataset (or with gdal_translate(...,sd_index=n)

This function assumes the user has a working GDAL on their system. If the "gdalUtils_gdalPath" option has been set (usually by gdal_setInstallation), the GDAL found in that path will be used. If nothing is found, gdal_setInstallation will be executed to attempt to find a working GDAL.

Value

character vector of subdataset names that can be used in gdal_translate.

Author(s)

Jonathan A. Greenberg ([email protected]) and Matteo Mattiuzzi (wrapper) and Frank Warmerdam (GDAL lead developer).

References

http://www.gdal.org/gdalinfo.html

Examples

1
2
3
4
5
## Not run:  
hdf4_dataset <- system.file("external/test_modis.hdf", package="gdalUtils")
get_subdatasets(hdf4_dataset)

## End(Not run)

Example output

sh: 1: cannot create /dev/null: Permission denied
NULL
Warning messages:
1: In gdal_setInstallation() :
  No GDAL installation found. Please install 'gdal' before continuing:
	- www.gdal.org (no HDF4 support!)
	- www.trac.osgeo.org/osgeo4w/ (with HDF4 support RECOMMENDED)
	- www.fwtools.maptools.org (with HDF4 support)

2: In gdal_setInstallation() : If you think GDAL is installed, please run:
gdal_setInstallation(ignore.full_scan=FALSE)

gdalUtils documentation built on April 23, 2018, 9:04 a.m.