[GRASS5] r.reclass

Roger S. Miller rgrmill at rt66.com
Thu May 17 12:29:13 EDT 2001


Eric, Bob and Markus,

Eric wrote:

> What I mean, is a reclassification is essentially categorical/interval.  Can
> you see why anyone would want to do a reclass of a floating point as another
> floating point?  Not to mention the weirdness of representing some
> floating point numbers exactly...  Anyway, I see these scenarios:
>
> CELL  -> CELL
> FCELL -> CELL
> DCELL -> CELL

I think in my ideal world most of the useful reclassifications would be

CELL -> CELL
CELL -> FCELL
CELL -> DCELL

That is, a basic map structure would be stored as a CELL map for small
size and speed of access and then the CELL map would be reclassified with
either different CELL values or with floating point data.

For instance, I have a CELL map in which each raster is categorized
according to its position in a ground water model finite-difference grid.
I prepare maps from that CELL map by reclassifying it with groundwater
levels calculated by the model.

If I'm just interested in illustrating the raw model results, then it
isn't a problem to convert the model results to integer values and
reclassify the original cell map as another cell map.  If I want to use
the map for some other calculation -- change in water level over time, for
instance -- then the requirements are different.  I need to reclassify the
map using floating point values.  Calculations based on integer values
contain extraneous results caused by imprecision.

Creating a new raster map for each instance isn't a very good option.  The
ground water model output doesn't include geographic data.
Reclassification allows me to use geographic data stored in the original
CELL map to provide a geographic intrepretation of the model results.
Otherwise I would have to reproduce the geographic data each time I wanted
to see a new set of model results.  Also, each result would be produced as
a separate large raster file which -- even with compression -- is several
times larger than the reclass file.

As Bob and Markus suggest, r.recode might be an option.  Correct me if I
misunderstand.  Doesn't r.recode create a new raster map each time it's
invoked?

Last year we got the project files for a watershed analysis done at
Blacklands. The analysis was based on a large satellite image mosaic.  I
think the base raster map alone (a GRASS 4 product) was about 14 megabytes
of data. The analysis included at least a dozen reclass maps based on the
original, but each of the reclass files was only a few thousands bytes.
If they were each a different raster map then the project would have been
impractical in my environment.

If my understanding of r.recode is right then there is still a real
need for r.reclass.

I spent some time last night studying the code underlying r.reclass.  It
appears that none of the code has been brought up to GRASS 5 floating
point functionality.  More importantly, the reclass file contains no
information on the raster type.  Instead, that information must come from
the header of the raster file that is being reclassed.  I haven't yet
imagined a way to allow type changes during reclassification without
storing type data in the reclass file and probably breaking existing
reclass maps.  Without storing type data in the reclass file I think that
the only reclassifications possible are

CELL-> CELL
FCELL -> FCELL
DCELL -> DCELL

Does anyone see a way around that?  If not, then the FCELL->FCELL and
DCELL->DCELL reclassification is still useful, just not as useful as it
could be.


Roger Miller
Lee Wilson and Associates


---------------------------------------- 
If you want to unsubscribe from GRASS Development Team mailing list write to:
minordomo at geog.uni-hannover.de with
subject 'unsubscribe grass5'



More information about the grass-dev mailing list