[GRASS-user] forcing raster accept only integer >0

Markus Metz markus.metz.giswork at googlemail.com
Fri Jan 22 04:06:14 EST 2010

Milton Cezar Ribeiro wrote:
> Dear all.
> I am trying to work around with a problem of map size under Vista (>2G).
> I was wondering if I use the command below I will get a raster
> map with values integer and >=0.
>     r.mapcalc "Dem.new=if(Dem>=0,int(Dem),null())"
If the original DEM is of type DCELL, you can reduce file sizes with
r.mapcalc "DEM.float = float(DEM)"
because one DCELL value needs 8 byte whereas both FCELL and CELL values 
need 4 bytes each.
Converting from FCELL to CELL doesn't make a big difference, I even 
found that sometimes FCELL raster maps are higher compressed in GRASS 
than CELL raster maps.

I would rather try to keep decimal places for elevation maps, results 
are in my experience more accurate with floating point than with integer 
(e.g. 1m vertical resolution) maps (notwithstanding that a vertical 
resolution of say 0.1 micrometer is IMHO nonsense).

Just my .2c

Markus M

> As my original map have values positive and negative, as well as
> it is fload, my question is if are there a way of I force my output
> map accept only integers>=0. By the way, is there a way
> of I know if a map is float or integer?
> bests
> milton
> ------------------------------------------------------------------------
> _______________________________________________
> grass-user mailing list
> grass-user at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-user

More information about the grass-user mailing list