Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

getMeta

Extract bandwise information from ImageMetaData


Description

This is an accessor function to quickly access information stored in ImageMetaData, e.g. scale factor per band. Intended for use with imagery which was imported using stackMeta. Will return parameters using the actual band order in img.

Usage

getMeta(img, metaData, what)

Arguments

img

Raster* or character vector with band names.

metaData

ImageMetaData or path to meta data file.

what

Character. Parameter to extract. Either data descriptors, or conversion parameters (see Details for options)

Details

Possible metadata parameters (what argument):

Data descriptors

'FILES'
'QUANTITY'
'CATEGORY'
'NA_VALUE'
'SATURATE_VALUE'
'SCALE_FACTOR'
'DATA_TYPE'
'SPATIAL_RESOLUTION'

Conversion parameters

'CALRAD' Conversion parameters from DN to radiance
'CALBT' Conversion parameters from radiance to brightness temperature
'CALREF' Conversion parameters from DN to reflectance (Landsat 8 only)

Value

If what is one of c('CALRAD', 'CALBT', 'CALREF') a data.frame is returned with bands in rows (order corresponding to img band order). Otherwise a named numeric vector with the corresponding parameter is returned (layernames as names).

Examples

## Import example data
mtlFile  <- system.file("external/landsat/LT52240631988227CUB02_MTL.txt", package="RStoolbox")
meta <- readMeta(mtlFile)
lsat <- stackMeta(mtlFile)

## Get integer scale factors
getMeta(lsat, metaData = meta, what = "SCALE_FACTOR")

## Conversion factors for brightness temperature
getMeta("B6_dn", metaData = meta, what = "CALBT")

## Conversion factors to top-of-atmosphere radiance
## Band order not corresponding to metaData order
getMeta(lsat[[5:1]], metaData = meta, what = "CALRAD")

## Get integer scale factors
getMeta(lsat, metaData = meta, what = "SCALE_FACTOR")

## Get file basenames
getMeta(lsat, metaData = meta, what = "FILES")

RStoolbox

Tools for Remote Sensing Data Analysis

v0.2.6
GPL (>= 3)
Authors
Benjamin Leutner [cre, aut], Ned Horning [aut], Jakob Schwalb-Willmann [aut], Robert J. Hijmans [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.