Changelog
Source:NEWS.md
landform 0.3.0
A thorough revision of the package. Please read the first two points: with the default settings, results differ from those of earlier versions.
Changes that affect results
- The TPI is now standardised, by default, over the whole raster (z-scores of the TPI), as in Weiss (2001) and Jenness (2006), to which the classification thresholds refer (
std = "global"). Earlier versions divided the TPI of each cell by the standard deviation of elevation in its own neighbourhood; this is still available withstd = "local". In nearly flat areas the local standardisation turns small irregularities of the DTM into large standardised values, so that plains may be classified as a mosaic of valleys and ridges; on perfectly flat areas it is undefined. - By default the focal cell is now excluded from the neighbourhood mean (
centre = FALSE), in line with the definition of TPI as the difference between a cell and its surroundings. With global standardisation this has no effect away from the edges. - Results of version 0.2 are reproduced exactly with
std = "local", centre = TRUE, apart from the two fixes below. - Fixed: cells with a standardised TPI exactly equal to 0.5 fell into no class (and were coded 0); they are now classified as Upper Slope, so that every cell gets exactly one class.
- Fixed: cells on the outer rim of the raster (and next to
NAcells), where slope cannot be computed, were left unclassified only when their TPI was close to zero, which biased the class frequencies. They are now consistently left unclassified. - Class areas are now computed with
terra::cellSize(), and are therefore correct also for longitude/latitude rasters.
Fixes
- Removed the argument
padfrom the internal calls toterra::focal(); it belongs toraster::focal()and is rejected by recent versions of terra (reported by Robert J. Hijmans). - Fixed the map colours not matching the legend when some classes were absent.
- An invalid
class.typenow gives an error instead of returningNULL.
New features
- Neighbourhoods can be square, circular or annular (
shape,inner), and sized in cells or in map units (units; metres for longitude/latitude). - Thresholds can be changed:
tpi.thr,lf.thr,slope.thr. - New function
tpi(), returning the raw or standardised TPI surface. - New function
class_layers(), returning one presence/absence layer per class. - New sample dataset,
malta_dtm(). - Input checks with informative error messages (window sizes,
ln > sn, single-layer input, thresholds, colours).
Changes to the returned value
-
landform()now returns an object of class"landform"withprint(),summary()andplot()methods, holding the classes as a single categoricalSpatRaster(classes, with class names and colours), the TPI and slope layers, the descriptive statistics (always computed; now also with mean elevation and slope per class), the input DTM and the settings. The list of per-class rasters returned by earlier versions (result$all,result$Valley, …) is replaced byresult$classesandclass_layers(result);result[["Descriptive Statistics"]]is replaced byresult$stats(orsummary(result)). - Class names now follow Jenness (2006) (e.g. “Midslope Ridges, Small Hills in Plains” instead of “Midslopes Ridges-Small Hills in Plains”).
Plots
- New colour palettes: an ordinal blue-to-brown palette for the Slope Position Classification, and hues grouped by landform family for the Landform Classification (both replace
rainbow()). Custom colours viacol. - The legend is placed outside the map by default, so that no data are hidden (
leg.posstill accepts the usual keywords). - Optional relief shading underneath the classes or the TPI: a slopeshade (
shade = "slope", slope in grey levels from white for flat terrain to black for the steepest slopes) or a hillshade (shade = "hill"), with the overlying layer drawn semi-transparently (alpha). - The bar plot of class areas is horizontal and labelled with class names.
-
plot(x, what = "tpi")maps the standardised TPI surface(s). -
plot = FALSEsuppresses plotting.