[GRASS-dev] r.stats output

I am trying to use r.stats to print out a text file with x and y coordinates as well as the area (or cell count). However, it seems any choice is mutually exclusive. If I choose to print the grid coordinates and to print the area, what I get is the coordinates with the category number. If I select to print the category labels and area, I only get the category labels.

Am I doing something wrong, or is this the intended behaviour? If intended, would it be an idea to enable printing out any combination of selected outputs, e.g., coordinates and cell counts, or coordinates and area totals?

Running grass 7.1 on Ubuntu 14.04

On 24/09/14 10:00, Paulo van Breugel wrote:

I am trying to use r.stats to print out a text file with x and y
coordinates as well as the area (or cell count). However, it seems any
choice is mutually exclusive. If I choose to print the grid coordinates
and to print the area, what I get is the coordinates with the category
number. If I select to print the category labels and area, I only get
the category labels.

Am I doing something wrong, or is this the intended behaviour? If
intended, would it be an idea to enable printing out any combination of
selected outputs, e.g., coordinates and cell counts, or coordinates and
area totals?

Area totals (or cell counts) are done by category. In other words: all cells with a given category are summed up to give the total cell count, area then just being cell count * resolution^2.

It thus does not make sens to provide coordinates for count or area: which coordinates would you use if you have cells with the same category all over your map ?

AFAIK, coordinates are only available for individual cells, so you can export coordinates with their cat value for further treatment.

Moritz

Paulo van Breugel:

I am trying to use r.stats to print out a text file with x and y
coordinates as well as the area (or cell count). However, it seems any
choice is mutually exclusive. If I choose to print the grid coordinates and
to print the area, what I get is the coordinates with the category number.
If I select to print the category labels and area, I only get the category
labels.

Am I doing something wrong, or is this the intended behaviour? If intended,
would it be an idea to enable printing out any combination of selected
outputs, e.g., coordinates and cell counts, or coordinates and area totals?

Hi Paulo. What coordinates would you expect for area totals? All of the coordinates (x,y or -g(rid)) that sum up a aera total? And how would you print this in the command line?

Just trying to understand the logic.

--
Nikos

On Wed, Sep 24, 2014 at 1:12 PM, Moritz Lennert <
mlennert@club.worldonline.be> wrote:

On 24/09/14 10:00, Paulo van Breugel wrote:

I am trying to use r.stats to print out a text file with x and y
coordinates as well as the area (or cell count). However, it seems any
choice is mutually exclusive. If I choose to print the grid coordinates
and to print the area, what I get is the coordinates with the category
number. If I select to print the category labels and area, I only get
the category labels.

Am I doing something wrong, or is this the intended behaviour? If
intended, would it be an idea to enable printing out any combination of
selected outputs, e.g., coordinates and cell counts, or coordinates and
area totals?

Area totals (or cell counts) are done by category. In other words: all
cells with a given category are summed up to give the total cell count,
area then just being cell count * resolution^2.

I had assigned an unique category to each raster cell. So I would expect to
get a area total per raster cell

It thus does not make sense to provide coordinates for count or area:
which coordinates would you use if you have cells with the same category
all over your map ?

It makes sense if each raster cell is assigned an unique category (which I
did). What I was trying was get the area per raster cell (of a latlon
raster). But yes, it makes sense that in in general it wouldn't be logical
to have coordinates and area at the same time. I was too much focussed on
my very specific case (trying an alternative way to get raster cell size of
latlon grid).

AFAIK, coordinates are only available for individual cells, so you can

export coordinates with their cat value for further treatment.

Thanks for the reply, appreciated

Moritz

On 24/09/14 14:08, Paulo van Breugel wrote:

On Wed, Sep 24, 2014 at 1:12 PM, Moritz Lennert
    It thus does not make sense to provide coordinates for count or
    area: which coordinates would you use if you have cells with the
    same category all over your map ?

It makes sense if each raster cell is assigned an unique category (which
I did). What I was trying was get the area per raster cell (of a latlon
raster). But yes, it makes sense that in in general it wouldn't be
logical to have coordinates and area at the same time. I was too much
focussed on my very specific case (trying an alternative way to get
raster cell size of latlon grid).

Ok, now I understand your problem, but honestly, in such a situation I believe that it is better to chose a relevant projection, reproject the grid and then just use resolution^2 as cell size...

But since you already have gone down the route of calculating cell size in r.mapcalc, I guess you really wanted to do it in latlon... :wink:

Moritz

On Wed, Sep 24, 2014 at 2:43 PM, Moritz Lennert <
mlennert@club.worldonline.be> wrote:

On 24/09/14 14:08, Paulo van Breugel wrote:

On Wed, Sep 24, 2014 at 1:12 PM, Moritz Lennert
    It thus does not make sense to provide coordinates for count or
    area: which coordinates would you use if you have cells with the
    same category all over your map ?

It makes sense if each raster cell is assigned an unique category (which
I did). What I was trying was get the area per raster cell (of a latlon
raster). But yes, it makes sense that in in general it wouldn't be
logical to have coordinates and area at the same time. I was too much
focussed on my very specific case (trying an alternative way to get
raster cell size of latlon grid).

Ok, now I understand your problem, but honestly, in such a situation I
believe that it is better to chose a relevant projection, reproject the
grid and then just use resolution^2 as cell size...

But since you already have gone down the route of calculating cell size in
r.mapcalc, I guess you really wanted to do it in latlon... :wink:

Yes, more convenient in this case. I can compute the area directly using
r.mapcalc, so no problem. I was just trying if this would be an easier /
faster method. Thanks for your reply!

Moritz