ursa (version 3.8.8)

read_envi: Read ENVI .hdr Labelled Raster file to memory

Description

Reads all or several bands of ENVI .hdr Labelled Raster file from disk to memory.

Usage

read_envi(fname, ...)

Arguments

fname

Character. Filename for ENVI .hdr Labelled Raster file.

For read_envi: Set of argumetns, which are recognized via their names (using regular expressions) and classes. In the case of grids mismatch some arguments (e.g., resample) are passed to regrid function.

(subset)*

Name can be omitted. Integer or character. If integer, then indices of bands, either positive or negative. Positive indices are for included bands, negative indices for omitted bands. If character, then either sequence of band names or regex string. By default (subset=NULL), function reads all bands.

(ref)*

Name can be omitted. ursaRaster or ursaGrid object. Reference grid for raster image resizing. By default (ref=NULL) there is no resizing.

(nodata|ignorevalue)

Numeric. Value, which is ignored. By default (nodata=NaN) igrore value is taken from ENVI metadata (*.hdr or *.aux.xml).

reset(Grid)*

Logical. If TRUE, then session grid is ignored, and new session grid is assigned from input file. If FALSE, then input file is nested in the session grid.

cache

Integer. Using cache for compressed files. 0L - do not use cache, 1L - use cache; any other value resets cache. Default is FALSE.

verb(ose)*

Logical. Value TRUE may provide some additional information on console. Default is FALSE.

Value

Object of class ursaRaster.

Details

Function read_envi is designed to one-time reading (from disk to memory) ENVI .hdr Labelled Raster file. For multiple access to disk (by chunks), use followed construction:

a <- open_envi(fname)
d1 <- a[condition_1]
d2 <- a[condition_2]
...
close(a)

In this case, the connection keeps open. The gain is more effective for compressed binary files.

See Also

open_envi, Extract method [ for ursaRaster object, close_envi.

read_gdal uses GDAL (rgdal) to read ENVI .hdr Labelled Raster file.

Examples

Run this code
# NOT RUN {
session_grid(NULL)
fname <- tempfile()
a <- ursa_dummy()
bandname(a) <- c("first","second","third")
write_envi(a,fname,compress=FALSE)

print(read_envi(fname))
print(read_envi(fname,c(1,3)))
print(read_envi(fname,-c(1,3)))
print(read_envi(fname,c("first","third")))
print(read_envi(fname,"iR"))

print(session_grid())
g <- regrid(session_grid(),mul=1/2.3)
b <- read_envi(fname,ref=g)
print(session_grid())
print(b)

envi_remove(fname)
# }

Run the code above in your browser using DataLab