loadImage: Load Landsat data from a folder

View source: R/water_RSfunctions.R

loadImageR Documentation

Load Landsat data from a folder

Description

Loads Landsat 7, 8 or 9 Level-1 bands (digital numbers), or MODIS bands, from a folder. Landsat file names can follow the Collection 1/2 naming (e.g. LC08_L1TP_232083_20160209_20200907_02_T1_B2.TIF, any tier) or the pre-Collection naming (e.g. LC82320832016040LGN00_band2.tif); Level-2 surface reflectance files are skipped (use loadImageSR()). If the folder holds more than one image, the first one is used, with a warning. For Landsat, the fill value (DN 0) is set to NA.

Usage

loadImage(path = getwd(), sat = "auto", aoi)

Arguments

path

folder where band files are stored

sat

"L7" for Landsat 7, "L8" for Landsat 8, "L9" for Landsat 9, "MODIS" for MODIS or "auto" to detect the Landsat satellite from the SPACECRAFT_ID of an MTL file in path or, failing that, from the Landsat file names

aoi

Optional area of interest (e.g. from createAoi()) to crop the image. If missing, the image is not cropped

Value

SpatRaster in digital numbers. Landsat 8/9: layers B, G, R, NIR, SWIR1, SWIR2, Thermal1 and Thermal2 (bands 2 to 7, 10 and 11). Landsat 7: B, G, R, NIR, SWIR1, SWIR2 and Thermal1 (bands 1 to 5, 7 and 6 low gain). MODIS: R, NIR, B, G, SWIR1, SWIR2, SWIR3 (reflectance), LST (K) and Time (hours).

Author(s)

Guillermo Federico Olmedo

David Fonseca-Luengo

References

R. G. Allen, M. Tasumi, and R. Trezza, "Satellite-based energy balance for mapping evapotranspiration with internalized calibration (METRIC) - Model" Journal of Irrigation and Drainage Engineering, vol. 133, p. 380, 2007

See Also

Other remote sensing support functions: calcRadiance(), calcSR(), calcTOAr(), cfmask(), loadImageSR()

Examples

# Landsat 8 Level-1 example bands (digital numbers)
image.DN <- loadImage(path = system.file("extdata", package = "water"), sat = "L8")
image.DN

water documentation built on Nov. 25, 2026, 5:08 p.m.