[GRASSLIST:2133] Re: r.reclass: how to reclass only part of the categories

Roger Bivand Roger.Bivand at nhh.no
Fri Jul 20 06:52:02 EDT 2001


On Fri, 20 Jul 2001 mlennert at club.worldonline.be wrote:

> Hello,
> 
> I've downloaded some GLOBE DEM files, and I would like to use them in nviz. 
> The problem is that some areas (such as the polders in Holland) have values 
> around 65500, making it difficult to use the files in nviz due to the extreme 
> differences in values. I would therefore like to reclass them in order to give 
> them all a value of -1.
> Now r.reclass allows me to either use reclass rules, but then I would have to 
> write a reclass rule for evey point between 0 and 9000 (the ones I want to 
> keep the way they are) since if I don't do it, r.reclass will class them all 
> as NULL. And if I use the r.reclass interface, I would have to do all the 
> changes to -1 by hand.
> 
> So my question: is there a reclass rule meaning something like 'leave 1 thru 
> 9000 the way they are' ?
> Or: is there a way to tell nviz to not take into accont z values outside of a 
> defined range ?

Is this perhaps a situation in which r.mapcalc would work better than
r.reclass? 

GRASS:~ > r.mapcalc "mltopo = if(topo > 200, -1, topo)"

or some such incantation? On the other hand it looks a bit as though you
are reading in signed 2-byte integers as unsigned? Then the incantation
would be to subtract (unsigned)  MAXINT for 2-byte integers (65536) from
the value you have for all values over (signed) 2-byte MAXINT (32768)? Say
you have 65530, that would give -6, a plausible value? Somehow I don't see
9000 (m?) except in the Himalayas?

Roger

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Breiviksveien 40, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 93 93
e-mail: Roger.Bivand at nhh.no
and: Department of Geography and Regional Development, University of
Gdansk, al. Mar. J. Pilsudskiego 46, PL-81 378 Gdynia, Poland.



More information about the grass-user mailing list