[GRASS-user] r.mapcalc appears to have changed behavior

It looks like for the 2nd calculation, your computational region is set to extents of 0W - 1E, 0S - 1N, with a resolution of 1.

So r.mapcalc is only operating on a single 1x1 cell that is outside the area of your raster map.

Michael
____________________
C. Michael Barton
Director, Center for Social Dynamics & Complexity
Professor of Anthropology, School of Human Evolution & Social Change
Arizona State University

voice: 480-965-6262 (SHESC), 480-727-9746 (CSDC)
fax: 480-965-7671 (SHESC), 480-727-0709 (CSDC)
www: http://www.public.asu.edu/~cmbarton, http://csdc.asu.edu

On Sep 27, 2011, at 11:50 PM, <grass-user-request@lists.osgeo.org> <grass-user-request@lists.osgeo.org> wrote:

Date: Mon, 26 Sep 2011 23:19:11 -0400
From: Jim Mochel <jim.mochel.hivol@gmail.com>
Subject: [GRASS-user] r.mapcalc appears to have changed behavior
To: grass-user@lists.osgeo.org
Message-ID:
       <CAE=Y9-Q7tFZ=cJ4TC6nceYA5B=R9E7RRwZbVfF_fYbMNTEpC6A@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

I had made a number of scripts that worked fine in the 6.4.0 build 6 but
appear to have problems with the same code in later revisions:

The method used to take about 6-8 secs and produce about what you would
expect on the screen. Now the same calculation takes 0 seconds the file is
radically changed. See the before and after below.

Any help would be greatly appreciated.
Thanks
Jim Mochel

r.mapcalc na_dem_sub_20 = na_dem_input - 20

+----------------------------------------------------------------------------+
| Layer: na_dem Date: Sat Sep 24 17:37:59 2011
|
| Mapset: PERMANENT Login of Creator: jmochel
|
| Location: wgs84
|
| DataBase: /home/jmochel/grassdata
|
| Title: ( na_dem )
|
| Timestamp: none
|
|----------------------------------------------------------------------------|
|
|
| Type of Map: raster Number of Categories: 65535
|
| Data Type: CELL
|
| Rows: 8384
|
| Columns: 9102
|
| Total Cells: 76311168
|
| Projection: x,y
|
| N: 4384500 S: -3999500 Res: 1000
|
| E: 4639500 W: -4462500 Res: 1000
|
| Range of data: min = 0 max = 65535
|
|
|
| Data Description:
|
| generated by r.in.gdal
|
|
|
| Comments:
|
| r.in.gdal input="/home/jmochel/gis/raw-data/hydo1k/na_dem.bil" outpu\
|
| t="na_dem"
|
|
|
+----------------------------------------------------------------------------+

r.info map=na_dem_sub_20

+----------------------------------------------------------------------------+
| Layer: na_dem_sub_20 Date: Mon Sep 26 23:06:03 2011
|
| Mapset: PERMANENT Login of Creator: jmochel
|
| Location: wgs84
|
| DataBase: /home/jmochel/grassdata
|
| Title: ( na_dem_sub_20 )
|
| Timestamp: none
|
|----------------------------------------------------------------------------|
|
|
| Type of Map: raster Number of Categories: 610
|
| Data Type: CELL
|
| Rows: 1
|
| Columns: 1
|
| Total Cells: 1
|
| Projection: x,y
|
| N: 1 S: 0 Res: 1
|
| E: 1 W: 0 Res: 1
|
| Range of data: min = 610 max = 610
|
|
|
| Data Description:
|
| generated by r.mapcalc
|
|
|
| Comments:
|
| na_dem_input@PERMANENT - 20
|
|
|
+----------------------------------------------------------------------------+

Thank you. !

I am not sure how I did that but I am sure it seemed like a good idea at the time :slight_smile:

Jim

On Tue, Sep 27, 2011 at 1:02 AM, Michael Barton <michael.barton@asu.edu> wrote:

It looks like for the 2nd calculation, your computational region is set to extents of 0W - 1E, 0S - 1N, with a resolution of 1.

So r.mapcalc is only operating on a single 1x1 cell that is outside the area of your raster map.

Michael


C. Michael Barton
Director, Center for Social Dynamics & Complexity
Professor of Anthropology, School of Human Evolution & Social Change
Arizona State University

voice: 480-965-6262 (SHESC), 480-727-9746 (CSDC)
fax: 480-965-7671 (SHESC), 480-727-0709 (CSDC)
www: http://www.public.asu.edu/~cmbarton, http://csdc.asu.edu

On Sep 27, 2011, at 11:50 PM, <grass-user-request@lists.osgeo.org> <grass-user-request@lists.osgeo.org> wrote:

Date: Mon, 26 Sep 2011 23:19:11 -0400
From: Jim Mochel <jim.mochel.hivol@gmail.com>
Subject: [GRASS-user] r.mapcalc appears to have changed behavior
To: grass-user@lists.osgeo.org
Message-ID:
<CAE=Y9-Q7tFZ=cJ4TC6nceYA5B=R9E7RRwZbVfF_fYbMNTEpC6A@mail.gmail.com>
Content-Type: text/plain; charset=“iso-8859-1”

I had made a number of scripts that worked fine in the 6.4.0 build 6 but
appear to have problems with the same code in later revisions:

The method used to take about 6-8 secs and produce about what you would
expect on the screen. Now the same calculation takes 0 seconds the file is
radically changed. See the before and after below.

Any help would be greatly appreciated.
Thanks
Jim Mochel

r.mapcalc na_dem_sub_20 = na_dem_input - 20

±---------------------------------------------------------------------------+
| Layer: na_dem Date: Sat Sep 24 17:37:59 2011
|
| Mapset: PERMANENT Login of Creator: jmochel
|
| Location: wgs84
|
| DataBase: /home/jmochel/grassdata
|
| Title: ( na_dem )
|
| Timestamp: none
|
|----------------------------------------------------------------------------|
|
|
| Type of Map: raster Number of Categories: 65535
|
| Data Type: CELL
|
| Rows: 8384
|
| Columns: 9102
|
| Total Cells: 76311168
|
| Projection: x,y
|
| N: 4384500 S: -3999500 Res: 1000
|
| E: 4639500 W: -4462500 Res: 1000
|
| Range of data: min = 0 max = 65535
|
|
|
| Data Description:
|
| generated by r.in.gdal
|
|
|
| Comments:
|
| r.in.gdal input=“/home/jmochel/gis/raw-data/hydo1k/na_dem.bil” outpu
|
| t=“na_dem”
|
|
|
±---------------------------------------------------------------------------+

r.info map=na_dem_sub_20

±---------------------------------------------------------------------------+
| Layer: na_dem_sub_20 Date: Mon Sep 26 23:06:03 2011
|
| Mapset: PERMANENT Login of Creator: jmochel
|
| Location: wgs84
|
| DataBase: /home/jmochel/grassdata
|
| Title: ( na_dem_sub_20 )
|
| Timestamp: none
|
|----------------------------------------------------------------------------|
|
|
| Type of Map: raster Number of Categories: 610
|
| Data Type: CELL
|

| Rows: 1
|
| Columns: 1
|
| Total Cells: 1
|

| Projection: x,y
|
| N: 1 S: 0 Res: 1
|
| E: 1 W: 0 Res: 1
|
| Range of data: min = 610 max = 610
|
|
|
| Data Description:
|
| generated by r.mapcalc
|
|
|
| Comments:
|
| na_dem_input@PERMANENT - 20
|
|
|
±---------------------------------------------------------------------------+