[GRASS-dev] casting row buffer in memory

Moritz Lennert mlennert at club.worldonline.be
Mon Oct 6 08:51:03 PDT 2014


On 06/10/14 17:31, Pietro wrote:
>
> Il 06/ott/2014 17:04 "Moritz Lennert" <mlennert at club.worldonline.be
> <mailto: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 <mailto: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 <http://r.info>.
>  >
>  > Why would you need r.info <http://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 <http://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.

Or just use r.recode which is meant for FCELL and DCELL. A part from a 
small bug that made using -1.0:1.0:0:255 difficult (#2053), it works 
perfectly.

Moritz

>




More information about the grass-dev mailing list