package ‘landsat’ - the comprehensive r archive network · package ‘landsat’ february 20,...

30
Package ‘landsat’ February 20, 2015 Type Package Title Radiometric and topographic correction of satellite imagery Version 1.0.8 Date 2012-10-19 Author Sarah Goslee Maintainer Sarah Goslee <[email protected]> Depends R (>= 2.15.0), rgdal, sp (>= 1.0) Imports lmodel2, mgcv Description Processing of Landsat or other multispectral satellite imagery. Includes relative normalization, image-based radiometric correction, and topographic correction options. License GPL (>= 2) LazyLoad yes Repository CRAN Date/Publication 2012-10-22 16:44:46 NeedsCompilation no R topics documented: BSL ............................................. 2 clouds ............................................ 3 ddate ............................................. 4 dem ............................................. 5 DOS ............................................. 6 ESdist ............................................ 7 georef ............................................ 8 geoshift ........................................... 10 histmatch .......................................... 11 july ............................................. 12 lssub ............................................. 13 minnaert ........................................... 14 1

Upload: hatu

Post on 02-Feb-2019

222 views

Category:

Documents


0 download

TRANSCRIPT

Package ‘landsat’February 20, 2015

Type Package

Title Radiometric and topographic correction of satellite imagery

Version 1.0.8

Date 2012-10-19

Author Sarah Goslee

Maintainer Sarah Goslee <[email protected]>

Depends R (>= 2.15.0), rgdal, sp (>= 1.0)

Imports lmodel2, mgcv

Description Processing of Landsat or other multispectral satelliteimagery. Includes relative normalization, image-basedradiometric correction, and topographic correction options.

License GPL (>= 2)

LazyLoad yes

Repository CRAN

Date/Publication 2012-10-22 16:44:46

NeedsCompilation no

R topics documented:BSL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2clouds . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3ddate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4dem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5DOS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6ESdist . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7georef . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8geoshift . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10histmatch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11july . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12lssub . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13minnaert . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

1

2 BSL

movingwindow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16nov . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17PIF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18radiocorr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19RCS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21relnorm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22slopeasp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24tasscap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25thermalband . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26topocorr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27

Index 29

BSL Bare Soil Line

Description

Finds Bare Soil Line (BSL) and maximum vegetation point.

Usage

BSL(band3, band4, method = "quantile", ulimit = 0.99, llimit = 0.005)

Arguments

band3 File name or image file (matrix, data frame, or SpatialGridDataFrame) for Land-sat band 3 DN (red).

band4 File name or image file (matrix, data frame, or SpatialGridDataFrame) for Land-sat band 4 DN (NIR).

method Either "quantile" or "minimum" – describes way in which soil line is identified.

ulimit Upper limit for quantile of band ratios (ulimit < 1)

llimit Lower limit for quantile of band ratios (llimit > 0)

Details

Finding the BSL requires identifying the lowest NIR values for each level of red. The quantilemethod takes the lowest set of points, those with a NIR/red ratio less than the llimit-th quantile. Theminimum value method takes the lowest NIR value for each level of red. However they are found,these points with low NIR for their red values are used in a major axis regression to find the BareSoil Line. This function also identifies the full canopy point (maximum vegetation), by using theulimit to identify the top points, with NIR/red ratio greater than the ulimit-th quantile, and with highNIR values. Red or NIR values of 255 (saturated sensor) are omitted when calculating the BSL.

Value

BSL Regression coefficients for the Bare Soil Line

top band 3 and band 4 values for the full canopy point

clouds 3

Author(s)

Sarah Goslee

References

Maas, S. J. & Rajan, N. 2010. Normalizing and converting image DC data using scatter plot match-ing. Remote Sensing 2:1644-1661.

Examples

data(nov3)data(nov4)nov.bsl <- BSL(nov3, nov4)plot(as.vector(as.matrix(nov3)), as.vector(as.matrix(nov4)))abline(nov.bsl$BSL, col="red")points(nov.bsl$top[1], nov.bsl$top[2], col="green", cex=2, pch=16)

clouds Create a cloud mask from Landsat bands 1 and 6.

Description

Uses Landsat band 1 and band 6 to identify clouds and create a cloud mask.

Usage

clouds(band1, band6, level = 0.0014, buffer=5)

Arguments

band1 File name or image file (matrix, data frame, or SpatialGridDataFrame) for Land-sat band 1.

band6 File name or image file (matrix, data frame, or SpatialGridDataFrame) for Land-sat band 6.

level Threshold level for cloud/noncloud decision. The default threshold is appropri-ate for reflectance and temperature values, and must be adjusted for use withDN.

buffer Pixel buffer size to expand around thresholded cloud areas.

Details

Clouds are reflective (high) in band 1 and cold (low) in band 6, so the ratio of the two bands is highover clouds. The ratio must be adjusted for data type, whether reflectance, radiance, or DN.

Value

