r.statistics base=name cover=name method=count ?

5 messages Options
Embed this post
Permalink
Hermann Peifer

r.statistics base=name cover=name method=count ?

Reply Threaded More More options
Print post
Permalink
Hi,

I see that there is a method=distribution which gives me the percentage
values, but is there an easy way to get to a count of cover layer values  ?

I can of course work backwards from the percentages, but this seems to
be sub-optimal.

Hermann

_______________________________________________
grass-user mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-user
Markus Neteler

Re: r.statistics base=name cover=name method=count ?

Reply Threaded More More options
Print post
Permalink
On Fri, Sep 25, 2009 at 8:26 AM, Hermann Peifer <[hidden email]> wrote:
> Hi,
>
> I see that there is a method=distribution which gives me the percentage
> values, but is there an easy way to get to a count of cover layer values  ?

Maybe r.clump and then r.report with counts?

Markus
_______________________________________________
grass-user mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-user
Hermann Peifer

Re: r.statistics base=name cover=name method=count ?

Reply Threaded More More options
Print post
Permalink
Markus wrote:
> On Fri, Sep 25, 2009 at 8:26 AM, Hermann Peifer <[hidden email]> wrote:
>> Hi,
>>
>> I see that there is a method=distribution which gives me the percentage
>> values, but is there an easy way to get to a count of cover layer values  ?
>
> Maybe r.clump and then r.report with counts?
>

Thanks for the hint. I'll give it a try.

However, I guess that r.statistics knows the counts before calculating percentages, there is just no method to make it print them.

Would it be worth to file an enhancement ticket?

Hermann
_______________________________________________
grass-user mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-user
Markus Metz-2

Re: r.statistics base=name cover=name method=count ?

Reply Threaded More More options
Print post
Permalink


Hermann Peifer wrote:

> Markus wrote:
>> On Fri, Sep 25, 2009 at 8:26 AM, Hermann Peifer <[hidden email]> wrote:
>>> Hi,
>>>
>>> I see that there is a method=distribution which gives me the percentage
>>> values, but is there an easy way to get to a count of cover layer
>>> values  ?
>>
>> Maybe r.clump and then r.report with counts?
>>
>
> Thanks for the hint. I'll give it a try.
>
> However, I guess that r.statistics knows the counts before calculating
> percentages, there is just no method to make it print them.
Maybe r.univar.zonal from grass-addons can help? It could give you the
number of cells of the cover layer (count of cover layer values) per
base layer (zoning map in r.univar.zonal) class. Not sure if this is
what you are looking for.

Markus M

_______________________________________________
grass-user mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-user
Hermann Peifer

Re: r.statistics base=name cover=name method=count ?

Reply Threaded More More options
Print post
Permalink
Markus wrote:
> Maybe r.univar.zonal from grass-addons can help? It could give you the
> number of cells of the cover layer (count of cover layer values) per
> base layer (zoning map in r.univar.zonal) class. Not sure if this is
> what you are looking for.
>

This is actually what I am looking for, but I haven't yet managed to get the add-ons working... :-(

On the other hand, I see that someone must have had a similar thought, as there is this commented line in r.statistics/o_distrib.c

79    /*tot+=sum;
80 fprintf(stderr,"Area: %ld   Tot: %ld  totsum: %lf\n",area,total_count,tot); */

area and total_count are what I am looking for. Currently I'm getting total_count via an additional r.stats -c step. Then I calculate area backwards, using the percentages from r.statistics method=distribution output and the absolute counts from r.stats -c.

It might be an idea to make r.statistics method=distribution print a 4-column output: basecat, covercat, sum, area

?

Hermann


_______________________________________________
grass-user mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-user