[GRASS-user] weird results with mapcalc on different region extents

maning sambale emmanuel.sambale at gmail.com
Thu Mar 11 02:05:44 EST 2010


Hi,

I have this simple mapcalc run that determines the proportion of
landcover type over the land, given a moving window.

A = binary map 1=with cover pixels, 0=w/o cover pixels
B = binary map 1=land pixels 0=non-land pixels
WINDOW = 5

r.neighbors input=A output=C method=sum size="$WINDOW" --o
r.neighbors input=B output=D method=sum size="$WINDOW" --o

r.mapcalc << EOF
E = 1.0 * C
F = 1.0 * D
pf = (E/D)
EOF

pf should result in a percentage of cover pixels over the land.

If I run the data in a small region and the results are OK.
r.info -r pf
min=0
max=1

r.stats -acp pf
 100%
0-0.003922 83506029.482130 102816  26.75%
0.039216-0.043137 1436762.431469 1769   0.46%
0.047059-0.05098 1624.378102 2   0.00%
0.066667-0.070588 2436.567153 3   0.00%
0.078431-0.082353 916149.249687 1128   0.29%
0.098039-0.101961 812.189051 1   0.00%
0.117647-0.121569 987621.886188 1216   0.32%
0.14902-0.152941 812.189051 1   0.00%
0.156863-0.160784 724472.633618 892   0.23%
0.2-0.203922 990058.453341 1219   0.32%
0.239216-0.243137 842240.046034 1037   0.27%
0.247059-0.25098 1624.378102 2   0.00%
0.266667-0.270588 2436.567153 3   0.00%
0.278431-0.282353 616451.489816 759   0.20%
0.298039-0.301961 1624.378102 2   0.00%
0.317647-0.321569 604268.654049 744   0.19%
0.333333-0.337255 1624.378102 2   0.00%
0.356863-0.360784 660309.698578 813   0.21%
0.4-0.403922 1019297.259182 1255   0.33%
0.439216-0.443137 621324.624123 765   0.20%
0.447059-0.45098 1624.378102 2   0.00%
0.466667-0.470588 1624.378102 2   0.00%
0.478431-0.482353 614827.111714 757   0.20%
0.498039-0.501961 1624.378102 2   0.00%
0.517647-0.521569 594522.385435 732   0.19%
0.533333-0.537255 1624.378102 2   0.00%
0.556863-0.560784 645690.295657 795   0.21%
0.6-0.603922 1009550.990569 1243   0.32%
0.639216-0.643137 631883.081788 778   0.20%
0.647059-0.65098 2436.567153 3   0.00%
0.666667-0.670588 1624.378102 2   0.00%
0.678431-0.682353 644878.106606 794   0.21%
0.698039-0.701961 3248.756205 4   0.00%
0.717647-0.721569 605080.843100 745   0.19%
0.733333-0.737255 1624.378102 2   0.00%
0.74902-0.752941 812.189051 1   0.00%
0.756863-0.760784 808940.294937 996   0.26%
0.8-0.803922 1011175.368671 1245   0.32%
0.839216-0.843137 745589.548948 918   0.24%
0.847059-0.85098 3248.756205 4   0.00%
0.866667-0.870588 4873.134307 6   0.00%
0.878431-0.882353 998180.343853 1229   0.32%
0.898039-0.901961 1624.378102 2   0.00%
0.917647-0.921569 933205.219761 1149   0.30%
0.933333-0.937255 8121.890511 10   0.00%
0.94902-0.952941 8934.079563 11   0.00%
0.956863-0.960784 1423767.406651 1753   0.46%
0.996078-1 93443162.522784 115051  29.94%
* 115074193.521699 141684  36.87%

But, when I run the data in the full map region, I get a different result

r.info -r pf
min=0
max=25
r.stats -acp pf
 100%