Returns a cloud mask in the same format as band1. Clouds are 1; noncloud areas are NA. Cloudareas are expanded by buffer pixels to ensure that cloud edges are captured.

4 ddate

Author(s)

Sarah Goslee

References

This function is loosely based on: Martinuzzi, S., Gould, W.A., Ramos Gonzales, O.M. 2007.Creating Cloud-Free Landsat ETM+ Data Sets in Tropical Landscapes: Cloud and Cloud-ShadowRemoval. USDA Forest Service General Technical Report IITF-GTR-32.

Examples

data(july1)data(july61)july.cloud <- clouds(july1, july61)

par(mfrow=c(1,2))image(july1)image(july.cloud)

ddate Decimal Date

Description

Convert a vector containing year, month, day or individual year, month, day arguments into a deci-mal date in years.

Usage

ddate(year, month, day)

Arguments

year Either a numeric year OR a vector in the form of c(year, month, day). The latteroption is so that ddate() can be conveniently used with apply().

month If year is a single value, must contain the number of the month.

day If year is a single value, must contain the number of the day.

Details

ddate() will accept a vector with the three date components so that it can be conveniently used withapply() on a data frame containing columns for year, month and day.

Value

The decimal date in years.

dem 5

Author(s)

Sarah Goslee

Examples

ddate(2001, 5, 15)

dem Digital Elevation Model

Description

A 30-meter resolution elevation model in SpatialGridDataFrame format that matches the Landsatimages nov and july.

Usage

data(dem)

Details

Elevations are in meters.

Source

Digital Elevation Models for the United States are available from the United States Geologic Survey,http://www.usgs.gov

Examples

data(dem)dem.slopeasp <- slopeasp(dem)

par(mfrow=c(1,3))image(dem)image(dem.slopeasp$slope)image(dem.slopeasp$aspect)

6 DOS

DOS Dark Object Subtraction

Description

Calculates calibration value for the Dark Object Subtraction (DOS) method of radiometric correc-tion.

Usage

DOS(sat = 5, scattering.coef = c(-4, -2, -1, -0.7, -0.5), SHV, SHV.band, gain, offset, Grescale, Brescale, sunelev, edist, Esun = c(198.3, 179.6, 153.6, 103.1, 22, 8.34), blackadjust = 0.01)

Arguments

sat Landsat satellite platform: 5 for TM; 7 for ETM+.scattering.coef

Atmospheric scattering coefficient; defaults are from Chavez 1988.SHV Starting Haze ValueSHV.band Band from which the Starting Haze Value was obtained.gain Band-specific sensor gain. Require either gain and offset or Grescale and Brescale

to convert DN to radiance.offset Band-specific sensor offset. Require either gain and offset or Grescale and

Brescale to convert DN to radiance.Grescale Band-specific sensor $G_rescale$ (gain). Require either gain and offset or Grescale

and Brescale to convert DN to radiance.Brescale Band-specific sensor $B_rescale$ (bias). Require either gain and offset or Grescale

and Brescale to convert DN to radiance.sunelev Sun elevation in degreesedist Earth-Sun distance in AU.Esun Exo-atmospheric solar irradiance, as given by Chander et al. 2009 or others.blackadjust By default, implements 1% adjustment value to compensate for lack of perfectly

dark pixels.

Details

The Dark Object Subtraction method assumes that the darkest parts of an image (water, artificialstructures) should be black if not for the effects of atmospheric scatter. Corrections to make itpossible to use the black value from one band to correct the remaining bands.

Value

DNfinal.mean The Dark Object Subtraction value for the complete set of scattering coefficients(Table X in Chavez 1989).

DNfinal.approx

The same table as DNfinal.mean, but using a numerical approximation acrossthe band wavelength instead of the mean wavelength.

ESdist 7

Author(s)

Sarah Goslee

References

Chavez, Jr., P. S. 1988. An improved dark-object subtraction technique for atmospheric scatteringcorrection of multispectral data. Remote Sensing of Environment 24:459-479.

Chavez, Jr., P. S. 1989. Radiometric calibration of Landsat Thematic Mapper multispectral images.Photogrammetric Engineering and Remote Sensing 55: 1285-1294.

See Also

radiocorr

Examples

data(july1)data(july3)

# One approach to choosing a Starting Haze Value is to take the lowest DN value# with a frequency greater than some predetermined threshold, in this case 1000 pixels.SHV <- table(july1@data[,1])SHV <- min(as.numeric(names(SHV)[SHV > 1000]))# this is used as Lhaze in the radiocorr function

# G_rescale, B_rescale, sun elevation comes from metadata for the SHV bandjuly.DOS <- DOS(sat=7, SHV=SHV, SHV.band=1, Grescale=0.77569, Brescale=-6.20000, sunelev=61.4, edist=ESdist("2002-07-20"))$DNfinal.mean

