TERSETUP

Generate terrain derivatives


EnvironmentsPYTHON :: EASI :: MODELER
Quick linksDescription :: Parameters :: Parameter descriptions :: Details :: Example :: Related

Back to top

Description


Automatically calculates the slope, aspect, and skyview rasters from an input DEM, in preparation for atmospheric correction over rugged terrain. TERSETUP outputs a PCIDSK file that holds the DEM, slope, aspect, and skyview channels required by the ATCOR algorithm.
Back to top

Parameters


Name Type Caption Length Value range
FILEDEM * String Input DEM file name 1 - 192  
DBEC Integer Input elevation channel 0 - 1 1 -
Default: 1
TERFILE * String Output terrain derivatives file 1 - 192  
BACKELEV Float Background elevation value 0 - 1  
ELEVREF String Vertical reference for elevation values 0 - 6 MSL | ELLIPS
ELEVUNIT String Units for elevation values 0 - 7 METER | FEET | US_FEET
ELFACTOR Float Elevation offset and scale 0 - 2  

* Required parameter
Back to top

Parameter descriptions

FILEDEM

Specifies the name of the file that contains the digital elevation model (DEM). If a background elevation (BACKELEV) is specified, this value is used as the output No Data value.

If specified, the DBEC, BACKELEV, ELEVREF, ELEVUNIT, and ELFACTOR parameters are used to provide ancillary information about the input DEM. If the input DEM file contains metadata, the BACKELEV, ELEVREF, ELEVUNIT, and ELFACTOR parameters are read from the following elevation channel metadata tags:

DBEC

Specifies the channel that contains the input digital elevation model (DEM).

If FILEDEM specifies a single file but DBEC is not specified, the function uses the first channel of the input file.

TERFILE

Specifies the output file to receive the DEM, slope, aspect, and skyview for the reference scene.

BACKELEV

Optionally specifies the value that indicates which pixels are to be handled as No Data.

If this parameter is not specified, TERSETUP checks for a NO_DATA_VALUE metadata tag at the file level, then again at the channel level. If this value is not specified through the parameter or found in the metadata, all pixels of the DEM are assumed to be valid. All pixels with NO_DATA_VALUE in the input are assigned a NO_DATA_VALUE in the output.

ELEVREF

Optionally specifies the vertical reference for the elevation values.

Available options are:

If this parameter is not specified, the function searches for an ELEVATION_REF metadata tag at the file level, then again at the channel level. If this value is not specified through the parameter or found in the metadata, its value defaults to MSL.

ELEVUNIT

Optionally specifies the units used to describe the elevation values of the input DEM file.

Available units are:

If this parameter is not specified, the function searches for an ELEVATION_UNITS metadata tag at the file level, then again at the channel level. If this value is not specified through the parameter or found in the metadata, its value defaults to METER.

ELFACTOR

Optionally specifies the elevation offset and scale used by the DEM.

This parameter can specify two numbers: the first number defines the offset; the second optionally defines scale. The conversion formula is:

elevation_value = scale * (DEM_pixel_value + offset )

If this parameter is not specified, the function searches for ELEVATION_SCALE and ELEVATION_OFFSET metadata tags at the file level, then again at the channel level. If this value is not specified through the parameter or found in the metadata, the offset defaults to 0.0 and the scale defaults to 1.0. This assumes that there is no offset and that the scale is 1:1.

Back to top

Details

TERSETUP is part of the atmospheric correction workflow, and is required when atmospherically correcting satellite imagery captured over rugged terrain. TERSETUP computes the terrain derivatives (slope, aspect, skyview). Running this function allows users to inspect topographic rasters prior to performing atmospheric correction.

TERSETUP first checks the parameter values; if these are not provided, the function then searches for the required metadata tags at the file level, then at the channel level. If the parameter values are not explicitly specified and are not found in the metadata tags, the function uses the default values.

TERSETUP defines the extents of the output terrain derivatives file (TERFILE), based on the DEM. If the elevation reference (ELEVREF) is MSL, the function copies the DEM values to the output file. If the DEM values refer to the ellipsoid, TERRSETUP performs an on-the fly conversion to MSL. Finally, the function computes the slope, aspect, and skyview values for each valid pixel in the DEM, at the specified DEM resolution.

The DEM is used to derive the slope and aspect rasters from which the skyview rasters can be derived. These terrain rasters are used throughout the atmospheric correction process, but most importantly, it is part of the calculation for computing the solar illumination map and cast shadow bitmap in ILLUMCAST.

The sky view map defines the fraction of sky not obstructed by surrounding terrain or features in the local hemisphere of a pixel. Furthermore, the contribution of reflected terrain radiation is calculated as the complement of the sky view.

Back to top

Example

Create terrain setup for dem.pix.

EASI>FILEDEM	=	"dem.pix"	! input DEM file
EASI>DBEC	=	1	! input DEM channel
EASI>TERFILE	=	"tersetup.pix"	! output terrain image file
EASI>BACKELEV	=		! search for No Data value in metadata
EASI>ELEVREF	=		! default, Mean Sea Level
EASI>ELEVUNIT	=		! default, METER
EASI>ELFACTOR	=		! default, 0.0,1.0

EASI>run TERSETUP

© PCI Geomatics Enterprises, Inc.®, 2026. All rights reserved.