[GRASS-dev] casting row buffer in memory

Pietro peter.zamb at gmail.com
Mon Oct 6 08:31:15 PDT 2014


Il 06/ott/2014 17:04 "Moritz Lennert" <mlennert at club.worldonline.be> ha
scritto:
>
> On 06/10/14 16:14, Pietro wrote:
>>
>> On Mon, Oct 6, 2014 at 3:17 PM, Moritz Lennert
>> <mlennert at club.worldonline.be> wrote:
>>>
>>> On 06/10/14 14:54, Pietro wrote:
>>>>
>>>>
>>>> Trying to circumvent the r.mapcalc min/max limit,
>>>
>>>
>>>
>>> Just out of curiosity: why don't you just use r.recode or r.rescale ?
>>
>>
>> r.rescale was my first option, but it just reclassify in two
>> categories 1 and 255.
>
>
> r.rescale assumes that input is integer, so if you feed it values between
0 and 1 then yes, but using the NC data as example and feeding it the
elevation data directly:
>
> r.rescale elevation out=elevation_0_255 to=0,255
>
> gives the expected result.

To make the example reproducible I've scaled the elevation map to have all
the values between 0 and 1.

So as you said r.rescale is not an option.

>> I didn't thought about r.recode...but I think that easier combining
r.info.
>
> Why would you need r.info for that ?

Sorry I was in harry to catch the train... I was too succinct... I mean as
you suggested combine r.mapcalc and r.info to rescale...

Another option is to modify r.rescale to work with CELL,FCELL, and DCELL.
I don't see any particular reason to limit the module to the cell case...

> Dividing by the max and then rescaling should give the same
> result as rescaling from the original values... All you are
> doing is dividing all values by a constant before rescaling.

Yes, this was just an example using the north Carolina data set to make the
problem reproducible...

But it is true I can also multiply my map to 10000 and then use r.rescale.
I think should work.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-dev/attachments/20141006/cd98e28a/attachment.html>


More information about the grass-dev mailing list