Hi!
I wonder if anyone could explain to me how to create a new map (raster) from
two pre-existing maps, in mapcalc. Because I have problems with understanding
how to do this in r.mapcalc
I have two raster datasets that I would like to combine like so; if the cell
is in map a, assign the value 7; if it is in map B, assign the correct value
from B, (i.e keep the value the cell already have in B).
I have tried to read "Performing Map Calculations on GRASS Data: r.mapcalc
Program Tutorial", by Marji Larson, Michael Shapiro and Scott Tweddale, U.S.
Army Construction Engineering Research Laboratory (December 1991) , and they
give this example:
MAPCALC> aspect.str = if(streams,26,aspect)
This should then give a new map that contains the values from "aspect", but
with the value 26 assigned to cells with "streams".
Example from my experiments:
R_test9 = if(R_VannA@larsf == 1,7, R_paramNew@larsf )
This makes a new map; but it contains only 7, were there was data in R_vannA,
and else, NULL (I guess), see otput below of r.info.
I also tried "R_test9 = if(if(R_VannA@larsf == 1),7, R_paramNew@larsf ) ; and
this gives the same (non) result. And "R_test10 = if(R_VannA@larsf, 7,
R_paramNew@larsf)"; also the same as; I.E not what I wanted. The problem is
that it never assigns a value from R_paramNew@larsf!!!
What am I missing? Or doing wrong?
Regards
Larsf
Running; SUSE 10.3, grass63 dated 12.09 from
http://download.opensuse.org/repositories/Application:/Geo/openSUSE_10.3/i586/
---------------------------------------------r.info output (example)
(3) r.info map=R_test9@larsf
+--------------------------------------------------------------------------
--+| Layer: R_test9@larsf Date: Sun Sep 21 15:28:36 2008
| | Mapset: larsf Login of Creator: larsf
| | Location: Frosta
| | DataBase: /home/larsf/grassgis
| | Title: ( R_test9 )
| | Timestamp: none
| |
| ------------------------------------------------------------------------
|----|
|
| Type of Map: raster Number of Categories: 7
| | Data Type: CELL
| | Rows: 3360
| | Columns: 3720
| | Total Cells: 12499200
| | Projection: UTM (zone 32)
| | N: 7062800 S: 7046000 Res: 5
| | E: 596600 W: 578000 Res: 5 |
| Range of data: min = 7 max = 7
| |
|
| Data Description:
| | generated by r.mapcalc
| |
|
| Comments:
| | if(R_VannA@larsf == 1, 7, R_paramNew@larsf)
| |+--------------------------------------------------------------------------
--+