Jump to content

Model Builder's Guide Chapter 2

From SELESwiki
Revision as of 17:33, 13 September 2006 by Charles (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Input Data

Non-spatial Tabular Data

Non-spatial data files can be loaded into a model in the dynamic model configuration file. This data must be in text (ASCII) format, as a tab-separated set of columns. The first row of the file can optionally have column labels. By default, the first column is assumed to specify the row index (in which case the column indexing starts at 0 from the second column). Files can also be loaded as sequential rows (i.e. with the first row starting at index 0), in which case the column indexing starts at 0 from the first column.

Spatial GIS Data

Currently, the GIS data formats supported by SELES are GRASS, ARC grid ASCII, and ERDAS (with some support for ARC grid binary). These are all raster formats, where a raster is a rectangular grid of fixed size cells, and each cell has a single value. Most rasters are integer-valued, but some formats support floating-point values (e.g. ARC grid ASCII). Most GIS packages support output or input of raster information in one of these formats. The restriction in most cases to integer values does not limit models as one might initially suspect. To handle real values of any fixed precision, one must decide on the “unit” represented by a raster. The default unit is 1, but one could easily allow two decimal places by using a unit of 0.01. To use such values in a SELES model, they simply need to be divided by 100 when retrieved from the layer and multiplied when stored. For example, the number 12.34 would be stored as number 1234 in the raster. See the scenario reference for how one can scale real-valued rasters when loading. The only limitation to the range of data that can be stored in a raster is on the machine word size, which is four bytes for an integer in both Windows and Unix.

Most GIS systems support a variety of ancillary data associated with rasters. For the purposes of SELES, only the raster data and header (which contains raster dimensions and georeferencing information) are required. For use with GRASS binary data (compressed or uncompressed), SELES recognizes the directory structure of a GRASS database, in which raster information for a particular data set is stored in a set of directories with fixed names with the name of that data set. Raster files are usually named after the layer they represent and are stored in a subdirectory called “cell” while the header files are stored in a subdirectory called “cellhd” with the same name as their corresponding raster file. In SELES, the important file is the raster file. Thus, when opening GRASS GIS files, and when including GRASS GIS files in model scenarios, you must specify the raster file in the “cell” subdirectory. SELES will locate the associated header file from the raster file. The other formats supported all contain both header and raster information in a single file.

In addition to the raster and header files, GRASS rasters can also have an associated colour lookup table and legend. These optional files are respectively located in subdirectories called “colr” and “cats” in the data set directory (either a subfolder or a sibling folder), and must also have the same name as their associated raster. If there is no colour file, then SELES uses a built-in algorithm for creating colour displays of rasters. If a colour file is found, then SELES will use these colours for displaying a raster.

To ease manual creation and modification of colour files, we have generalized the GRASS colour file format. A colour lookup table file is basically a list of raster values followed by RBG (red, green, blue) colour triples. Each colour value in a triple is a number between 0 and 255. Thus, pure red is represented as 255:0:0, while dark purple may be represented by an even mix of red and blue as 180:0:180. The following colour specifications are supported by SELES, where index is a possible value in a raster and RGB is a colon separated colour triple. Punctuation must be provided as shown.

index: RBG - set the colour of index to RGB
index1-index2: RGB - set the colour of all values in the range [index1, index2] to RGB
index1: RGB1 index2:RGB2 - interpolate the colours from RGB1 to RGB2over the range [index1, index2]

If an index has more than one colour specified then the last colour given will be used. If an index has no colour specified, then the default of black will be used. A legend (category) file is simply a list of raster values followed by a colon followed by the textual description associated with that value:

Number: label - the value Number is associated with the given label.

Legends can be used to automatically define constants for use in a model and for text output. To be used in this way, labels should not contain spaces or punctuation. See the Dynamic Model Configuration section for how to load legends into a model to define sets of constants, and the SELES expression syntax for how to use legends for text output in files.

Go to...  Prev Chapter  Next Chapter  Guide Index