Matrix calculator |
Matrix calculator is intended for carrying out operations of map algebra over matrices of qualities and heights. Map algebra (local operations) - operations, during which, based on one or several initial matrices, a new matrix is created, and the values of the cells of this matrix depend only on the values of the cells of the initial matrices that have the same coordinates.
Matrix calculator. 1 - Toolbar. 2 - «Output file». 3 - «Legend». 4 - «Calculation area». 5 - «Matrices». 6 - «Operators». 7 - «Expression»
The toolbar contains 3 buttons: Exit; Help; Start calculation.
The panel «Output file» is intended for a choice of a path of saving a created matrix of quality.
On the «Legend» panel, you can set the number of colors in the palette of the created matrix, which can vary from 1 to 32. Also, using the «Edit gradations» check-box, you can enable manual editing, in which each color can be set manually. If the «Edit gradations» check-box is not checked, then the user sets only the extreme colors, and all intermediate ones are calculated automatically.
On the panel «Calculation area» it is possible to choose area of construction in four ways: - «The whole area» - the matrix will be constructed within the rectangular area covering all open matrixes of qualities and heights, projection of which coincides with the projection of the document; - «Rectangular area» - the matrix will be constructed within the chosen rectangular area; - «Object outline» - the matrix will be constructed within the rectangular area covering chosen object; - «Area by coordinates» - the matrix will be constructed within the rectangular area specified by the coordinates of two corners.
The panel «Matrices» contains a list of all open matrices of qualities and heights, projection of which coincides with the projection of the document. Double-clicking on the name of the matrix will add it pnto the expression input field.
Panel «Operators» is intended for a convenient insert of operators into expression. The following mathematical operations are supported: addition; subtraction; multiplication; division; exponentiation; logarithm; natural logarithm; sine of the angle in radians; cosine of an angle in radians; tangent of an angle in radians; the cotangent of the angle in radians; arcsine in radians; arccosine in radians; arctangent in radians; arc cotangent in radians; exponent; module; rounding; remainder of the division.
The use of brackets and is allowed. The conditional operator allows you to assign values to the cells of the generated matrix based on a specified condition. This operator consists of three parts: - condition; - the value that will be assigned to the matrix cell when the condition is met; - the value that will be assigned if the condition is not met.
Checking cells on lack of data – . When using this operator, the cells of the created matrix will be assigned the value 1 if the corresponding cells of the original matrix have the value NULL, that is, they have no data, and 0 otherwise.
Setting the value of cells NULL – . This operator can only be used as an assigned value in a conditional operator. When using this operator, the corresponding cells of the created matrix will be assigned a NULL value, that is, they will not contain data and will be displayed on the map. Comparison operations: equal; not equal; more; more or equal; less; less or equal.
If you use comparison operators outside the conditional operator, then all cells in the generated matrix, except for those that are NULL, will be assigned the value 1 if the specified condition is met, and 0 otherwise. Logic operations: AND; OR; NOT.
The «Expression» panel contains a field for entering mathematical and logical expressions. This field is intended for entering expressions using quick input buttons, the list of available matrices and the keyboard. If, when performing any operation, it turns out that a cell of one of the original matrices has a NULL value, that is, does not contain data, then the corresponding cell of the created matrix will also be assigned a NULL value. An exception is the isNull operator, as a result of which all cells of the created matrix will be assigned the value 1 or 0. If the expression contains several matrices with different cell sizes, then the size of the cells of the created matrix will be equal to the size of the cells of the first matrix in the expression. To calculate the value of each cell of the created matrix, the values of the cells nearest to it of the original matrices will be taken.
Examples. 1. To build a matrix, which elements would be equal to the sum of the elements of the matrices FirstMatrix.mtq and SecondMatrix.mtq, you need to enter the following expression: "1.FirstMatrix.mtq" + "2.SecondMatrix.mtq"
2. To build a matrix which elements would be equal to the elements of the matrix FirstMatrix.mtq rounded to the nearest side, you need to enter the following expression: rnd("1.FirstMatrix.mtq")
3. If there is a matrix Height.mtq, in the elements of which the height value is stored, then you can find out the areas in which the height is greater than 0 by entering the following expression: "1.Height.mtq" > 0 The areas of the resulting matrix, in which the condition is satisfied, will have the value 1, and in which it is not - 0.
4. To display only areas where the height value stored in the elements of the Height.mtq matrix is less than 0, enter the following expression: Con("1.Height.mtq" < 0; "1.Height.mtq"; setNull)
5. To build a matrix, the values of the elements of which would be equal to the values of the elements of the matrix FirstMatrix.mtq, while, so that it was built only on the area where the elements of the matrix SecondMatrix.mtq have the NULL value, you need to enter the following expression: Con(isNull("2.SecondMatrix.mtq"); "1.FirstMatrix.mtq"; setNull)
|