Skip to content

r.shaded.pca

Creates relief shades from various directions and combines them into RGB composition.

The combined shades highlight terrain features which wouldn't be visible using standard shading technique.

r.shaded.pca input=string output=string [altitude=float] [nazimuths=integer] [zscale=float] [scale=float] [units=string] [shades_basename=string] [pca_shades_basename=string] [nprocs=integer] [--overwrite] [--verbose] [--quiet] [--qq] [--ui]

Example:

r.shaded.pca input=string output=string

grass.script.run_command("r.shaded.pca", input, output, altitude=30, nazimuths=8, zscale=1, scale=1, units=None, shades_basename=None, pca_shades_basename=None, nprocs=1, overwrite=False, verbose=False, quiet=False, superquiet=False)

Example:

gs.run_command("r.shaded.pca", input="string", output="string")

Parameters

input=string [required]
    Name of the input elevation raster map
output=string [required]
    Name for output PCA shaded relief map
altitude=float
    Altitude of the sun in degrees above the horizon
    Allowed values: 0-90
    Default: 30
nazimuths=integer
    The number of azimuths (suggested values are 4, 8, 16, 32)
    Default: 8
zscale=float
    Factor for exaggerating relief
    Default: 1
scale=float
    Azimuth of the sun in degrees to the east of north
    Default: 1
units=string
    Elevation units (overrides scale factor)
    Allowed values: intl, survey
    intl: international feet
    survey: survey feet
shades_basename=string
    Base name for output shades map
    A base of the name of shades maps for all azimuths. An underscore ('') and a azimuth will be added to the base name. When empty, no maps will be outputted (although they need to be generated).
pca_shades_basename=string
    Base name for output PCA shades map
    A base of the name of PCA shades maps. An underscore ('
') and a azimuth will be added to the base name. When empty, no maps will be outputted (although they need to be generated).
nprocs=integer
    Number of r.shade.relief processes to run in parallel
    Allowed values: 1-
    Default: 1
--overwrite
    Allow output files to overwrite existing files
--help
    Print usage summary
--verbose
    Verbose module output
--quiet
    Quiet module output
--qq
    Very quiet module output
--ui
    Force launching GUI dialog

input : str, required
    Name of the input elevation raster map
    Used as: input, raster
output : str, required
    Name for output PCA shaded relief map
    Used as: output, raster
altitude : float, optional
    Altitude of the sun in degrees above the horizon
    Allowed values: 0-90
    Default: 30
nazimuths : int, optional
    The number of azimuths (suggested values are 4, 8, 16, 32)
    Default: 8
zscale : float, optional
    Factor for exaggerating relief
    Default: 1
scale : float, optional
    Azimuth of the sun in degrees to the east of north
    Default: 1
units : str, optional
    Elevation units (overrides scale factor)
    Allowed values: intl, survey
    intl: international feet
    survey: survey feet
shades_basename : str, optional
    Base name for output shades map
    A base of the name of shades maps for all azimuths. An underscore ('') and a azimuth will be added to the base name. When empty, no maps will be outputted (although they need to be generated).
pca_shades_basename : str, optional
    Base name for output PCA shades map
    A base of the name of PCA shades maps. An underscore ('
') and a azimuth will be added to the base name. When empty, no maps will be outputted (although they need to be generated).
nprocs : int, optional
    Number of r.shade.relief processes to run in parallel
    Allowed values: 1-
    Default: 1
overwrite: bool, optional
    Allow output files to overwrite existing files
    Default: False
verbose: bool, optional
    Verbose module output
    Default: False
quiet: bool, optional
    Quiet module output
    Default: False
superquiet: bool, optional
    Very quiet module output
    Default: False

DESCRIPTION

r.shaded.pca is a tool for the generation of RGB composite of the three main components of PCA created from different hill shades (created by r.relief).

Input parameters explanation

Input parameters are the same as for r.relief module except for an azimuth parameter which is replaced by nazimuths parameter (we need to specify number of different azimuths rather than one) and for an nprocs parameter which adds the possibility to run the shades creation (r.relief) in parallel. However, the speed of i.pca limits the overall speed of this module. In order to provide simple interface, it is not possible to customize principal component analyses which uses the default settings of the i.pca module.

Output parameters explanation

The the standard output map is an RGB composition of first three principal components where components are assigned to red, green and blue colors in this order. If you want to create your own RGB composition, HIS composition or do another analyses you can specify the pca_shades_basename parameter. If this parameter is specified, the module outputs the PCA maps as created during the process by i.pca. Moreover, if you would like to add one of the shades to your composition, you can specify the shades_basename parameter then the module will output also the hill shade maps as created during the process by r.relief. One of the shades can be used to subtract the intensity channel in HIS composition or just as an overlay in your visualization tool.

EXAMPLE

# basic example with changed vertical exaggeration
r.shaded.pca input=elevation output=elevation_pca_shaded zscale=100

# example of more complicated settings
# including output shades and principal component maps
r.shaded.pca input=elevation output=elevation_pca_shaded \
 zscale=100 altitude=15  nazimuths=16 nprocs=4 \
 shades_basename=elevation_pca_shaded_shades pca_shades_basename=elevation_pca_shaded_pcs

image-alt

Figure: The RGB composition of first 3 PCA components (output from r.shaded.pca with default values)

SEE ALSO

r.relief, i.pca, r.local.relief, r.skyview

REFERENCES

Devereux, B. J., Amable, G. S., & Crow, P. P. (2008). Visualisation of LiDAR terrain models for archaeological feature detection. Antiquity, 82(316), 470-479.

AUTHOR

Vaclav Petras, NCSU OSGeoREL

SOURCE CODE

Available at: r.shaded.pca source code (history)
Latest change: Thursday Feb 20 13:02:26 2025 in commit 53de819