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

Glynn Clements glynn at gclements.plus.com
Fri Jan 22 04:48:52 EST 2010


Markus Metz wrote:

> > 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.

FP data is compressed using zlib. Integer data normally uses RLE
compression, although it can be made to use zlib by setting the
environment variable GRASS_INT_ZLIB (the value doesn't matter).

Also, integer data may use between 1 and 4 bytes per cell. Each row
has a prefix byte which indicates how many bytes per cell are used for
that row. Negative values always require 4 bytes.

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-user mailing list