[GRASS-user] Re: grass-user Digest, Vol 66, Issue 34

On Oct 19, 2011, at 11:00 AM, grass-user-request@lists.osgeo.org wrote:

Message: 3
Date: Wed, 19 Oct 2011 08:55:47 +0200
From: Markus Metz <markus.metz.giswork@googlemail.com>
Subject: Re: [GRASS-user] odd r.stats output, after r.resample.stats
To: Kirk Wythers <kirk.wythers@gmail.com>
Cc: grass-user@lists.osgeo.org
Message-ID:
<CAG+h=FGNo5_dR3U3v=VBzA-4tOzf8-MMqPJ8c=0YbNJPONKz5Q@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

On Tue, Oct 18, 2011 at 9:31 PM, Kirk Wythers <kirk.wythers@gmail.com> wrote:

I am trying to aggregate resample a 250 meter resolution raster to 1000m resolution as the most frequently occurring value in the 250m map. I am using:

GRASS 6.4.1 (northcentralus_albersequalarea):~ > r.resamp.stats -w input=mnwimifnfftgk7wt175v3_250m output=mnwimifnfftgk7wt175v3_1000m method=mode --verbose 100%

This all appears to work properly. If I export the raster to MATLAB and simply view the cell values they are all whole number like 500, 600, 700, etc…

However, when I run r.stats on each map, I get:

GRASS 6.4.1 (northcentralus_albersequalarea):~ > r.stats -cl input=mnwimifnfftgk7wt175v3_250m 100%

0 893025

100 18419

120 34024

170 125

260 18

380 527

400 4269

500 36610

600 163

700 12479

800 51090

900 53455

990 5

999 527

  • no data 874

GRASS 6.4.1 (northcentralus_albersequalarea):~ > r.stats -cl input=mnwimifnfftgk7wt175v3_1000m

100%

0-3.917647 from to 929109

97.941176-101.858824 from to 11467

117.529412-121.447059 from to 32643

168.458824-172.376471 from to 1

258.564706-262.482353 from to 1

376.094118-380.011765 from to 30

399.6-403.517647 from to 383

497.541176-501.458824 from to 24231

599.4-603.317647 from to 12

697.341176-701.258824 from to 2184

799.2-803.117647 from to 50355

897.141176-901.058824 from to 55190

995.082353-999 from to 4

The output to r.stats from the 250 meter resolution map look fine… but doesn’t make sense to me that the 1000 meter resolution map would have it’s count and cell values binned into groups like 0-3.9, and 97.9-101.9???

That looks like mnwimifnfftgk7wt175v3_250m is of type CELL and
mnwimifnfftgk7wt175v3_1000m is of type FCELL or DCELL. Try reading
mnwimifnfftgk7wt175v3_1000m as CELL (integer) with

r.stats -cli input=mnwimifnfftgk7wt175v3_1000m

HTH,

Markus M

That worked! Thanks Markus. Any way I can keep “type CELL” when I resample with r.resamp.stats -w input=mnwimifnfftgk7wt175v3_250m output=mnwimifnfftgk7wt175v3_1000m method=mode --verbose, so that I don’t create a "type FCELL or DCELL in the 1000 meter resolution version ?