# DOS() returns results for the complete set of scattering coefficients# need to choose the appropriate one based on general atmospheric conditions### -4.0: Very Clear SHV <= 55### -2.0: Clear SHV 56-75### -1.0: Moderate SHV 76-95### -0.7: Hazy SHV 96-115### -0.5: Very Hazy SHV >115# for july, SHV == 70, so use -2.0: Clearjuly.DOS <- july.DOS[ , 2]

# Use DOS value as Lhaze in radiocorr() for DOS correction to reflectancejuly3.DOSrefl <- radiocorr(july3, Grescale=0.77569, Brescale=-6.20000, sunelev=61.4, edist=ESdist("2002-07-20"), Esun=1533, Lhaze=july.DOS[3], method="DOS")

ESdist Earth-Sun distance for a given date.

Description

Calculates the estimated Earth-Sun distance in Astronomical Units (AU) for a given date.

8 georef

Usage

ESdist(adate)

Arguments

adate date in "YYYY-MM-DD" format

Value

Returns estimated Earth-Sun distance in AU.

Author(s)

Sarah Goslee

Examples

ESdist("2010-08-30")

georef Simple image-matching georeferencing function.

Description

Finds best fit between target image and tofix image by minimizing RMSE between the two. Thetofix image is moved one pixel at a time horizontally or vertically. Simple automated georeferencingis adequate for some image-processing tasks.

Usage

georef(target, tofix, maxdist = 1000, startx = 0, starty = 0)

Arguments

target A georeferenced base image; can be matrix, dataframe or SpatialGridDataFrame.

tofix The image to be georeferenced; can be matrix, dataframe or SpatialGridDataFrame.

maxdist The greatest distance to move the tofix image. If this is exceeded, the functionwill stop.

startx Shift the tofix image this many pixels in the x direction before beginning, toavoid local minimum.

starty Shift the tofix image this many pixels in the y direction before beginning, toavoid local minimum.

georef 9

Details

This function offers a simplistic approach to georeferencing using an iterative algorithm that at eachstep moves the tofix image one pixel in the direction that produces the greatest reduction in RMSE.When RMSE no longer decreases or maxdist is reached, the algorithm stops, assuming that the tofiximage now matches the reference target image. This algorithm can produce local minima. Resultsshould always be checked visually.

Note: this algorithm is only effective with images larger than the samples included with this pack-age. The July and November images are already georectified, but this function will show them asneeding considerable adjustment. Images of at least 1000x1000 pixels are necessary for adequateresults.

Value

shiftx The x-direction shift to get the best match (lowest RMSE).

shifty The y-direction shift to get the best match (lowest RMSE).

initrmse Initial RMSE between target and tofix images.

currrmse Lowest RMSE, after shiftx and shifty pixel adjustments. Will be 9999 if maxdistis exceeded.

Author(s)

Sarah Goslee

See Also

geoshift

Examples

# to use for georeferencingdata(nov3)data(july3)july.shift <- georef(nov3, july3, maxdist=50) # match july to novemberjuly3.corr <- geoshift(july3, padx=50, pady=50, july.shift$shiftx, july.shift$shifty)

# only need to run georef once for a particular date# use the same correction for all bandsdata(july4)july4.corr <- geoshift(july4, padx=50, pady=50, july.shift$shiftx, july.shift$shifty)

10 geoshift

geoshift Shift and pad an image

Description

Shifts an image vertically or horizontally and adds a padded border.

Usage

geoshift(mat, padx, pady, shiftx, shifty, nodata = NA)

Arguments

mat A matrix, data frame or SpatialGridDataFrame

padx Number of pixels to add as padding in the x direction on each side of the image(along the x-axis). Should be larger than the number of pixels to shift to avoiddata loss.

pady Number of pixels to add as padding in the y direction on each side of the image(along the y-axis). Should be larger than the number of pixels to shift to avoiddata loss.

shiftx Number of pixels to shift (positive or negative) in the x direction (along thex-axis).

shifty Number of pixels to shift (positive or negative) in the y direction (along they-axis).

nodata Value to use for missing data.

Details

This function can be used to correct spatially-referenced images that are off by a few pixels in thex or y directions. It does not warp an image, only slide it. Adding padding to the outside edgemakes it possible to match several images even if they are not stored with georeferecing infor-mation. geoshift() can be used in conjunction with georef() to automatically match up geospatialimages. Note: directions are relative to the image as displayed by the image() command, and notthe underlying matrix representation.

Value

Returns data in the same format as the function was given: matrix, data frame, or SpatialGrid-DataFrame.

Author(s)

Sarah Goslee

See Also

georef

histmatch 11

Examples

testmat <- matrix(1:9, 3, 3)geoshift(testmat, 5, 10, 0, 0)geoshift(testmat, 5, 10, 2, 2)

# to use for georeferencingdata(nov3)data(july3)july.shift <- georef(nov3, july3, maxdist=50) # match july to novemberjuly3.corr <- geoshift(july3, padx=50, pady=50, july.shift$shiftx, july.shift$shifty)

