topographic_corr: Topographically correct a raster

Description Usage Arguments Details Value References Examples

Description

Performs topographic correction using code based on topocorr from the landsat package by Sarah Goslee. The code in this package has been modifed from topocorr to allow using a subsample of the image for Minnaert k calculations, and to provide the option of running the topographic correction in parallel using foreach.

Usage

1
2
3
topographic_corr(x, slopeaspect, sunelev, sunazimuth,
  method = "minnaert_full", sampleindices = NULL, scale_factor = 1,
  asinteger = FALSE, DN_min = NULL, DN_max = NULL, ...)

Arguments

x

an image to correct

slopeaspect

a RasterBrick or RasterStack with two layers. The first layer should be the slope, the second layer should be the aspect. The slope and aspect are defined as in terrain in the raster package, and both should be in radians.

sunelev

sun elevation in degrees

sunazimuth

sun azimuth in degrees

method

the topographic correction method to use. See the help for topocorr for more guidance on this.

sampleindices

(optional) row-major indices of sample pixels to use in regression models used for some topographic correction methods (like Minnaert). Useful when handling very large images. See gridsample for one method of calculating these indices.

scale_factor

factor by which to multiply results. Useful if rounding results to integers (see asinteger argument).

asinteger

whether to round results to nearest integer. Can be used to save space by saving results as, for example, an 'INT2S' raster.

DN_min

minimum allowable pixel value after correction (values less than DN_min are set to NA)

DN_max

maximum allowable pixel value after correction (values less than DN_max are set to NA)

...

additional arguments to pass to minnaert_samp or topocorr_samp, depending on chosen topographic correction method

Details

This function will run in parallel if a parallel backend is registered with foreach.

Value

The topographically corrected image as a RasterLayer or RasterStack

References

Sarah Goslee. Analyzing Remote Sensing Data in R: The landsat Package. Journal of Statistical Software, 2011, 43:4, pg 1–25. http://www.jstatsoft.org/v43/i04/

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
## Not run: 
# Mosaic the two ASTER DEM tiles needed to a Landsat image
DEM_mosaic <- mosaic(ASTER_V002_EAST, ASTER_V002_WEST, fun='mean')

# Crop and extend the DEM mosaic to match the Landsat image
matched_DEM <- match_rasters(L5TSR_1986, DEM_mosaic)
slopeaspect <- terrain(matched_DEM, opt=c('slope', 'aspect')

# Apply the topographic correction
sunelev <- 90 - 44.97 # From metadata file
sunazimuth <- 124.37 # From metadata file
L5TSR_1986_topocorr <- topographic_corr(L5TSR_1986, slopeaspect, sunelev, 
                                        sunazimuth, method='minslope')

plotRGB(L5TSR_1986, stretch='lin', r=3, g=2, b=1)
plotRGB(L5TSR_1986_topocorr, stretch='lin', r=3, g=2, b=1)

## End(Not run)

azvoleff/teamlucc documentation built on May 11, 2019, 5:19 p.m.