read_vars.Rd
Read one or more variables from raster files
read_vars(vardef, expect.nvars = NULL, expect.vars = NULL, expect.dims = NULL, expect.extent = NULL, expect.ids = NULL, offset = NULL, count = NULL, as.data.frame = FALSE, extra_dims = NULL)
vardef | A variable definition, constructed
using the following syntax:
<filename>::<variables_or_bands>
where A limited amount of transformation can be specified by adding extra characters to the band number or variable name:
A complete example is:
In this example, band 1 is read from the file. NODATA values
are replaced with zero, and all values are negated. The values
are read into a variable called |
---|---|
expect.nvars | If specified, |
expect.vars | If specified, |
expect.dims | If specified, |
expect.extent | If specified, |
expect.ids | If specified, |
offset | Specifies dimension-wise (X, Y, ...) offsets
from the upper-left corner of the raster
(xmin, ymax) from which reading should begin.
A value of c(1,1) refers to the corner cell
itself (i.e., there is no offset). This
follows the convention of the |
count | Specifies dimension-wise (X, Y, ...) numbers of
cells to read, beginning at the origin cell
specified by |
as.data.frame | If |
extra_dims | list containing names and values of extra dimensions
along which a values at a single point should be extracted, e.g.
|
A list having the following structure:
a list of global attributes in the file
a list of matrices containing data for each variable in the file. Matrices are consistent with the "raster" package, with rows representing decreasing latitude and columns representing increasing longitude. Any netCDF attributes defined for the variables will be attached as attributes of the matrix.
the extent of the lat/lon coordinates for the data, in the order xmin, xmax, ymin, ymax. Will be null if the data is not gridded
a vector of integer ids for the data. Will be null if the data is gridded