[GRASS-user] r.mapcalc map arithmetic and raster data types

Glynn Clements glynn at gclements.plus.com
Thu Jan 31 03:42:15 EST 2008


Patton, Eric wrote:

> I've differenced two raster maps that are both type DCELL; (this in
> itself is strange, as I don't have any recollection of generating
> the input maps at this level of precision; FCELL would have been
> fine)

Modules which use G_open_fp_cell_new() et al will create DCELL if the
environment variable GRASS_FP_DOUBLE is set (to any value), and FCELL
otherwise.

OTOH, some modules use G_open_raster_new(..., DCELL_TYPE), which will
always create a DCELL map. Many modules do this simply because DCELL
is a superset of the other types, while FCELL cannot exactly represent
the full range of CELL values. You can always "downgrade" a DCELL map,
but using any other type could result in a loss of precision which
cannot subsequently be undone.

> the resulting raster map was an INT map whose cell values were
> all exactly zero. Why is this so? Is this because r.mapcalc math on
> two DCELL maps can't be represented on 32-bit architecture?

This makes no sense. Please provide the exact command used, and r.info
output for all maps involved.

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


More information about the grass-user mailing list