[GRASS-dev] Use 'from=' parameter in python script

Nikos Alexandris nik at nikosalexandris.net
Thu Mar 22 00:21:13 PDT 2018


Nikos Alexandris wrote:

>> >
>> > how can I use the 'from' parameter in a python script? The following
>> > ```
>> > from_range=0,255
>> > to_range=0,511
>> > cls.runModule('r.rescale', input=band, output=output_map_name,
>> >                        from=from_range, to=to_range, overwrite=True)
>> > ```
>> >
>> > causes expectedly
>> > ```
>> > SyntaxError: invalid syntax
>> > ```
>>

Vaclav Petras a écrit :

>> Try `from_`. I'm not sure at this point if it works in a gunittest (which
>> you seem to be using).
>>
>> Vaclav

Nikos:

>I already tried that and it does not work. Yes, trying to build tests for the "new" i.rgb.his.
>
> Thank you, Nikos

Note to self: `r.rescale` works fine without the `from` parameter. The actual
minimum and the maximum values, of the `input` map are always used.

Thinking about: what would be a use case where the `from` values would need
to be user defined, which implies they would need to differ from the
map's actual minimum and maximum?

If I didn't miss anything, `grep` finds only 1 use of `r.rescale` within
a script. It is the addon `grass7/raster/r.mblend/r.mblend.py`, in line
270.

Nikos

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/grass-dev/attachments/20180322/e51d4e71/attachment.sig>


More information about the grass-dev mailing list