[GRASS-dev] Re: [GRASS-user] Again on raster statistics

Hi,
i can confirm this bug with the latest grass6.3-cvs version.

Using the test suite mapset i get the following result:

Mapset <testmapset> in Location <TestLocation>
                                     GRASS 6.3.cvs > g.region -p res=200

GRASS 6.3.cvs > r.mapcalc "stat_test=col()*1.0"

GRASS 6.3.cvs > r.stats -npc input=stat_test nsteps=10
  100%
1-1.9 10 12.50%
1.9-2.8 10 12.50%
2.8-3.7 10 12.50%
3.7-4.6 10 12.50%
4.6-5.5 10 12.50%
5.5-6.4 10 12.50%
6.4-7.3 10 12.50%
7.3-8.2 10 12.50%
8.2-9.1 10 12.50%
9.1-10 10 12.50%

GRASS 6.3.cvs > r.stats -npc input=stat_test nsteps=2
  100%
1-5.5 90 102.27%
5.5-10 10 11.36% <------------ ???

  100%
1-4 50 57.47%
4-7 40 45.98%
7-10 10 11.49% <------------ ???

I have created a bug report.

Best regards
Soeren

Luigi Ponti schrieb:

Dear list,

I take up again a question I posted a couple of week ago with no aswer. Maybe I am missing something trivial. If so, I would ask you to please let me know.

In order to simulate a strange behaviour I ususally get when analyzing a raster obtained via v.surf.idw, I have imported the following sample_raster (into a Lambert Conformal Conic location with roughly the extent of Italy) :

north: 1957791.56244761
south: 764918.56244761
east: 754857.88911685
west: -279947.29662612
rows: 10
cols: 10
1 2 3 4 5 6 7 8 9 10

using the following command:

GRASS 6.1.cvs (EurLCC):~ > r.in.ascii -f input=sample_raster.txt output=sample_raster title="This is a sample raster"

Then if I use r.stats with 9 steps I get:

GRASS 6.1.cvs (EurLCC):~ > r.stats -nap sample_raster nsteps=9
r.stats: 100%
1-2 246878233266.702148 22.23%
2-3 122842792398.404068 11.06%
3-4 124035440868.291550 11.17%
4-5 122842792398.404068 11.06%
5-6 124035440868.291550 11.17%
6-7 122842792398.404068 11.06%
7-8 124035440868.291550 11.17%
8-9 122842792398.404068 11.06%
9-10 124035440868.291550 11.17%

But with 2 steps I get:

GRASS 6.1.cvs (EurLCC):~ > r.stats -nap sample_raster nsteps=2
r.stats: 100%
1-5.5 1110355725439.734619 100.00%
5.5-10 124035440868.291550 11.17%

Which does not make a lot of sense to me: there is too much area in the first half and too little in the second half.
Any hints appreciated. Regards,

Luigi

_______________________________________________
grassuser mailing list
grassuser@grass.itc.it
http://grass.itc.it/mailman/listinfo/grassuser

Hey there,

Thanks Sören for creating a bug report.

Given that r.stats is not doing the job, would there be another way to calculate areas included in subranges of a fp raster? Or also, what is the approach to calculating raster areas?

I spent quite some time writing a script that would use the output of r.stats and report in a tabular and graphic form, but then I found out that r.stats was not reporting correctly itself (see below).

Is simple raster statistics a feature of secondary importance in GRASS, i.e. there is other tools that address this primarily.

Thanks and regards,

Luigi

Sören Gebbert wrote:

Hi,
i can confirm this bug with the latest grass6.3-cvs version.

Using the test suite mapset i get the following result:

Mapset <testmapset> in Location <TestLocation>
                                   GRASS 6.3.cvs > g.region -p res=200

GRASS 6.3.cvs > r.mapcalc "stat_test=col()*1.0"

GRASS 6.3.cvs > r.stats -npc input=stat_test nsteps=10
100%
1-1.9 10 12.50%
1.9-2.8 10 12.50%
2.8-3.7 10 12.50%
3.7-4.6 10 12.50%
4.6-5.5 10 12.50%
5.5-6.4 10 12.50%
6.4-7.3 10 12.50%
7.3-8.2 10 12.50%
8.2-9.1 10 12.50%
9.1-10 10 12.50%

GRASS 6.3.cvs > r.stats -npc input=stat_test nsteps=2
100%
1-5.5 90 102.27%
5.5-10 10 11.36% <------------ ???

                                                     GRASS 6.3.cvs > r.stats -npc input=stat_test nsteps=3
100%
1-4 50 57.47%
4-7 40 45.98%
7-10 10 11.49% <------------ ???

I have created a bug report.

Best regards
Soeren

Luigi Ponti schrieb:

Dear list,

I take up again a question I posted a couple of week ago with no aswer. Maybe I am missing something trivial. If so, I would ask you to please let me know.

In order to simulate a strange behaviour I ususally get when analyzing a raster obtained via v.surf.idw, I have imported the following sample_raster (into a Lambert Conformal Conic location with roughly the extent of Italy) :

north: 1957791.56244761
south: 764918.56244761
east: 754857.88911685
west: -279947.29662612
rows: 10
cols: 10
1 2 3 4 5 6 7 8 9 10

using the following command:

GRASS 6.1.cvs (EurLCC):~ > r.in.ascii -f input=sample_raster.txt output=sample_raster title="This is a sample raster"

Then if I use r.stats with 9 steps I get:

GRASS 6.1.cvs (EurLCC):~ > r.stats -nap sample_raster nsteps=9
r.stats: 100%
1-2 246878233266.702148 22.23%
2-3 122842792398.404068 11.06%
3-4 124035440868.291550 11.17%
4-5 122842792398.404068 11.06%
5-6 124035440868.291550 11.17%
6-7 122842792398.404068 11.06%
7-8 124035440868.291550 11.17%
8-9 122842792398.404068 11.06%
9-10 124035440868.291550 11.17%

But with 2 steps I get:

GRASS 6.1.cvs (EurLCC):~ > r.stats -nap sample_raster nsteps=2
r.stats: 100%
1-5.5 1110355725439.734619 100.00%
5.5-10 124035440868.291550 11.17%

Which does not make a lot of sense to me: there is too much area in the first half and too little in the second half.
Any hints appreciated. Regards,

Luigi

_______________________________________________
grassuser mailing list
grassuser@grass.itc.it
http://grass.itc.it/mailman/listinfo/grassuser