Нефть и песок О стали Компрессор - подбор и ошибки Из истории стандартизации резьб Соперник ксерокса - гектограф Новые технологии производства стали Экспорт проволоки из России Прогрессивная технологическая оснастка Цитадель сварки с полувековой историей Упрочнение пружин Способы обогрева Назначение, структура, характеристики анализаторов Промышленные пылесосы Штампованные гайки из пружинной стали Консервация САУ Стандарты и качество Технология производства Водород Выбор материала для крепежных деталей Токарный резец в миниатюре Производство проволоки Адгезия резины к металлокорду Электролитическое фосфатирование проволоки Восстановление корпусных деталей двигателей Новая бескислотная технология производства проката Синие кристаллы Автоклав Нормирование шумов связи Газосварочный аппарат для тугоплавких припоев
Главная --> Промиздат -->  Map principle 

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 ( 28 ) 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127

Finally, you can remove MASK either with g.remove MASK or by renaming it to another name for later re-use; for example, g.rename MASK, mymask. Also r.mask can be used to remove the MASK file.

Zero and NULL value management. GRASS distinguishes between 0 (zero) and no-data (NULL). While zero may represent a true value such as temperature, NULL is used where no value is available. In some situations you may want to modify the current values, such as setting a specific value to NULL or setting NULL to a true value. Here we explain how to exchange NULLs with a single other value. Later on, when talking about r.mapcalc we introduce more complex replacement methods.

The NULL values can be managed using the module r.null. To change a certain value (e.g. -9999) to NULL, the setnull parameter is used:

r.null mymap setnull=-9999

This will change the value -9999 to NULL in map mymap. To replace the NULLs by another number, the null parameter is used:

r.null mymap null=-9999

This will change NULL to -9999. Note that during import of raster data the values to be considered as NULL can be specified. This is important because other GISs may have a different NULL encoding.

Filling data holes in a raster map. Sometimes NULL values appear in map areas where they need to be replaced. This can be done using two approaches:

replace the NULL values with another value;

fill the holes according to the hole-boundary values.

The first approach can be done with r.null as explained above. For the second option, you can use the script r.fillnulls. It will internally fill the holes using interpolated values from the no-data area boundaries using s.surf.rst based spline interpolation. That means that the hole boundaries are stored in a separate map which forms a set of NULL lakes . The values for the lakes are interpolated and merged back into the original map. Only the holes are filled with the new values, the original non-NULL values remain unchanged.

It is important to realize that, depending on the shape of the NULL data area(s), problems may occur due to an insufficient number of input cell values for the interpolation process. Most problems will occur if an area containing NULLs reaches the map boundary. You will have to carefully check the result using r.mapcalc (generating a difference map to the input map) and/or d.what.rast to query individual cell values.



Raster map algebra is a powerful tool for spatial analysis and modeling using raster data. In GRASS, map algebra is performed with r.mapcalc. In principle, r.mapcalc is used in the following way:

where expression is any legal arithmetic expression involving existing raster map layers, integer or floating point constants, and functions known to the calculator. The expression can be provided in a command line mode enclosed within quotes

r.mapcalc newmap=expression(mapl, map2, ...)

or you can type r.mapcalc, then enter one or more expressions at a prompt (quotes are not necessary), and the expressions are executed after you type end:


The following operators are available in r.mapcalc:

<= &&

modulus (remainder upon division)

division

multiplication

addition

subtraction

equal

not equal

greater than

less than

greater than or equal less than or equal and or

color separator into R, G, and B color portions

The following functions are available in r.mapcalc:

abs(x)

atan(x)

cos(x)

double(x)

eval([x,y,,]z)

exp(x) exp(x,y)

return absolute value of x inverse tangent of x (result in degree) cosine of x (x in degree) convert x to double-precision floating point evaluates the values of the given expression, pass results to z exponential function of x x to the power of y


5.2. RASTER MAP ALGEBRA



float(x) if

if(x)

if(x,a)

if(x,a,b)

if(x,a,b,c)

int(x)

isnuU(x)

log(x)

log(x,b)

max(x,y[,z])

median(x,y[,z])

min(x,y[,z ])

mode(x,y[,z])

not(x)

rand(low,high)

round(x) sin(x) sqrt(x) tan(x)

alternative for x to the power y

converts x to single-precision floating point

decision operator

1 , if x does not equal 0, otherwise 0

a, if x does not equal 0, otherwise 0

a, if x does not equal 0, otherwise b

a, if x > 0, b if x equals 0, c if x < 0

converts x to integer [truncates]

1, if x equals no data (NULL)

natural log of x

log of x base b

largest of the listed values

determines median of the listed values

determines smallest of the listed values

determines mode of the listed values

1 if x is zero, 0 otherwise

generates random number between the values

low and high rounds x to the nearest integer sine of x (x in degree) square root of x tangent of x (x in degree)

r.mapcalc provides some additional, internal variables, which are related to the moving window used for calculations:

col() row()

nsres() ewres() null()

current x-coordinate of moving window current y-coordinate of moving window current col of moving window current row of moving window current north-south resolution current east-west resolution NULL value

The value NULL (no-data) is specified with null(). As denoted before, NULL differs from 0 (zero).

Integer and floating point data. In map algebra operations, the resulting raster type is defined by the type of the input raster maps and constants. The result of an expression including integer maps and constants will be an integer map; it will be a floating point map if at least one of the constants or input maps is floating point. For example, when dividing two integer maps, it is important to use multiplication by 1.0 to store the result as a floating point map and preserve the decimal values. To illustrate this rule, we will add a constant to an integer map:

mapcalc> newmapl = old int map + 123 mapcalc> newmap2 = old int map + 123.



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 ( 28 ) 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127