[GRASS-dev] Quiet module output

Johannes Radinger johannesradinger at gmail.com
Thu Mar 21 08:57:03 PDT 2013

I agree, --quiet set GRASS_VERBOSE to 0.
But this is not always inherited. Eg. in one of my python scripts I
use the GRASS-Numpy interface
My script is very similar to the example in the wiki, where I use
".read()" to get GRASS maps
into numpy and ".write()" to get numpy arrays to GRASS.

And here the ".write()" uses actually r.bin.in to write the file back
into grass.
For this process the progress message (...100%) is shown still although the
flag "quiet" is set for the entire script. Looking at the debugging output when
running the script I see that 1) the ".read()" uses r.out.bin --q but
the ".write()"
uses r.in.bin --v. So is that setting respectively the definition
of ".write()" with the verbose-flag interfering?

Anybody an idea how to fix that, so that the GRASS_VERBOSE variable
is also inherited to .write() commands in a python.script?


On Thu, Mar 21, 2013 at 11:49 AM, Moritz Lennert
<mlennert at club.worldonline.be> wrote:
> On 21/03/13 11:18, Johannes Radinger wrote:
>> Hi,
>> thank you for the hint with GRASS_VERBOSE...
>> [all modules]
>> toggles verbosity level
>> 0 - only errors and warnings are printed
>> 1 - progress messages are printed (percent complete)
>> 2 - all module messages are printed
>> 3 - additional verbose messages are printed
>> This variable is automatically created by g.parser so that the
>> --verbose or --quiet flags will be inherited by dependent modules as
>> the script runs.
>> What is still unclear to me: Setting the --quiet flag in a script
>> using g.parser (what I am doing) automatically sets the GRASS_VERBOSE
>> variable to 1?
> --quiet should set it to 0 (actually to MINLEVEL, but that is defined as 0
> in lib/gis/verbose.c).
> I can confirm that:
> r.stats elevation -c
> gives me the percent complete info.
> r.stats elevation -c --quiet
> doesn't.
> Moritz

More information about the grass-dev mailing list