[GRASS-user] r.denoise inside python script

Hi all

I’m trying to run r.denoise from a python script but I’m getting some errors (below). Apparently this is about using pipe to redirect outputs (r.denoise is a bash script).

any ideas to work around this situation?

thanks

Carlos

grass.run_command(‘r.denoise’, input=elev, output=out_avg, iterations=n_iter, threshold=thrshld, epsg=4326, overwrite=ow)
Traceback (most recent call last):
File “”, line 1, in
File “/usr/local/Cellar/grass-73/7.3.svn_src_snapshot_latest/grass-7.3.svn/etc/python/grass/script/core.py”, line 408, in run_command
ps = start_command(*args, **kwargs)
File “/usr/local/Cellar/grass-73/7.3.svn_src_snapshot_latest/grass-7.3.svn/etc/python/grass/script/core.py”, line 377, in start_command
return Popen(args, **popts)
File “/usr/local/Cellar/grass-73/7.3.svn_src_snapshot_latest/grass-7.3.svn/etc/python/grass/script/core.py”, line 74, in init
subprocess.Popen.init(self, args, **kwargs)
File “/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py”, line 710, in init
errread, errwrite)
File “/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py”, line 1335, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory

···

Prof. Carlos Henrique Grohmann
Institute of Energy and Environment - Univ. of São Paulo, Brazil

  • Digital Terrain Analysis | GIS | Remote Sensing -

http://carlosgrohmann.com
http://orcid.org/0000-0001-5073-5572


Can’t stop the signal.

Hi Carlos,

On Tue, Sep 13, 2016 at 2:04 PM, Carlos Grohmann <carlos.grohmann@gmail.com>
wrote:

I'm trying to run r.denoise from a python script but I'm getting some
errors (below). Apparently this is about using pipe to redirect outputs
(r.denoise is a bash script).

What you get in the command line (without involving Python)? How did you
install r.denoise? Which version of GRASS GIS?

any ideas to work around this situation?

Provide full path to the module instead of the name or modify your PATH
variable so that r.denoise is found? (Also check shebang and executable
permissions.)

The solution might be 1) rewrite r.denoise to Python and GRASS GIS 7, so it
can go into addons, or 2) take mdenoise code which is GPL >2 and port it to
GRASS.

Vaclav