# only need to run georef once for a particular date# use the same correction for all bandsdata(july4)july4.corr <- geoshift(july4, padx=50, pady=50, july.shift$shiftx, july.shift$shifty)

histmatch Histogram matching of an image

Description

Force image x to match target image by matching their histograms.

Usage

histmatch(master, tofix, mask, minval = 0, maxval = 255, by = 1)

Arguments

master The target image, in SpatialGridDataFrame, data frame, matrix or vector format.

tofix The image to be normalized, in any format.

mask Areas to be omitted, if any, such as a cloud mask. Only NA values within themask will be used.

minval Lower bound of the possible range of values in target and tofix images.

maxval Upper bound of the possible range of values in target and tofix images.

by Step size to use in constructing histograms. Should be appropriate for minvaland maxval of the images.

Details

The histogram of the tofix image will be forced to match that of the target image.

12 july

Value

recode The transformation table used to match the histograms.

newimage The transformed image, in the same format in which tofix was provided.

Author(s)

Sarah Goslee

See Also

relnorm

Examples

## Not run:data(nov3)data(july3)par(mfrow=c(2,2))image(nov3)image(july3)

nov3.newR <- relnorm(master=july3, tofix=nov3)image(nov3.newR$newimage)

nov3.newH <- histmatch(master=july3, tofix=nov3)image(nov3.newH$newimage)

## End(Not run)

july Sample Landsat ETM+ data

Description

SpatialGridDataFrame containing a 300 x 300 pixel subset (1500 x 1500 m) of the Landsat ETM+image for path 15, row 32, obtained on 20 July 2002. Each band, including both thermal bands, iscontained in a separate file.

Usage

data(july1)

Format

Images are in SpatialGridDataFrame format. More information is available in the documentationfor the sp package.

lssub 13

Details

Date: 2002-07-20Satellite: Landsat ETM+ (7)Sun elevation: 61.4Sun azimuth: 125.8

——–band Grescale Brescale1 0.77569 -6.202 0.79569 -6.403 0.61922 -5.004 0.63725 -5.105 0.12573 -1.007 0.04373 -0.35

Source

Landsat images can be obtained from the United States Geological Survey at http://landsat.usgs.gov

References

The Landsat Data Users Handbook is available from the United States Geological Survey at http://landsathandbook.gsfc.nasa.gov/handbook.html

Examples

data(july3)image(july3)

lssub Subset a geotiff image.

Description

Uses GDAL tools to reproject (optional) and subset a geotiff given the center point and the desiredsize.

Usage

lssub(filename, outname, centerx, centery, centerepsg, widthx, widthy)

14 minnaert

Arguments

filename Filename (and path) to a geotiff image.

outname Filename (and path) for subset image.

centerx x coordinate of new center point.

centery y coordinate of new center point.

centerepsg Projection of the center point coordinates as 5-digit EPSG code. If missing,assume that point and geotiff have the same projection.

widthx Desired width of subset image.

widthy Desired height of subset image.

Details

The new image will be a subset of size (widthx, widthy) with center point (centerx, centery), withthe same pixel size. If the center point coordinates are in a different projection than the originalimage, they will be reprojected.

Value

The new image is exported as a geotiff. Nothing is returned within R.

Note

Requires gdalinfo and gdaltransform to be available to the operating system. Only known to workon linux. This function was written to speed processing of multiple files for a specific project, andmay be dropped in future releases of the landsat package. On my computer, lssub() is over an orderof magnitude faster than reading the image into R, subsetting it, and writing out the result.

Author(s)

Sarah Goslee

Examples

## Not run: lssub("/data/gis/testimage.tif", "/data/gis/subimage.tif", centerx = 260485, centery = 4527220, centerepsg = 26918, widthx = 50, widthy = 50)

minnaert Whole-image and pixel-based Minnaert topographic correction of re-mote sensing data.

Description

Adds several modified Minnaert corrections to the capabilities of topocorr().

Usage

minnaert(x, slope, aspect, sunelev, sunazimuth, na.value = NA, GRASS.aspect=FALSE, IL.epsilon=0.000001, slopeclass = c(1, 5, 10, 15, 20, 25, 30, 45), coverclass)

minnaert 15

Arguments

x Image to be corrected, in matrix, data frame, or SpatialGridDataFrame format.

slope Slope image of same size and resolution as x.

aspect Aspect image of same size and resolution as x.

sunelev Sun elevation in degrees.

sunazimuth Sun azimuth in degrees.

na.value Value to use for missing data.

GRASS.aspect Whether aspect is measured according to GRASS defaults (counterclockwisefrom east) or is measured clockwise from north. If GRASS.aspect=TRUE, as-pect is converted to clockwise from north before analysis.

IL.epsilon If IL == 0 (Illumination), some methods will give a topographically-correctedvalue of Inf due to division by zero. If desired, adding a small increment to zerovalues eliminates this.

slopeclass The classes into which the slope will be divided before calculating k separatelyfor each class.

coverclass If present, TRUE/FALSE vector indicating which pixels to use when calculatingk. This allows k to be determined separately for different cover classes.

