[GRASS-dev] [GRASS GIS] #2986: r.mapcalc with same variable on LHS and RHS

GRASS GIS trac at osgeo.org
Thu Apr 21 06:29:08 PDT 2016


#2986: r.mapcalc with same variable on LHS and RHS
--------------------------+-------------------------
  Reporter:  mankoff      |      Owner:  grass-dev@…
      Type:  defect       |     Status:  closed
  Priority:  major        |  Milestone:  7.0.4
 Component:  Docs         |    Version:  7.0.3
Resolution:  fixed        |   Keywords:  r.mapcalc
       CPU:  Unspecified  |   Platform:  Unspecified
--------------------------+-------------------------

Comment (by mankoff):

 I'm still confused. The specific case of {{{r.mapcalc 'map=map'}}}
 mentioned 2 comments above does seem to work for me in v7.0.3 (see code
 example below). Also, the last comment appears to say that everything on
 the LHS, even if a new unique LHSname, will be a variable and not a map
 (I'm not even sure what "variables" are in GRASS). But the documentation
 says that, //"result is the name of a raster map layer"//, and I thought
 the whole point of {{{r.mapcalc}}} was to produce new raster maps.

 Finally, there is no evidence, at least from {{{r.info}}}, of results
 changing type. See for example results from,

 {{{
 grass70 -text ./nc_spm_08_grass7/PERMANENT
 r.mapcalc "LHS = 1" --o
 r.info LHS > rinfo.1
 r.mapcalc "LHS = LHS" --o
 r.info LHS > rinfo.2
 r.mapcalc "LHS = LHS * 2" --o
 r.info LHS > rinfo.3
 diff3 rinfo.1 rinfo.2 rinfo.3
 }}}

 Finally, would it be possible to change this behavior, so that
 {{{r.mapcalc 'map = map * 2'}}} is valid syntax? It seems like it would be
 incredibly useful to support this standard programming syntax. If it isn't
 a major code issue, I'll open a ticket with this feature request.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2986#comment:8>
GRASS GIS <https://grass.osgeo.org>



More information about the grass-dev mailing list