Generate a slope, aspect, or contour image or calculates beta angles from elevation data
Generates a slope, aspect or contour image or calculates beta angles from an input image containing elevation data. Four methods are available for slope aspect, and beta angle calculations. The contour image is created using a user-specified contour interval.
- IN
- Input image. The input image consisting of elevation data. Its data type may be either BYTE, INTEGER*2, INTEGER*4, or REAL*4. Window and/or band options may be specified.
- OUT
- Output image. The output image consisting of slope values. The output data type is BYTE.
- CALCMETH(ME)
- Calculation method. The four methods available for calculating slope values are described below.
Fig. 1: | Z1 | Z2 | Z3 | -----+----+----- | Z4 | Z5 | Z6 | -----+----+----- | Z7 | Z8 | Z9 | = ME: Mean. The mean vertical and horizontal slopes are calculated from either four or eight points surrounding Z5 (Fig. 1). From this, the percent slope is calculated. = MD: Maximum drop. Finds the greatest change down from Z5 using either four or eight surrounding points. When there is no maximum drop, i.e., either zero elevation difference or all surrounding pixels are higher, then a value of zero is assigned to the center pixel. = MA: Maximum difference. Finds the greatest change up or down from Z5 using either four or eight surrounding points. When there is no elevation difference, a value of 200 is assigned to the center pixel. = MI: Minimum difference. Finds the minimum change up or down from Z5 using either four or eight surrounding points. When there is no elevation difference, a value of 200 is assigned to the center pixel.
- NPOINTS(8)
- Number of points. The user selects the number of points to be used for computation around a point under study. Either four (Fig. 2) or eight (Fig. 3) surrounding points may be used.
| Z2 | -----+----+----- Fig. 2 Z4 | Z5 | Z6 -----+----+----- | Z8 | Fig. 3 | Z1 | Z2 | Z3 | -----+----+----- | Z4 | Z5 | Z6 | -----+----+---- | Z7 | Z8 | Z9 |
- LINEDIST(208.33)
- Distance between lines. Measured in the same units as the elevation data in the input image. (See User Note 3.)
- SAMPDIST(208.33)
- Distance between samples. Measured in the same units as the elevation data in the input image. (See User Note 3.)
- MASKVAL(0.0)
- Mask value. The value designating masked areas or bad data areas. Pixels with this value or surrounded by bad data points will not be considered in calculations. These pixels will be assigned a value of 255 in the output image. For the mean method, the neighboring pixels with a value of MASKVAL are replaced by the central pixel value when calculating a value to assign to the center pixel. For the other methods, the neighboring pixels with a value of MASKVAL are ignored.
- IN
- Input image. The input image consisting of elevation data. Its data type may be either BYTE, INTEGER*2, INTEGER*4, or REAL*4. Window and/or band options may be specified.
- OUT
- Output image. The output image consisting of aspect values. The output data type is BYTE.
- CALCMETH(ME)
- Calculation method. The four methods available for calculating aspect values are described below.
Fig. 1: | Z1 | Z2 | Z3 | Fig. 2: 0 -----+----+----- | | Z4 | Z5 | Z6 | 135--+--45 -----+----+----- | | Z7 | Z8 | Z9 | 90 = ME: Mean. The mean vertical and horizontal slopes are calculated from either four or eight or points surrounding Z5 (Fig. 1). From this, the percent aspect is calculated. = MD: Maximum drop. Finds the greatest change down from Z5 using either four or eight surrounding points. Aspect corresponds to the direction of the slope (Fig. 2). When there is no maximum drop, i.e., either zero elevation difference or all surrounding pixels are higher, then a value of zero is assigned to the center pixel. = MA: Maximum difference. Finds the greatest change up or down from Z5 using either four or eight surrounding points. Aspect corresponds to the direction of the slope (Fig. 2). When there is no elevation difference, a value of 200 is assigned to the center pixel. = MI: Minimum difference. Finds the minimum change up or down from Z5 using either four or eight surrounding points. Aspect corresponds to the direction of the slope (Fig. 2). When there is no elevation difference, a value of 200 is assigned to the center pixel.
- NPOINTS(8)
- Number of points. The user selects the number of points to be used for computation around a point under study. Either four (Fig. 3) or eight (Fig. 4) surrounding points may be used.
| Z2 | -----+----+----- Fig. 3 Z4 | Z5 | Z6 -----+----+----- | Z8 | Fig. 4 | Z1 | Z2 | Z3 | -----+----+----- | Z4 | Z5 | Z6 | -----+----+---- | Z7 | Z8 | Z9 |
- LINEDIST(208.33)
- Distance between lines. Measured in the same units as the elevation data in the input image. (See User Note 3.)
- SAMPDIST(208.33)
- Distance between samples. Measured in the same units as the elevation data in the input image. (See User Note 3.)
- MASKVAL(0.0)
- Mask value. The value designating masked areas or bad data areas. Pixels with this value or surrounded by bad data points will not be considered in calculations. These pixels will be assigned a value of 255 in the output image. For the mean method, the neighboring pixels with a value of MASKVAL are replaced by the central pixel value when calculating a value to assign to the center pixel. For the other methods, the neighboring pixels with a value of MASKVAL are ignored.
- IN
- Input image. The input image consisting of elevation data. Its data type may be either BYTE, INTEGER*2, INTEGER*4, or REAL*4. Window and/or band options may be specified.
- OUT
- Output image. The output image consisting of contour values. The output data type may be either BYTE or INTEGER*2.
- CONTINT(50.0)
- Contour interval. It is in the same units of measurement as the input elevation data. If the specified value is C, output values are computed from input elevations by the following relations:
INPUT ELEVATION OUTPUT VALUE ---------------- ------------ <= 0 0 0<... <= C 1 C<... <= 2C 2 2C<... <= 3C 3 . . (N-1)C<... <= NC N . . . . . .
- ODTYPE(BYTE)
- Output data type.
= BYTE : BYTE = I*2 : INTEGER*2When the output contour value exceeds the maximum valid number for the output data type, the output contour value is set to the maximum valid value for that data type.
- IN
- Input image. The input image consisting of elevation data. Its data type may be either BYTE, INTEGER*2, INTEGER*4, or REAL*4. Window and/or band options may be specified.
- OUT
- Output image. If the input is a multi-band image, the output is also a multi-band image with the same number of bands as the input image. A BYTE or REAL output image is generated containing values between 0 through 90. The BYTE output image rounds beta angles to the nearest degree. The REAL output image specifies beta angles in decimal degrees.
- SUNANG
- Elevation of sun. SUNANG specifies the elevation of the sun above the horizon. It is measured in degrees between 0 through 90 and is input as a REAL data type.
- AZIANG
- Azimuth angle. The azimuth angle of the sun, measured clockwise from the north in degrees.
- CALCMETH(ME)
- Calculation method. There are four methods available for calculating slope values. Each method uses a 3 x 3 window consisting of a center pixel and its eight neighboring pixels. Following are descriptions for the four methods.
Fig.1 | Z1 | Z2 | Z3 | Fig. 2 0 -----+----+----- | | Z4 | Z5 | Z6 | 270--+--90 -----+----+----- | | Z7 | Z8 | Z9 | 180 = ME: Mean Method. The mean vertical and hori- zontal slopes are figured from the eight points surrounding Z5 (Fig. 1). From this, the percent slope and aspect are calculated. = MD: Maximum Drop Method. Finds the greatest change down from Z5 using the eight sur- rounding points. Aspect corresponds to the direction of the slope (Fig. 2). When there is no maximum drop, i.e., either zero ele- vation difference or all surrounding ele- vation points are higher, then a value of zero is assigned to the center sample. = MA: Maximum Difference Method. Finds the greatest change up or down from Z5 using the eight surrounding points. Aspect corresponds to the direction of the slope (Fig. 2). When there is no elevation, difference, a value of 200 is assigned to the center sample. = MI: Minimum Difference Method. Finds the minimum change up or down from Z5 using the eight surrounding points. Aspect corresponds to the direction of slope (Fig. 2). When there is no elevation, difference a value of 200 is assigned to the center sample.When the 3 x 3 matrix extends beyond the image, different treatments are adopted for different methods. For MEAN method, all the points outside the image assume the value of the central point. For other methods, only those points within the image are used.
- LINEDIST(30.0)
- Distance between lines. Measured in the same units as the elevation data in the input image. (See User Note 3.)
- SAMPDIST(30.0)
- Distance between samples. Measured in the same units as the elevation data in the input image. (See User Note 3.)
- MASKVAL(0.0)
- Mask value. The value designating masked areas or bad data areas. Pixels with this value or surrounded by bad data points will not be considered in calculations. These pixels will be assigned a value of 255 in the output image. For the mean method, the neighboring pixels with a value of MASKVAL are replaced by the central pixel value when calculating a value to assign to the center pixel. For the other methods, the neighboring pixels with a value of MASKVAL are ignored.
- ODTYPE(R*4)
- Output data type. The data type of the output image(s).
= BYTE : BYTE = R*4 : REAL*4
Under subcommand -SLP, input image ELEV.DAT is used for calculating the mean slope with a line and sample distance of 30, and 8 neighboring points are used in the calculations. The mask value for the calculations is zero and the resulting output image is OUTIMG.DAT.
Input/output image names are the same as Example 1. Under subcommand -ASP, the aspect is computed using the maximum drop method with 4 neighboring points. The line and sample distances used are 60 and 30, respectively.
The input and output image names are the same as in Example 1. The contours are computed using a contour interval of 120. The output pixel value for an input pixel value (elevation) of 29,028 becomes: 29,028 / 120 = 242.
Input file INPUT.ONE is used for calculating beta angles by using the Mean Method. Since no window specifications or band specifications were given, the entire image is used. This process is performed for all bands associated with INPUT.ONE. The sun's elevation angle and the azimuth are both 45 degrees. A ground cell dimension of 30.0 x 30.0 is used as is mask value of zero. Image is output as OUT01.DAT.
The individual algorithm for each option and method is described below. All cases (except -CON) make use of a 3 x 3 matrix
-------+------+------- | Z1 | Z2 | Z3 | -------+------+------- | Z4 | Z5 | Z6 | -------+------+------- | Z7 | Z8 | Z9 | -------+------+-------with Z5 the pixel under study. (See User Note 4.)Subcommand -SLP or -ASP:
Generates a slope or an aspect image from an input image using one of four interpolation methods (mean, maximum drop, maximum difference and minimum difference). The user is also allowed to select the number of pixels used in the 3 x 3 window (4 or 8) and must specify the actual ground dimensions of the pixels in the input image. The user can optionally specify not to process pixels with certain values.
Mean:
The mean method finds the horizontal and vertical slopes by the following:
Case of NPOINTS=4 (Z2, Z6, Z8, Z4):
For the slope or percent slope, SLOPEHORI = (Z6 - Z4) / (2 * SAMPDIST) SLOPEVERT = (Z2 - Z8) / (2 * LINEDIST) Percent slope = SQRT((SLOPEHORI**2) + (SLOPEVERT**2)) * 100 For SLOPEVERT = 0, ASPECT = ATAN(SLOPEHORI / SLOPEVERT) * 57.2958 If (SLOPEVERT > 0), ASPECT = ASPECT + 180 If (SLOPEVERT < 0) and (SLOPEHORI > 0), ASPECT = ASPECT + 360 For SLOPEVERT = 0, If (SLOPEHORI < 0), ASPECT = 90 If (SLOPEHORI > 0), ASPECT = 270 If (SLOPEHORI = 0), ASPECT = 400Finally, ASPECT will be divided by 2 to allow it to be stored in a BYTE data type.Case of NPOINTS=8 (Z1, Z2, ..., Z9):
SLOPEHORI = (Z3 + Z6 + Z9 - Z1 - Z4 - Z7) / (6 * SAMPDIST) SLOPEVERT = (Z1 + Z2 + Z3 - Z7 - Z8 - Z9) / (6 * LINEDIST)The percent slope and aspect are computed similarly, as in the case of four neighboring points.Maximum drop:
The maximum drop method uses an array to store differences between the middle pixel and each of the four (or eight) surrounding pixels. The array is searched for the maximum positive difference (the maximum drop). The percent slope is then found by dividing the difference by the distance between the two pixels and multiplying it by 100. The distance between pixels for each matrix location is as follows, where LD represents LINEDIST and SD represents SAMPDIST:
SQRT(LD**2 + SD**2) LD SQRT(LD**2 + SD**2) SD - SD SQRT(LD**2 + SD**2) LD SQRT(LD**2 + SD**2)Aspect at each location in the matrix is then given by
180-ANG/2 0 ANG/2 135 - 45 90+ANG/2 90 90-ANG/2where ANG = ATAN(SAMPDIST/LINEDIST). When there is no maximum positive drop, i.e., either 0 elevation difference or all surrounding pixels are higher, a value of 200 is assigned to the center pixel.Searching order in the array for the maximum drop is
Z2, Z6, Z8, Z4, Z3, Z9, Z7, Z1If the number of points selected is 4, only the first four locations are searched.Maximum difference:
This method is similar to the maximum drop method, except that the difference array is scanned for the absolute value of the largest difference. The greatest change in elevation, either positive or negative from Z5, is chosen. When there is no elevation difference, a value of 200 is assigned to the center pixel. All other processing is the same as in the maximum drop method.
Minimum difference:
The minimum difference method also is similar to the maximum drop method, except that the difference array is scanned for the smallest absolute difference, giving the least change in elevation, either up or down from the center pixel Z5. When there is no elevation difference, a value of 200 is assigned to the center pixel. Other processing is the same as for the maximum drop method.
Subcommand -CON:
Generates a contour image from an input image based on a user-specified contour interval. The specified contour interval is used in renumbering the input image values to a unique output image value starting from zero.
For a contour interval C, output pixel values are computed by the following relations:
Input Elevation (E) Output Pixel Value E <= 0 0 0 < E <= C 1 C < E <= 2C 2 2C < E <= 3C 3 . . . . . . (N-1)C < E <= NC NSubcommand -BET:Calculates beta angles (i.e., the angle between the sun's rays and the pixel's surface) using one of four interpolation methods (mean, maximum drop, maximum difference, and minimum difference). All 8 pixels that surround the pixel under study are used in the calculations.
Mean:
The mean method finds the horizontal and vertical slopes by the following:
SLOPEHORI = (Z3 + Z6 + Z9 - Z1 - Z4 - Z7) / (6 * SAMPDIST) SLOPEVERT = (Z1 + Z2 + Z3 - Z7 - Z8 - Z9) / (6 * LINEDIST)Once the slopes are found it calculates the beta angle:
POWER = SQRT(1 / (SLOPEHORI**2 + SLOPEVERT**2 + 1)) SUNRAYS = (SUN_Z_AXIS - (SLOPEVERT * SUN_X_AXIS) - (SLOPEHORI * SUN_Y_AXIS)) BETA = NEAREST_INT(ABS(PI/2 - ACOS(POWER * SUNRAYS) * 57.2958Maximum drop:
The maximum drop method uses an array to store differences between the middle pixel and each of the eight surrounding pixels. It computes the slope by finding the greatest change down from Z5. Once the vertical and horizontal slope is found, the beta angle is computed as in the mean method. When there is no maximum drop, i.e., either zero elevation difference or all surrounding elevation points are higher, then a value of zero is assigned to the center pixel.
Maximum difference:
This method is similar to the maximum drop method, except that the difference array is scanned for the absolute value of the largest difference. The greatest change in elevation, either positive or negative from Z5, is chosen. When there is no elevation difference, a value of 200 is assigned to the center pixel. Once the vertical and horizontal slopes have been found, all other processing is the same as in the mean method.
Minimum difference:
The minimum difference method also is similar to the maximum drop method, except that the difference array is scanned for the smallest absolute difference, giving the least change in elevation, either up or down from the center pixel Z5. When there is no elevation difference, a value of 200 is assigned to the center pixel. Once the vertical and horizontal slopes have been found, other processing is the same as for the mean method.