Details

Calculates the Minnaert k coefficients for the whole image and for the individual slope classes.

Value

allcoef The Minnaert k for the entire image. This is the value used in topocorr() (thoughthe latter may have been truncated).

classcoef A data frame containing the slope class midpoints, number of pixels per class,and k for that class (for the desired cover class, if specified).

xout A topographically-corrected image in the same format as x.

xout A topographically-corrected image in the same format as x.

Author(s)

Sarah Goslee

References

Lu, D., Ge, H., He, S., Xu, A., Zhou, G., and Du, H. 2008. Pixel-based Minnaert correction methodfor reducing topographic effects on a Landsat 7 ETM+ image. Photogrammetric Engineering andRemote Sensing 74:1343-1350.

See Also

topocorr

16 movingwindow

Examples

# require slope and aspect for topographic correctiondata(dem)dem.slopeasp <- slopeasp(dem)

# use cosine method of topographic correctiondata(july4)july4.minpix <- minnaert(july4, dem.slopeasp$slope, dem.slopeasp$aspect, sunelev=61.4, sunazimuth=125.8, slopeclass=c(1, 5, 10, 15, 50))july4.minpix$classcoef # all coefficients

movingwindow Simple moving window function.

Description

Very simple function to apply a kernel to a matrix across a moving window.

Usage

movingwindow(x, kernel)

Arguments

x A matrix.

kernel The kernel to be applied to the matrix, for example a Sobel kernel.

Details

This function is used in the calculation of slope and aspect by slopeasp().

Value

Returns the transformed matrix.

Note

Should be rewritten in C for greater efficiency.

Author(s)

Sarah Goslee

See Also

slopeasp

nov 17

Examples

data(dem)dem.smoothed <- movingwindow(dem, matrix(c(1,1,1,1,0,1,1,1,1), 3, 3)/8)

par(mfrow=c(1,2))image(dem)image(dem.smoothed)

nov Sample Landsat ETM+ data

Description

SpatialGridDataFrame containing a 300 x 300 pixel subset (1500 x 1500 m) of the Landsat ETM+image for path 15, row 32, obtained on 25 November 2002. Each band, including both thermalbands, is contained in a separate file.

Usage

data(nov1)

Format

Images are in SpatialGridDataFrame format. More information is available in the documentationfor the sp package.

Details

Date: 2002-11-25Satellite: Landsat ETM+ (7)Sun elevation: 26.2Sun azimuth: 159.5

——–

band Grescale Brescale1 0.77569 -6.202 0.79569 -6.403 0.61922 -5.004 0.63725 -5.105 0.12573 -1.007 0.04373 -0.35

Source

Landsat images can be obtained from the United States Geological Survey at http://landsat.usgs.gov

18 PIF

References

The Landsat Data Users Handbook is available from the United States Geological Survey at http://landsathandbook.gsfc.nasa.gov/handbook.html

Examples

data(nov3)image(nov3)

PIF Pseudo-Invariant Features

Description

Pseudo-invariant features identification for relative radiometric normalization.

Usage

PIF(band3, band4, band7, level = 0.99)

Arguments

band3 Landsat band 3, as a filename to be imported, a matrix, data frame, or Spatial-GridDataFrame.

band4 Landsat band 4, as a filename to be imported, a matrix, data frame, or Spatial-GridDataFrame.

band7 Landsat band 7, as a filename to be imported, a matrix, data frame, or Spatial-GridDataFrame.

level Threshold level for identifying PIFs. (0 < level < 1)

Details

Pseudo-invariant features (PIFs) are areas such as artificial structures that can reasonably be ex-pected to have a constant reflectance over time, rather than varying seasonally as vegetation does.Differences in PIF reflectance between dates can be assumed to be due to varying atmosphericconditions.

Value

Returns a PIF mask in the same format as the input files, with 1 for pseudo-invariant features and 0for background data.

Author(s)

Sarah Goslee

radiocorr 19

References

Schott, J. R.; Salvaggio, C. & Volchok, W. J. 1988. Radiometric scene normalization using pseu-doinvariant features. Remote Sensing of Environment 26:1-16.

See Also

RCS

Examples

# identify pseudo-invariant featuredata(july3)data(july4)data(july7)july.pif <- PIF(july3, july4, july7)

# use PIFs to related nov to july Landsat data for band 3# properly, would also remove cloudy areas firstdata(nov3)# use major axis regression: error in both x and ynov.correction <- lmodel2:::lmodel2(july3@data[july.pif@data[,1] == 1, 1] ~ nov3@data[july.pif@data[,1] == 1, 1])$regression.results[2, 2:3]nov3.corrected <- nov3nov3.corrected@data[,1] <- nov3@data[,1] * nov.correction[2] + nov.correction[1]

radiocorr Radiometric correction of Landsat data

Description

Implements several different methods for absolute radiometric correction of satellite data.

Usage

