[GRASS-user] r.rescale error

Hi -

I am trying to run r.rescale to apply a contrast stretch to an image to allow me to more easily locate ground control points using Georectify. When I run the following command:

r.rescale input=Quickbird.blue@PERMANENT from=48,106 output=Quickbird.blue.scale to=0,255

I get the following error:

Rescale Quickbird.blue@PERMANENT[48,106] to Quickbird.blue.scale[0,255]
ERROR: Required parameter <rules> not set:
     (File containing reclass rules).
Description:
  Reclassify raster map based on category values.
  Creates a new raster map whose category values are based
upon a reclassification of the categories in an existing
raster map.

I would expect the reclass rules to be provided by r.rescale but maybe I'm missing something. Is this a user problem or a bug?

Ned

Ned Horning wrote:

I am trying to run r.rescale to apply a contrast stretch to an image to
allow me to more easily locate ground control points using Georectify.
When I run the following command:

r.rescale input=Quickbird.blue@PERMANENT from=48,106
output=Quickbird.blue.scale to=0,255

I get the following error:

Rescale Quickbird.blue@PERMANENT[48,106] to Quickbird.blue.scale[0,255]
ERROR: Required parameter <rules> not set:
     (File containing reclass rules).
Description:
  Reclassify raster map based on category values.
  Creates a new raster map whose category values are based
upon a reclassification of the categories in an existing
raster map.

I would expect the reclass rules to be provided by r.rescale but maybe
I'm missing something. Is this a user problem or a bug?

It's a bug. The rules= parameter became mandatory some time prior to
the release of 6.4.0, but r.rescale wasn't updated accordingly. In
6.5, rules= is optional; in 7.0, r.rescale passes rules=- to
r.reclass.

However, if you just want to change the visual appearance, r.rescale
probably isn't the right tool. I'd suggest using r.colors to change
the colour table, e.g.:

  $ r.colors Quickbird.blue rules=- <<EOF
  48 black
  106 white
  EOF

If the actual range of the raster is 48-106, you can just use
"r.colors ... color=grey"; most pre-defined rules map to the range of
the data.

--
Glynn Clements <glynn@gclements.plus.com>