[GRASS-dev] r.reclass only for int maps
Glynn Clements
glynn at gclements.plus.com
Sat Oct 8 22:36:53 EDT 2011
Martin Landa wrote:
> is there any reason why r.reclass does not support FP raster maps?
The immediate reason is that the underlying functionality in libgis
doesn't support it. r.reclass merely creates the tables; it's libgis
which uses them.
It would be a relatively simple matter to extend the existing
functionality to allow reclassing an integer map to an FP map (i.e.
the reclass table could contain FP values instead of integers).
It would be somewhat more complex to support "reclassing" an FP map. I
use quotes because the term implies that the data consists of discrete
classes (categories). Ultimately, a reclass table is just that: a
table, i.e. an array, and you can't use floats as array indices.
While there's no fundamental issue with defining a mapping whose
domain is floating-point numbers (we already do this for colour
tables), it is bound to be significantly slower than the integer case.
And probably less useful.
A mapping from integers to integers can be described by a look-up
table, but a mapping from floats to either integers or floats can't be
(at least, not realistically). So you have to decide upon the nature
of the approximation: piecewise linear, cubic spline, rational spline,
or something else entirely? Or do we merge r.mapcalc into libraster so
that maps can be "reclassed" by arbitrary algebraic expressions?
--
Glynn Clements <glynn at gclements.plus.com>
More information about the grass-dev
mailing list