[GRASS-user] SOLVED: How to implement 2D lookup table?

Rainer M Krug Rainer at krugs.de
Fri May 24 00:11:49 PDT 2013


On Friday, May 24, 2013, Glynn Clements wrote:

>
> Rainer M. Krug wrote:
>
> > >> Hmm - sounds interesting, but also for other purposes. But as the
> result
> > >> will be a raster map, I don't think this approach is usable here
> (unless
> > >> I can feed the numbers back into a raster map, i.e. the inverse of
> > >> r.stats -c)
> > >
> > > r.cross + r.reclass ?
> >
> > There is one aspect in r.cross which makes this approach quite
> > difficult to implement: the value of the result map layer can not easily
> > be traced back to the values of the two input layers:
>
> If you only have a small number of classes, you can just create the
> cross-product manually, e.g.:
>
>         r.mapcalc 'result = ageClass * 10 + dc'


Yes - This is effectively what I am doing now.


>
> So a category of 15 would be ageClass=1, dc=5.
>
> r.cross is more useful when the total number of pairs which actually
> occur is much fewer than the product of the numbers of categories, as
> it only creates a category for each combination which actually occurs,
> not for each potential combination.


True. The problem I have with r.cross is that I have to manually decode
afterwords what combination the value refers to. I could use a she'll
script to translate the category values, but this sounds a little tedious,
especially as the format is not that easily parsable.

Cheers,

Rainer


>
> --
> Glynn Clements <glynn at gclements.plus.com <javascript:;>>
>


-- 
NEW GERMAN FAX NUMBER!!!

Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology,
UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Natural Sciences Building
Office Suite 2039
Stellenbosch University
Main Campus, Merriman Avenue
Stellenbosch
South Africa

Cell:           +27 - (0)83 9479 042
Fax:            +27 - (0)86 516 2782
Fax:            +49 - (0)321 2125 2244
email:          Rainer at krugs.de

Skype:          RMkrug
Google:         R.M.Krug at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20130524/730e5ac0/attachment.html>


More information about the grass-user mailing list