Show/Hide Toolbars

CatchmentSIM Help

Navigation: Program Reference > Analysis > Raster Calculator

Raster Calculator Commands

Scroll Prev Top Next More

The Raster Calculator provides several additional commands introduced to improve the functionality of the Raster Calculator. Each of the additional functions are described below.  The commands undertake specific tasks using a range of supplied parameters.  These parameters (shown in red) may take the form of specific values or alternatively, user variables or project variables that contain data of an appropriate data type.  In addition to the functions listed below, almost all CSTalk Macro commands/procedures and variables can also be used with the Raster Calculator.

 

Project Variables

 

The following project variables relate to the Raster Calculator variable category.  They refer to variables that can be utilised within the raster calculator in order to effectively carry out operations on pixels within the DEM. The main use of these variables is to expedite the iteration through DEM pixels by referring to an individual row and column location.

 

These project variables must all be prefixed with %RasterCalculator.

 

Project Variable (%RASTERCALCULATOR.)

Description

Output Type

Units

Row[i]

Refers to the pixel at the given row integer

integer

 

Column[j]

Refers to the pixel at the given column integer

integer

 

 

LookupTable1(&Var,PATH.csv,Value,Col,Ans_Col)

 

The LookupTable1 command is used to assign values from a lookup table to a new array (&Var). Path.csv is the full path and file name of the lookup table (in CSV file format) and Value is the name of an existing raster grid layer or GIS layer attribute where values will be extracted. Each value will be read from the GIS/Grid layer and the program will look for an a corresponding value in the Col column of the CSV lookup table.  When the value is found, the program will extract the corresponding value from the Ans_col column and will assign this value to the &Var array.

 

Parameter

Description

Accepted Values / Data Type

&Var

Name of the variable array to which the lookup table values will be assigned

Decimal, integer or text

PATH.csv

Full path and filename of the lookup table (in CSV file format)

String

Value

Name of an existing raster grid layer or GIS layer attribute where values will be extracted and searched for in 'Col' column of lookup table

Decimal, integer or text

Col

Column in lookup table containing values corresponding to parameter values contained in 'Value' GIS attibute or grid layer

Integer

Ans_Col

Column in lookup table containing values to be written to '&Var'

Integer

 

Eg., LookupTable1(&A,C:\Bathurst_LU.csv,&ARI,1,2)

 

 

WriteValue(#Grid#,Value)

 

The WriteValue function is used to populate each pixel in a raster grid (#Grid#) with a Value. You must be sure that the Value data type and the grid cell type (decimal, integer or text) are compatible.

 

Parameter

Description

Accepted Values / Data Type

#Grid#

Name of raster grid to which Value is to be written. Please note Grid name must be enclosed in # # symbols

String

Value

The value (either numerical or text) to be written to the grid

Decimal, integer or text

 

Eg., WriteValue(#Rainfall_Intensity#,&RI)

 

Copy(&Var,Text,Index,Count)

 

The Copy command will copy one or more characters from a string to a new variable (&Var) based on a user-specified index. Text is a string containing one or more characters. This may be a string from an array or a raster grid layer. Index is the index of the first character that is to be extracted and Count is the number of characters that are to be extracted.

 

Parameter

Description

Accepted Values / Data Type

&Var

Name of the variable to which the requested characters will be copied to

String

Text

The string from which the characters will be extracted. This can be sourced from an array or a string grid layer.

String

Index

Index of the first character in the Text string that is to be extracted. For example in the string "Cat", the letter "a" would have an index of 2.

Integer

Count

The number of characters that are to be extracted. For example, if we were to extract 2 characters from the string "Cat", starting at index 2 we would end up with "at". "at would be written to the &Var variable

Integer

 

Eg., Copy(&HydG1,#Hyd_Group_Raw#,1,1)