radiocorr(x, gain, offset, Grescale, Brescale, sunelev, satzenith = 0, edist, Esun, Lhaze, method = "apparentreflectance")

Arguments

x Image to be corrected, in matrix, data frame, or SpatialGridDataFrame format.

gain Band-specific sensor gain. Require either gain and offset or Grescale and Brescaleto convert DN to radiance.

offset Band-specific sensor offset. Require either gain and offset or Grescale andBrescale to convert DN to radiance.

Grescale Band-specific sensor Grescale (gain). Require either gain and offset or Grescaleand Brescale to convert DN to radiance.

Brescale Band-specific sensor Brescale (bias). Require either gain and offset or Grescaleand Brescale to convert DN to radiance.

20 radiocorr

sunelev Sun elevation in degrees

satzenith Satellite sensor zenith angle (0 for Landsat)

edist Earth-Sun distance in AU.

Esun Exo-atmospheric solar irradiance, as given by Chandler et al. 2009 or others.

Lhaze Haze value, such as SHV from DOS() function. Not needed for apparent re-flectance.

method Radiometric correction method to be used. There are currently four meth-ods available: "apparentreflectance", "DOS" (Chavez 1989), "COSTZ" (Chavez1996), "DOS4" (SWS+2001).

Details

Uses one of four image-based radiometric correction methods to adjust a satellite image to compen-sate for atmospheric conditions.

Value

Returns a radiometrically-corrected image in the same format as x.

Author(s)

Sarah Goslee

References

Chavez, Jr., P. S. 1989. Radiometric calibration of Landsat Thematic Mapper multispectral images.Photogrammetric Engineering and Remote Sensing 55:1285-1294.

Chavez, Jr., P. S. 1996. Image-based atmospheric corrections revisited and improved. Photogram-metric Engineering and Remote Sensing 62:1025-1036.

Song, C.; Woodcock, C. E.; Seto, K. C.; Lenney, M. P. & Macomber, S. A. 2001. Classification andchange detection using Landsat TM data: when and how to correct atmospheric effects? RemoteSensing of Environment 75:230-244.

See Also

DOS

Examples

data(july1)data(july3)

# One approach to choosing a Starting Haze Value is to take the lowest DN value# with a frequency greater than some predetermined threshold, in this case 1000 pixels.SHV <- table(july1@data[,1])SHV <- min(as.numeric(names(SHV)[SHV > 1000]))# this is used as Lhaze in the radiocorr function

RCS 21

# Grescale, Brescale, sun elevation comes from metadata for the SHV bandjuly.DOS <- DOS(sat=7, SHV=SHV, SHV.band=1, Grescale=0.77569, Brescale=-6.20000, sunelev=61.4, edist=ESdist("2002-07-20"))$DNfinal.mean

# DOS() returns results for the complete set of scattering coefficients# need to choose the appropriate one based on general atmospheric conditions### -4.0: Very Clear SHV <= 55### -2.0: Clear SHV 56-75### -1.0: Moderate SHV 76-95### -0.7: Hazy SHV 96-115### -0.5: Very Hazy SHV >115# for july, SHV == 70, so use -2.0: Clearjuly.DOS <- july.DOS[ , 2]

# Use DOS value as Lhaze in radiocorr() for DOS correction to reflectancejuly3.DOSrefl <- radiocorr(july3, Grescale=0.77569, Brescale=-6.20000, sunelev=61.4, edist=ESdist("2002-07-20"), Esun=1533, Lhaze=july.DOS[3], method="DOS")

RCS Radiometric Control Sets

Description

The Radiometric Control Sets method of relative radiometric correction for Landsat data.

Usage

RCS(data.tc, level = 0.01)

Arguments

data.tc The output of tasscap().

level Threshold level to use (0 < level < 1).

Details

Radiometric Control Sets (RCSs) are areas such as artificial structures and large bodies of water thatcan reasonably be expected to have a constant reflectance over time, rather than varying seasonallyas vegetation does. Differences in RCS reflectance between dates can be assumed to be due tovarying atmospheric conditions. Pixels with low greenness and either high or low brightness areidentified.

Value

Returns an RCS mask file in the format of the original data (vector, matrix, data frame or Spatial-GridDataFrame, as preseved by tasscap()) with 1 for RCS pixels and 0 for background.

22 relnorm

Author(s)

Sarah Goslee

References

Hall, F.; Strebel, D.; Nickeson, J. & Goetz, S. 1991. Radiometric rectification: toward a com-mon radiometric response among multidate, multisensor images. Remote Sensing of Environment35:11-27.

See Also

PIF, tasscap

Examples

# identify radiometric control setdata(july1)data(july2)data(july3)data(july4)data(july5)data(july7)july.tc <- tasscap("july", 7)july.rcs <- RCS(july.tc)

