Operations: Absolute value for raster coverage

Jump to: navigation, search
Main Page Arrow.png Operations
Absolute value for raster coverage
Absolute value operation

The operation absolute value for rasters can be used to remove negative values present in a raster coverage and replace them with their non-negative values. The output results of the operation for each pixel (x) in a raster coverage is the absolute value or modulus |x| of a real number x which is the non-negative value of x; meaning |x| or |-x| is x). A few examples:

  • The absolute value of 7 is 7 (|7| = 7)
  • The absolute value of -7 is 7 (|-7| = 7)
  • The absolute value of 0 is 0 (|0| = 0)

The absolute value for rasters operation can be applied to a raster coverage via ILWIS-Python editor or via ILWIS main window, Toolbar and the Operatins tab. The required Python syntax is:

name of the output raster coverage = ilwis.Engine.do(name of the operation, name of an input raster coverage or a number)

Example bellow, shows the Python syntax for deriving absolute values from a raster coverage; where the input raster coverage is myraster, abs is the internal name for this operation and absraster is the name of the output raster coverage.

absraster=ilwis.Engine.do('abs',“file:///C:/my director/myraster.mpr")

In general, the URL used in the Python syntax can be replaced with variable name generated by Python. For example: a raster coverage can be opened in Python Editor as variables:

rc = ilwis.FeatureCoverage("file:///C:/my director/myraster.mpr")

Once the variable is created via ILWIS-Python editor, then it can be used directly without quotation mark and the URL as the following:

absraster=ilwis.Engine.do('abs', rc)

Figure 1, Absolute value for raster coverage operation form

To start the Absolute value for rasters operation from ILWIS main window:

  • Click the Operation tab on toolbar tabs
  • From the opened operation list select Absolute value for the rasters

Once the Absolute value for rasters operation is selected from the list, an operation form will be opened in which users can set parameters required for the operation including input(s), output(s), memory location and data format (Figure 1).
To successfully execute this operation, you need to complete the form with proper inputs data. The inputs data must be dragged from the catalog and dropped in their corresponding fields in the form or directly typed in.

Absolute value for the rasters

Input value: Type a number or enter a raster coverage using drag and drop or manually type in the name of the map. Note, in order to generate an output raster coverage, the inputs has to be a raster coverage.
Output name: Type a name for the output raster coverage.
Output format: Select a format from the list to save the output raster map. The default format is Memory; if you select it, the output will be temporally saved in the internal catalog and will be removed when you exit the program. If you select other format, the output will be saved in the active catalog.
Execute: Click the Execute button to run this operation.