[GRASS-dev] [GRASS GIS] #3067: r.mapcalc gives wrong result when neighborhood modifier takes a cell above first

#3067: r.mapcalc gives wrong result when neighborhood modifier takes a cell above
first
----------------------------------------------+-------------------------
Reporter: wenzeslaus | Owner: grass-dev@…
     Type: defect | Status: new
Priority: blocker | Milestone: 7.0.5
Component: Raster | Version: svn-trunk
Keywords: r.mapcalc, neighborhood modifier | CPU: Unspecified
Platform: Linux |
----------------------------------------------+-------------------------
When I run G7:r.mapcalc with `x = p[1,0] + p[-1,0]` (r.mapcalc possibly
first taking cell one row below), I get a correct result, but when I swap
the parts if the expression to `x = p[-1,0] + p[1,0]` (r.mapcalc possibly
first taking cell one row above), I get a wrong result. A reproducible
example follows.

{{{
#!bash
> r.in.ascii in=- out=p <<EOF
north: 10
south: 8
east: 20
west: 18
rows: 3
cols: 3
1 0 1
1 1 0
1 1 0
EOF
> g.region rast=p
> r.mapcalc "x1 = p[1,0] + p[-1,0]" && r.out.ascii x1
north: 10
south: 8
east: 20
west: 18
rows: 3
cols: 3
* * *
2 1 1
* * *
> r.mapcalc "x2 = p[-1,0] + p[1,0]" && r.out.ascii x2
north: 10
south: 8
east: 20
west: 18
rows: 3
cols: 3
* * *
2 2 0
* * *
}}}