0-0.098039 1593170550.199143 1961576  39.19%
0.098039-0.196078 18625931.509825 22933   0.46%
0.196078-0.294118 26394519.783980 32498   0.65%
0.294118-0.392157 13855133.023422 17059   0.34%
0.392157-0.490196 24355925.265619 29988   0.60%
0.490196-0.588235 13444165.363544 16553   0.33%
0.588235-0.686275 24779075.761263 30509   0.61%
0.686275-0.784314 15370677.792853 18925   0.38%
0.784314-0.882353 29887744.892934 36799   0.74%
0.882353-0.980392 25306186.455453 31158   0.62%
0.980392-1.078431 1858477789.081065 2288233  45.71%
1.078431-1.176471 77970.148910 96   0.00%
1.176471-1.27451 51980.099273 64   0.00%
1.27451-1.372549 25177.860585 31   0.00%
1.372549-1.470588 21116.915330 26   0.00%
1.470588-1.568627 28426.616790 35   0.00%
1.568627-1.666667 5685.323358 7   0.00%
1.666667-1.764706 14619.402921 18   0.00%
1.764706-1.862745 17055.970074 21   0.00%
1.862745-1.960784 14619.402921 18   0.00%
1.960784-2.058824 4873.134307 6   0.00%
2.058824-2.156863 14619.402921 18   0.00%
2.156863-2.254902 5685.323358 7   0.00%
2.254902-2.352941 11370.646716 14   0.00%
2.352941-2.45098 1624.378102 2   0.00%
2.45098-2.54902 11370.646716 14   0.00%
2.54902-2.647059 3248.756205 4   0.00%
2.647059-2.745098 2436.567153 3   0.00%
2.745098-2.843137 12995.024818 16   0.00%
2.843137-2.941176 812.189051 1   0.00%
2.941176-3.039216 7309.701460 9   0.00%
3.039216-3.137255 10558.457665 13   0.00%
3.137255-3.235294 812.189051 1   0.00%
3.235294-3.333333 812.189051 1   0.00%
3.333333-3.431373 4060.945256 5   0.00%
3.431373-3.529412 812.189051 1   0.00%
3.529412-3.627451 8934.079563 11   0.00%
3.627451-3.72549 1624.378102 2   0.00%
3.72549-3.823529 1624.378102 2   0.00%
3.823529-3.921569 812.189051 1   0.00%
3.921569-4.019608 3248.756205 4   0.00%
4.117647-4.215686 10558.457665 13   0.00%
4.313725-4.411765 812.189051 1   0.00%
4.411765-4.509804 812.189051 1   0.00%
4.509804-4.607843 812.189051 1   0.00%
4.607843-4.705882 812.189051 1   0.00%
5-5.098039 20304.726279 25   0.00%
5.196078-5.294118 812.189051 1   0.00%
5.294118-5.392157 2436.567153 3   0.00%
5.980392-6.078431 5685.323358 7   0.00%
6.176471-6.27451 12995.024818 16   0.00%
6.27451-6.372549 812.189051 1   0.00%
6.666667-6.764706 812.189051 1   0.00%
6.960784-7.058824 1624.378102 2   0.00%
7.254902-7.352941 812.189051 1   0.00%
7.45098-7.54902 812.189051 1   0.00%
7.647059-7.745098 812.189051 1   0.00%
7.941176-8.039216 3248.756205 4   0.00%
8.333333-8.431373 13807.213869 17   0.00%
8.921569-9.019608 2436.567153 3   0.00%
9.411765-9.509804 812.189051 1   0.00%
10-10.098039 3248.756205 4   0.00%
10.490196-10.588235 2436.567153 3   0.00%
10.980392-11.078431 2436.567153 3   0.00%
11.960784-12.058824 2436.567153 3   0.00%
12.45098-12.54902 10558.457665 13   0.00%
12.941176-13.039216 1624.378102 2   0.00%
13.921569-14.019608 812.189051 1   0.00%
15-15.098039 1624.378102 2   0.00%
15.980392-16.078431 1624.378102 2   0.00%
16.960784-17.058824 1624.378102 2   0.00%
18.921569-19.019608 1624.378102 2   0.00%
20-20.098039 1624.378102 2   0.00%
22.941176-23.039216 4873.134307 6   0.00%
23.921569-24.019608 7309.701460 9   0.00%
24.901961-25 14619.402921 18   0.00%
* 421552919.784229 519033  10.37%

The range of values are not in percentage anymore (0-25).

Any ideas?  Using GRASS 6.4.0RC5 from Kingchaos binaries.

Thanks!
-- 
cheers,
maning
------------------------------------------------------
"Freedom is still the most radical idea of all" -N.Branden
wiki: http://esambale.wikispaces.com/
blog: http://epsg4253.wordpress.com/
------------------------------------------------------


More information about the grass-user mailing list