[GRASS-dev] syntax error for r.rescale

Can anyone tell me why this raises a syntax error at the from argument?

grass.run_command(‘r.rescale’, input=mis1, output=mis1_8bit, from=‘0,2048’, to=‘0,255’)

when

r.rescale input=name [from=min,max] output=name to=min,max
[title=phrase] [–overwrite] [–help] [–verbose] [–quiet] [–ui]

(GRASS 7.6.0)

Michael


C. Michael Barton
Director, Center for Social Dynamics & Complexity
Professor of Anthropology, School of Human Evolution & Social Change
Head, Graduate Faculty in Complex Adaptive Systems Science
Arizona State University

voice: 480-965-6262 (SHESC), 480-965-8130/727-9746 (CSDC)
fax: 480-965-7671 (SHESC), 480-727-0709 (CSDC)

www: http://www.public.asu.edu/~cmbarton, http://csdc.asu.edu

I think this is because “from” is a Python keyword. But how to get around this when trying to include r.rescale in a script?

Michael


C. Michael Barton
Director, Center for Social Dynamics & Complexity
Professor of Anthropology, School of Human Evolution & Social Change
Head, Graduate Faculty in Complex Adaptive Systems Science
Arizona State University

voice: 480-965-6262 (SHESC), 480-965-8130/727-9746 (CSDC)
fax: 480-965-7671 (SHESC), 480-727-0709 (CSDC)

www: http://www.public.asu.edu/~cmbarton, http://csdc.asu.edu

On Mar 7, 2019, at 12:10 PM, Michael Barton <michael.barton@asu.edu> wrote:

Can anyone tell me why this raises a syntax error at the from argument?

grass.run_command(‘r.rescale’, input=mis1, output=mis1_8bit, from=‘0,2048’, to=‘0,255’)

when

r.rescale input=name [from=min,max] output=name to=min,max
[title=phrase] [–overwrite] [–help] [–verbose] [–quiet] [–ui]

(GRASS 7.6.0)

Michael


C. Michael Barton
Director, Center for Social Dynamics & Complexity
Professor of Anthropology, School of Human Evolution & Social Change
Head, Graduate Faculty in Complex Adaptive Systems Science
Arizona State University

voice: 480-965-6262 (SHESC), 480-965-8130/727-9746 (CSDC)
fax: 480-965-7671 (SHESC), 480-727-0709 (CSDC)

www: http://www.public.asu.edu/~cmbarton, http://csdc.asu.edu

Found it. Need to use from_ (with underscore) instead of “from”

Michael


C. Michael Barton
Director, Center for Social Dynamics & Complexity
Professor of Anthropology, School of Human Evolution & Social Change
Head, Graduate Faculty in Complex Adaptive Systems Science
Arizona State University

voice: 480-965-6262 (SHESC), 480-965-8130/727-9746 (CSDC)
fax: 480-965-7671 (SHESC), 480-727-0709 (CSDC)

www: http://www.public.asu.edu/~cmbarton, http://csdc.asu.edu

On Mar 7, 2019, at 12:18 PM, Michael Barton <michael.barton@asu.edu> wrote:

I think this is because “from” is a Python keyword. But how to get around this when trying to include r.rescale in a script?

Michael


C. Michael Barton
Director, Center for Social Dynamics & Complexity
Professor of Anthropology, School of Human Evolution & Social Change
Head, Graduate Faculty in Complex Adaptive Systems Science
Arizona State University

voice: 480-965-6262 (SHESC), 480-965-8130/727-9746 (CSDC)
fax: 480-965-7671 (SHESC), 480-727-0709 (CSDC)

www: http://www.public.asu.edu/~cmbarton, http://csdc.asu.edu

On Mar 7, 2019, at 12:10 PM, Michael Barton <michael.barton@asu.edu> wrote:

Can anyone tell me why this raises a syntax error at the from argument?

grass.run_command(‘r.rescale’, input=mis1, output=mis1_8bit, from=‘0,2048’, to=‘0,255’)

when

r.rescale input=name [from=min,max] output=name to=min,max
[title=phrase] [–overwrite] [–help] [–verbose] [–quiet] [–ui]

(GRASS 7.6.0)

Michael


C. Michael Barton
Director, Center for Social Dynamics & Complexity
Professor of Anthropology, School of Human Evolution & Social Change
Head, Graduate Faculty in Complex Adaptive Systems Science
Arizona State University

voice: 480-965-6262 (SHESC), 480-965-8130/727-9746 (CSDC)
fax: 480-965-7671 (SHESC), 480-727-0709 (CSDC)

www: http://www.public.asu.edu/~cmbarton, http://csdc.asu.edu

I think this is because “from” is a Python keyword. But how to get around this when trying to include r.rescale in a script?

Did you try from_ ?