[GRASS-dev] r.cross 0 output inconsistency

Markus Neteler neteler at osgeo.org
Fri May 15 01:33:05 PDT 2015


On Wed, May 13, 2015 at 2:38 PM, Michel Wortmann
<wortmann at pik-potsdam.de> wrote:
> Hi devs,
> I found a strange r.cross behaviour, the output includes a random 0 category
> without any label information. Here an example in the NC sample location:

So you used the nc_basic location, did you take the G7 version of it?

> # set region so that all maps have non-NULL values
> g.region n=224470 s=219020 w=633040 e=640160

--> this is missing the resolution setting, so it "inherits" it from
what whay you did before.

> r.cross basins,landuse,soils out=test__
>
> r.mapcalc exp='test__0=if(test__==0)'
> r.stats test__0 -c
>> 0 335445
>> 1 189

I tested with the full NC dataset
basins  -> basin_50K
landuse -> landuse96_28m
soils     -> soilsID

GRASS 7.0.0svn (nc_spm_08_grass7): > g.region n=224470 s=219020
w=633040 e=640160 align=basin_50K -p
projection: 99 (Lambert Conformal Conic)
zone:       0
datum:      nad83
ellipsoid:  a=6378137 es=0.006694380022900787
north:      224470
south:      219020
west:       633040
east:       640160
nsres:      10
ewres:      10
rows:       545
cols:       712
cells:      388040

GRASS 7.0.0svn (nc_spm_08_grass7): > r.cross
basin_50K,landuse96_28m,soilsID out=test__
r.cross: STEP 1 ...
 100%
r.cross: STEP 2 ...
r.cross: STEP 3 ...
 100%
Creating support files for <test__>...
2507 categories

GRASS 7.0.0svn (nc_spm_08_grass7): > r.mapcalc "test__0 = if(test__==
0, 1, null() )"
 100%

GRASS 7.0.0svn (nc_spm_08_grass7): > r.stats test__0 -c
 100%
1 5
* 388035

I don't get these zeros. Please check which resolution you actually applied.

best,
Markus


More information about the grass-dev mailing list