# use RCS to relate nov to july Landsat data for band 3# properly, would also remove cloudy areas firstdata(nov3)# use major axis regression: error in both x and ynov.correction <- lmodel2:::lmodel2(july3@data[july.rcs@data[,1] == 1, 1] ~ nov3@data[july.rcs@data[,1] == 1, 1])$regression.results[2, 2:3]nov3.corrected <- nov3nov3.corrected@data[,1] <- nov3@data[,1] * nov.correction[2] + nov.correction[1]

relnorm Relative normalization of an image

Description

Use regression methods to adjust distribution of values in image tofix to match those in the masterimage.

Usage

relnorm(master, tofix, mask, method = "MA", nperm = 1000)

relnorm 23

Arguments

master The target image, in SpatialGridDataFrame, data frame, matrix or vector format.

tofix The image to be normalized, in any format.

mask Areas to be omitted, if any, such as a cloud mask. Only NA values within themask will be used.

method Regression method to be used. OLS: Ordinary Least Squares; MA: Major Axis(recommended); SMA: Standard Major Axis.

nperm Number of permutations to use for significance testing.

Details

The regression coefficients from tofix ~ master will be used to match the distribution of values oftofix to those in the master image.

Valueregression.results

The regression results from lmodel2

newimage The transformed image, in the same format in which tofix was provided.

Author(s)

Sarah Goslee

See Also

histmatch

Examples

## Not run:data(nov3)data(july3)par(mfrow=c(2,2))image(nov3)image(july3)

nov3.newR <- relnorm(master=july3, tofix=nov3)image(nov3.newR$newimage)

nov3.newH <- histmatch(master=july3, tofix=nov3)image(nov3.newH$newimage)

## End(Not run)

24 slopeasp

slopeasp Calculate slope and aspect from elevation data.

Description

Uses gridded elevation data to calculate slope and aspect, by default using a 3x3 region.

Usage

slopeasp(x, EWres, NSres, EWkernel, NSkernel, smoothing=1)

Arguments

x gridded elevation data, either as a SpatialGridDataFrame, dataframe, or matrix.

EWres East-West grid resolution. May be omitted if x is a SpatialGridDataFrame.

NSres North-South grid resolution. May be omitted if x is a SpatialGridDataFrame.

EWkernel The kernel to use when calculating the East-West component of slope. If miss-ing, a 3x3 kernel will be used.

NSkernel The kernel to use when calculating the North-South component of slope. Ifmissing, a 3x3 kernel will be used.

smoothing A positive integer describing the additional smoothing to be applied, if any.smoothing=1 (default) means no smoothing will be used.

Details

By default, a 3x3 Sobel filter is used (as is standard in many GIS packages). A larger Sobel filteror a different filter will give varying results. This filter provides the third-order finite differenceweighted by reciprocal of distance method proposed by Unwin (1981).

Value

slope The slope of the DEM, in degrees

aspect The aspect of the DEM, beginning with north and moving clockwise, and withaspect = 0 where slope = 0.

Author(s)

Sarah Goslee

References

Unwin, D. 1981. Introductory Spatial Analysis. London: Methuen. Clarke, K.C.and Lee, S.J.2007. Spatial resolution and algorithm choice as modifiers of downslope flow computed fromDigital Elevation Models. Cartography and Geographic Information Science 34:215-230.

tasscap 25

See Also

movingwindow, topocorr

Examples

data(dem)dem.slopeasp <- slopeasp(dem)

par(mfrow=c(1,3))image(dem)image(dem.slopeasp$slope)image(dem.slopeasp$aspect)

tasscap Tasseled Cap for Landsat data

Description

Tasseled cap transformation for Landsat TM or ETM+

Usage

tasscap(basename, sat = 7)

Arguments

basename Base filename (string) to which band numbers are appended, eg "july" for filesnamed "july1", "july2", "july3", etc. Data should be at-sensor reflectance.

sat Landsat satellite platform: 5 for TM; 7 for ETM+.

Value

If the input files are matrices or data frames, returns a data frame with three columns, one for eachcomponent. If the input files are SpatialGridDataFrames, returns a list with one element for eachcomponent. In either case three components are returned: Brightness, Greenness, Wetness.

Author(s)

Sarah Goslee

References

Original papers: Crist, E. P. 1985. A TM tasseled cap equivalent transformation for reflectancefactor data. Remote Sensing of Environment 17:301-306.

Crist, E. & Kauth, R. 1986. The tasseled cap de-mystified. Photogrammetric Engineering andRemote Sensing 52:81-86.

Huang, C.; Wylie, B.; Yang, L.; Homer, C. & Zylstra, G. 2002. Derivation of a tasseled captransformation based on Landsat 7 at-satellite reflectance. International Journal of Remote Sensing23:1741-1748.

26 thermalband

Examples

data(july1)data(july2)data(july3)data(july4)data(july5)data(july7)july.tc <- tasscap("july", 7)

thermalband Thermal band to temperature conversion.

Description

Converts Landsat thermal band DN (TM or ETM+ band 6-1 and 6-2) to temperature using defaultcoefficients from Chander et al. 2009.

Usage

