The Raster Calculator is a tool that allows raster grids to be created from any GIS attribute or other grid layer and used in conjunction with lookup tables to assign additional hydrologic parameters. The Curve Number Calculator is a specialised application of the Raster Calculator and uses existing soil and land use GIS layers with lookup tables to assign runoff curve numbers to each subcatchment.
The Raster Calculator uses the CSTalk macro language to perform the required calculations. However, a few additional functions that are not available in the CSTalk macro language have been added to provide additional functionality in the the Raster Calculator (e.g., use lookup tables). The additional Raster Calculator functions can be viewed here.
Examples of parameters and information that could be calculated using the Raster Calculator include:
•Subcatchment Manning's 'n' roughness values based on land use GIS layer;
•Tc, rainfall intensity and peak discharges using the probabilistic rational method;
•Green-Ampt infiltration parameters based on soil type and land use GIS layers;
•Estimating nutrient export loads for subcatchments based on land use GIS layer;
Please refer to the Raster Calculator Code Examples for practical applications of the Raster Calculator. If you wish to develop your own Raster Calculator script, it is recommended that you use one of the example scripts as a template. Alternatively, you can use the 'New Grid', 'Vector Attribute', 'Raster Attributes' and 'Functions' section of the Raster Calculator form to assist with the development of Raster Calculator script.
A detailed description of each component of the Raster Calculator is provided below
New Grid
The New Grid section of the form will prepare all of the code necessary for CatchmentSIM to create a new raster grid and assign null values to each grid cell. A grid name must be specified, however, be aware that no spaces are permitted in the name (use underscores if spaces are required. e.g., Rainfall_Intensity). The raster grid type must also be defined by selecting the 'Decimal', 'Integer' or 'Text' radio buttons. Once this information is entered, click the "Add" button. The Raster Calculator will automatically generate all required code and will insert this into the 'Setup Code' section of the Raster Calculator.
Vector Attribute
The Vector Attribute section of the Raster Calculator is used to reference a GIS layer attribute. This is typically used in conjunction with one of the available raster calculator functions. For example, you may wish to create a new raster layer with grid cells assigned a value based on a GIS layer attribute, or you may wish to create a raster layer based on a GIS layer attribute and a lookup table. To use the Vector Attribute facility, use the top drop down box to select a GIS layer (the GIS layer must already be loaded into the CatchmentSIM project using the View Controller) and use the other drop down box to select the GiS attribute. Click the "Add" button to add the required code to the 'Pixel Code' section of the Raster Calculator form.
Raster Attribute
The Vector Attribute section of the Raster Calculator is used to reference a raster grid or constant (i.e., flat and pit pixel) layer. This is typically used in conjunction with one of the available raster calculator functions. This would typically be used in conjunction with a lookup table to create a new raster grid. To use the Raster Attribute facility, select the desired grid layer from the drop down menu and click the "Add" button to create the required code in the 'Pixel Code' section of the Raster Calculator form. It should be noted that the grid layer that you wish to use must already be added to the CatchmentSIM project using the View Controller.
Functions
As discussed, the Raster Calculator uses a modified version of the CSTalk macro language. Accordingly, most of the CSTalk macro language commands, functions and variables can be used with the Raster Calculator. However, some additional commands were introduced specifically for the Raster Calculator to improve its overall functionality and usefulness. Detailed instructions on the more general CSTalk commands and variables can be found in the CSTalk Procedures and CSTalk Variables section of the help and details instructions on the additional Raster Calculator commands are included in the Raster Calculator Commands section.
Setup Code
The Setup Code section lists all Raster Calculator code that is performed only once during the raster calculation procedures. As a minimum, the Setup Code section will typically contain code related to the creation of new raster grids. It may optionally contain code that assigns values to variables, such as from lookup tables.
Pixel Code (repeat for each pixel)
The Pixel Code section lists all Raster Calculator code that is performed for each pixel in a raster grid. The Pixel Code section will typically contain code that is used to assign values to new raster grids that were created in the Setup Code section.