Download GRASS 4.2 Reference Manual Section VI
Transcript
Then the expression: result = @soils.ph * 10 would produce a result with category values 0, 14, 24, 35, 58, 72, 88 and 94. Note that this operator may only be applied to raster map layers and produces a floating point value in the expression. Also the category label must start with a valid number. Missing labels, or labels that do not start with a number will (silently) produce a 0 value for that category. GREY SCALE EQUIVALENTS AND COLOR SEPARATES It is often helpful to manipulate the colors assigned to map categories. This is particularly useful when the spectral properties of cells have meaning (as with imagery data), or when the map category values represent real quantities (as when category values reflect true elevation values). Map color manipulation can also aid visual recognition, and map printing. The # operator can be used to either convert map category values to their grey scale equivalents or to extract the red, green, or blue components of a raster map layer into separate raster map layers. result = #map converts each category value in map to a value in the range 0-255 which represents the grey scale level implied by the color for the category. If the map has a grey scale color table, then the grey level is what #map evaluates to. Otherwise, it is computed as: .18 * red + .81 * green + .01 * blue The # operator has three other forms: r#map, g#map, b#map. These extract the red, green, or blue components in the named raster map, respectively. The GRASS shell script blend.sh extracts each of these components from two raster map layers, and combines them by a user-specified percentage. These forms allow color separates to be made. For example, to extract the red component from map and store it in the new 0-255 map layer red, the user could type: red = r#map To assign this map grey colors type: r.colors map=red color=rules black white To assign this map red colors type: r.colors map=red color=rules black red FUNCTIONS The functions currently supported are listed in the table below. The type of the result is indicated in the last column. F means that the functions always results in a floating point value, I means that the function gives an integer result, and * indicates that the result is float if any of the arguments to the function are floating point values and integer if all arguments are integer. function description type _________________________________________________________________________________ abs(x)return absolute value of x * atan(x) inverse tangent of x (result is in degrees) F cos(x) cosine of x (x is in degrees) F eval([x,y,...,]z) evaluate values of listed expr, pass results to z * exp(x) exponential function of x F 71