thermalband(x, band)

Arguments

x Landsat band 6 Digital Number (DN) in matrix, data frame or SpatialGrid-DataFrame format.

band 6 for TM; 61 or 62 for the appropriate ETM+ bands. Any other value will fail.

Value

Returns a temperature image in the same format as x.

Author(s)

Sarah Goslee

References

Coefficients from Chander, G., Markham, B.L., Helder, D.L. 2009. Summary of current radiometriccalibration coefficients for Landsat MSS, TM, ETM+, and EO-1 ALI sensors. Remote Sensing ofEnvironment 113:893-903.

Examples

data(nov61)nov.temp1 <- thermalband(nov61, 61)image(nov.temp1)

topocorr 27

topocorr Topographic correction of remote sensing data.

Description

Implements several different methods for topographic correction of remote sensing data.

Usage

topocorr(x, slope, aspect, sunelev, sunazimuth, method = "cosine", na.value = NA, GRASS.aspect=FALSE, IL.epsilon=0.000001)

Arguments

x Image to be corrected, in matrix, data frame, or SpatialGridDataFrame format.

slope Slope image of same size and resolution as x.

aspect Aspect image of same size and resolution as x.

sunelev Sun elevation in degrees.

sunazimuth Sun azimuth in degrees.

method Topographic correction method to be used. There are currently eight methodsavailable: "cosine", "improvedcosine", "minnaert", "ccorrection" (first four fromRiano et al. 2003), "minslope" (Minnaert with slope correction, also from Rianoet al. 2003), "gamma" (from Richter et al. 2009), "SCS" (Gu and Gillespie 1998,Gao and Zhang 2009), "illumination" (uncorrected illumination).

na.value Value to use for missing data.

GRASS.aspect Whether aspect is measured according to GRASS defaults (counterclockwisefrom east) or is measured clockwise from north. If GRASS.aspect=TRUE, as-pect is converted to clockwise from north before analysis.

IL.epsilon If IL == 0 (Illumination), some methods will give a topographically-correctedvalue of Inf due to division by zero. If desired, adding a small increment to zerovalues eliminates this.

Details

Uses one of the available topographic correction methods to compensate for the effects of slope andaspect on reflectance from the land surface.

Value

Returns a topographically-corrected image in the same format as x.

Author(s)

Sarah Goslee

28 topocorr

References

Gao, Y. & Zhang, W. 2009. LULC classification and topographic correction of Landsat-7 ETM+imagery in the Yangjia River Watershed: the influence of DEM resolution. Sensors 9:1980-1995.

Gu, D. & Gillespie, A. 1998. Topographic normalization of Landsat TM images of forest based onsubpixel sun-canopy-sensor geometry. Remote Sensing of Environment 64:166-175.

Riano, D., Chuvieco, E., Salas, J. & Aguado, I. 2003. Assessment of different topographic cor-rections in Landsat-TM data for mapping vegetation types. IEEE Transactions on Geoscience andRemote Sensing 41:1056-1061.

Richter, R., Kellenberger, T. & Kaufmann, H. 2009. Comparison of topographic correction meth-ods. Remote Sensing 1:184-196.

See Also

slopeasp

Examples

# require slope and aspect for topographic correctiondata(dem)dem.slopeasp <- slopeasp(dem)

# use cosine method of topographic correctiondata(july3)july3.topo <- topocorr(july3, dem.slopeasp$slope, dem.slopeasp$aspect, sunelev=61.4, sunazimuth=125.8)

Index

∗Topic chronddate, 4ESdist, 7

∗Topic datasetsdem, 5july, 12nov, 17

∗Topic imagehistmatch, 11relnorm, 22

∗Topic spatialBSL, 2clouds, 3DOS, 6georef, 8geoshift, 10lssub, 13minnaert, 14PIF, 18radiocorr, 19RCS, 21slopeasp, 24tasscap, 25thermalband, 26topocorr, 27

∗Topic statshistmatch, 11movingwindow, 16relnorm, 22

∗Topic utilitiesddate, 4ESdist, 7georef, 8geoshift, 10lssub, 13

BSL, 2

clouds, 3

ddate, 4dem, 5DOS, 6, 20

ESdist, 7

georef, 8, 10geoshift, 9, 10

histmatch, 11, 23

july, 12july1 (july), 12july2 (july), 12july3 (july), 12july4 (july), 12july5 (july), 12july61 (july), 12july62 (july), 12july7 (july), 12

lssub, 13

minnaert, 14movingwindow, 16, 25

nov, 17nov1 (nov), 17nov2 (nov), 17nov3 (nov), 17nov4 (nov), 17nov5 (nov), 17nov61 (nov), 17nov62 (nov), 17nov7 (nov), 17

PIF, 18, 22

radiocorr, 7, 19RCS, 19, 21relnorm, 12, 22

29

30 INDEX

slopeasp, 16, 24, 28

tasscap, 22, 25thermalband, 26topocorr, 15, 25, 27