f2p.raster: Raster based flat-to-parameter function.

View source: R/shape.R

f2p.rasterR Documentation

Raster based flat-to-parameter function.

Description

Applies flat2parameter to each pixel in a raster to produce maps of disturbance parameters.

Usage

f2p.raster(years, folder.in, folder.out, OUTPUT.fn, flat.pred.fn, INPUT.bands,
layer.shape = 1, layer.dyr = 2, layer.dur = 5, layer.mag = 3)

Arguments

years

Vector of the years included in the time series data.

folder.in

Folder (full path) containing the input rasters.

folder.out

Folder where the output will be written.

OUTPUT.fn

Filename for output. The extension of this filename will specify the output file type. For image files, OUTPUT.fn should end in .img

flat.pred.fn

Filename of a single layer .img file of the disturbance agents. The agents are specified by the integers from 0 to 6.

0 Unclassified
1 Conversion
2 Fire
3 Harvest
4 Stable
5 Stress
6 Recovery
INPUT.bands

Filenames of the multi-layer .img files of the shapes to be used.

layer.shape

Number giving the layer of the shape files containing the shape data.

layer.dyr

Number giving the layer of the shape files containing the disturbance year data.

layer.dur

Number giving the layer of the shape files containing the disturbance duration data.

layer.mag

Number giving the layer of the shape files containing the disturbance magnitude data.

Details

The function writes a seven-layer raster with layers for disturbance agent, median disturbance year, median disturbance duration and magnitude of all image files given in INPUT.bands, in the order the filenames are listed in INPUT.bands.

The layers for shape, dyr and dur need to be the same in all files named in INPUT.bands. The default is layer.shape = 1, layer.dyr = 2, layer.dur = 5, and layer.mag = 3.

If, for example, INPUT.bands = c(b5.fn, fi.fn, nbr.fn, and ndvi.fn), then the layers of the output file are:

1 Disturbance Agent
2 Disturbance Year
3 Disturbance Duration
4 Magnitude B5
5 Magnitude FI
6 Magnitude NBR
7 Magnitude NDVI

Value

The function does not return a value. Instead, a multi-band .img map file is created.

Author(s)

Liz Freeman

See Also

flat2annual

Examples

## Not run: 
	# define years
	years <- c(1984, 1986:2010)

	# define a folder for all output
	folder.in <- paste(system.file(package = "ShapeSelectForest"), 
	"extdata", "helpexamples", sep = "/")
	folder.out <- getwd()	

	# define filenames
	flat.pred.fn <- "MINI_FLATPRED.img"
	b5.fn <- "MINI_B5.img"
	fi.fn <- "MINI_FI.img"
	nbr.fn <- "MINI_NBR.img"
	ndvi.fn <- "MINI_NDVI.img"
	INPUT.bands <- c(b5.fn, fi.fn, nbr.fn, ndvi.fn)

	# call f2p.raster
	ans <- f2p.raster(years = years, folder.in = folder.in, folder.out = folder.out, 
	OUTPUT.fn = "f2p_example.img", flat.pred.fn = flat.pred.fn, INPUT.bands = INPUT.bands)

## End(Not run)

ShapeSelectForest documentation built on Aug. 19, 2023, 5:11 p.m.