I get same result with or without r67851 (row cache fix for #2917).

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3067&gt;
GRASS GIS <https://grass.osgeo.org>

#3067: r.mapcalc gives wrong result when neighborhood modifier takes a cell above
first
--------------------------+----------------------------------------------
  Reporter: wenzeslaus | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: blocker | Milestone: 7.0.5
Component: Raster | Version: svn-trunk
Resolution: | Keywords: r.mapcalc, neighborhood modifier
       CPU: Unspecified | Platform: Linux
--------------------------+----------------------------------------------

Comment (by wenzeslaus):

In [changeset:"68708" 68708]:
{{{
#!CommitTicketReference repository="" revision="68708"
r.mapcalc: test for row order reading problem (see #3067)
}}}

--
Ticket URL: </ticket/3067#comment:1>
GRASS GIS <https://grass.osgeo.org>

#3067: r.mapcalc gives wrong result when neighborhood modifier takes a cell above
first
--------------------------+----------------------------------------------
  Reporter: wenzeslaus | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: blocker | Milestone: 7.0.5
Component: Raster | Version: svn-trunk
Resolution: | Keywords: r.mapcalc, neighborhood modifier
       CPU: Unspecified | Platform: Linux
--------------------------+----------------------------------------------

Comment (by marisn):

I can confirm the issue with trunk r68709

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3067#comment:2&gt;
GRASS GIS <https://grass.osgeo.org>

#3067: r.mapcalc gives wrong result when neighborhood modifier takes a cell above
first
--------------------------+----------------------------------------------
  Reporter: wenzeslaus | Owner: grass-dev@…
      Type: defect | Status: closed
  Priority: blocker | Milestone: 7.0.5
Component: Raster | Version: svn-trunk
Resolution: fixed | Keywords: r.mapcalc, neighborhood modifier
       CPU: Unspecified | Platform: Linux
--------------------------+----------------------------------------------
Changes (by glynn):

* status: new => closed
* resolution: => fixed

Comment:

In [changeset:"68717" 68717]:
{{{
#!CommitTicketReference repository="" revision="68717"
Fix #3067
}}}

--
Ticket URL: </ticket/3067#comment:3>
GRASS GIS <https://grass.osgeo.org>

#3067: r.mapcalc gives wrong result when neighborhood modifier takes a cell above
first
--------------------------+----------------------------------------------
  Reporter: wenzeslaus | Owner: grass-dev@…
      Type: defect | Status: closed
  Priority: blocker | Milestone: 7.0.5
Component: Raster | Version: svn-trunk
Resolution: fixed | Keywords: r.mapcalc, neighborhood modifier
       CPU: Unspecified | Platform: Linux
--------------------------+----------------------------------------------

Comment (by glynn):

Replying to [ticket:3067 wenzeslaus]:

> A reproducible example follows.

This should be fixed by r68717.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3067#comment:4&gt;
GRASS GIS <https://grass.osgeo.org>

#3067: r.mapcalc gives wrong result when neighborhood modifier takes a cell above
first
--------------------------+----------------------------------------------
  Reporter: wenzeslaus | Owner: grass-dev@…
      Type: defect | Status: closed
  Priority: blocker | Milestone: 7.0.5
Component: Raster | Version: svn-trunk
Resolution: fixed | Keywords: r.mapcalc, neighborhood modifier
       CPU: Unspecified | Platform: Linux
--------------------------+----------------------------------------------

Comment (by neteler):

Replying to [comment:4 glynn]:
> Replying to [ticket:3067 wenzeslaus]:
>
> > A reproducible example follows.
>
> This should be fixed by r68717.

Shall I backport it?

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3067#comment:5&gt;
GRASS GIS <https://grass.osgeo.org>

#3067: r.mapcalc gives wrong result when neighborhood modifier takes a cell above
first
--------------------------+----------------------------------------------
  Reporter: wenzeslaus | Owner: grass-dev@…
      Type: defect | Status: closed
  Priority: blocker | Milestone: 7.0.5
Component: Raster | Version: svn-trunk
Resolution: fixed | Keywords: r.mapcalc, neighborhood modifier
       CPU: Unspecified | Platform: Linux
--------------------------+----------------------------------------------

Comment (by glynn):

Replying to [comment:5 neteler]:

> Shall I backport it?

I think so. The previous version was clearly incorrect.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3067#comment:6&gt;
GRASS GIS <https://grass.osgeo.org>

#3067: r.mapcalc gives wrong result when neighborhood modifier takes a cell above
first
--------------------------+----------------------------------------------
  Reporter: wenzeslaus | Owner: grass-dev@…
      Type: defect | Status: closed
  Priority: blocker | Milestone: 7.0.5
Component: Raster | Version: svn-trunk
Resolution: fixed | Keywords: r.mapcalc, neighborhood modifier
       CPU: Unspecified | Platform: Linux
--------------------------+----------------------------------------------

Comment (by wenzeslaus):

In [changeset:"68722" 68722]:
{{{
#!CommitTicketReference repository="" revision="68722"
r.forestfrag: fix test reference data after r68717 (see #3067)
}}}

--
Ticket URL: </ticket/3067#comment:7>
GRASS GIS <https://grass.osgeo.org>

#3067: r.mapcalc gives wrong result when neighborhood modifier takes a cell above
first
--------------------------+----------------------------------------------
  Reporter: wenzeslaus | Owner: grass-dev@…
      Type: defect | Status: closed
  Priority: blocker | Milestone: 7.0.5
Component: Raster | Version: svn-trunk
Resolution: fixed | Keywords: r.mapcalc, neighborhood modifier
       CPU: Unspecified | Platform: Linux
--------------------------+----------------------------------------------

Comment (by neteler):

In [changeset:"68768" 68768]:
{{{
#!CommitTicketReference repository="" revision="68768"
r.mapcalc: fix wrong result when neighborhood modifier takes a cell above
first (trunk, r68717, fixes #3067)
}}}

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

#3067: r.mapcalc gives wrong result when neighborhood modifier takes a cell above
first
--------------------------+----------------------------------------------
  Reporter: wenzeslaus | Owner: grass-dev@…
      Type: defect | Status: closed
  Priority: blocker | Milestone: 7.0.5
Component: Raster | Version: svn-trunk
Resolution: fixed | Keywords: r.mapcalc, neighborhood modifier
       CPU: Unspecified | Platform: Linux
--------------------------+----------------------------------------------

Comment (by neteler):

In [changeset:"68769" 68769]:
{{{
#!CommitTicketReference repository="" revision="68769"
r.mapcalc: fix wrong result when neighborhood modifier takes a cell above
first (trunk, r68717, fixes #3067)
}}}

--
Ticket URL: </ticket/3067#comment:9>
GRASS GIS <https://grass.osgeo.org>

#3067: r.mapcalc gives wrong result when neighborhood modifier takes a cell above
first
--------------------------+----------------------------------------------
  Reporter: wenzeslaus | Owner: grass-dev@…
      Type: defect | Status: closed
  Priority: blocker | Milestone: 7.0.5
Component: Raster | Version: svn-trunk
Resolution: fixed | Keywords: r.mapcalc, neighborhood modifier
       CPU: Unspecified | Platform: Linux
--------------------------+----------------------------------------------

Comment (by neteler):

Backported in r68768 (relbr72), r68769 (relbr70).

Note that relbr64 seems not to be affected since the cache was introduced
only in r34444 and not backported.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3067#comment:10&gt;
GRASS GIS <https://grass.osgeo.org>