Hi,
I'm writing my first GRASS Python script and am having trouble adding
options to commands that I want to run. For example, the following
works:
-----
grass.run_command("r.in.xyz", input=directory+'/'+file,
output=rainraster, fs=',', x=2, y=1)
-----
but this doesn't:
-----
grass.run_command("r.in.xyz", --overwrite, input=directory+'/'+file,
output=rainraster, fs=',', x=2, y=1)
-----
neither does this:
-----
grass.run_command("r.in.xyz --overwrite", input=directory+'/'+file,
output=rainraster, fs=',', x=2, y=1)
-----
How can I get this to work, or is there a better way of doing it using
a command other than grass.run_command?
Thanks
Hanlie
martinl
September 3, 2010, 4:01pm
2
2010/9/3 Hanlie Pretorius <hanlie.pretorius@gmail.com>:
grass.run_command("r.in.xyz", input=directory+'/'+file,
output=rainraster, fs=',', x=2, y=1)
better `input = os.path.join(directory, file)`
but this doesn't:
-----
grass.run_command("r.in.xyz", --overwrite, input=directory+'/'+file,
output=rainraster, fs=',', x=2, y=1)
neither does this:
-----
grass.run_command("r.in.xyz --overwrite", input=directory+'/'+file,
output=rainraster, fs=',', x=2, y=1)
should be `overwrite = True` instead `--overwrite`
Martin
--
Martin Landa <landa.martin gmail.com> * http://gama.fsv.cvut.cz/~landa
Thanks
2010/9/3, Martin Landa <landa.martin@gmail.com>:
2010/9/3 Hanlie Pretorius <hanlie.pretorius@gmail.com>:
grass.run_command("r.in.xyz", input=directory+'/'+file,
output=rainraster, fs=',', x=2, y=1)
better `input = os.path.join(directory, file)`
but this doesn't:
-----
grass.run_command("r.in.xyz", --overwrite, input=directory+'/'+file,
output=rainraster, fs=',', x=2, y=1)
neither does this:
-----
grass.run_command("r.in.xyz --overwrite", input=directory+'/'+file,
output=rainraster, fs=',', x=2, y=1)
should be `overwrite = True` instead `--overwrite`
Martin
--
Martin Landa <landa.martin gmail.com> * http://gama.fsv.cvut.cz/~landa
Martin Landa wrote:
> but this doesn't:
> -----
> grass.run_command("r.in.xyz", --overwrite, input=directory+'/'+file,
> output=rainraster, fs=',', x=2, y=1)
> neither does this:
> -----
> grass.run_command("r.in.xyz --overwrite", input=directory+'/'+file,
> output=rainraster, fs=',', x=2, y=1)
should be `overwrite = True` instead `--overwrite`
Likewise for "quiet" and "verbose".
Any normal (single-dash) flags must specified via "flags=...", e.g.:
r.something -a -b -c ...
becomes:
grass.run_command("r.something", flags="abc", ...)
--
Glynn Clements <glynn@gclements.plus.com>