[GRASS-dev] another grass python library question

Here is another issue with an infurating problem of parameter pairs.

I have input map names saved to a set of variables.
I want to do the following:

grass.run_command('g.copy ', raster=[variable],[mapname])

The output [mapname] can be a string for a mapname or a previously defined variable containing the mapname.

I’ve looked at the docs for the scripting and python libraries and nothing there helps. I consistently get a file not found error or a syntax error if I try to use string substitution.

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

What about:

grass.run_command(‘g.copy ‘, raster=’{},{}’.format(variable, ‘mapname’)

Could try. I found another way, after trying several that didn't work.

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 2:22 PM, Stefan Blumentrath <Stefan.Blumentrath@nina.no<mailto:Stefan.Blumentrath@nina.no>> wrote:

What about:
grass.run_command('g.copy ', raster='{},{}'.format(variable, 'mapname')