[GRASS-dev] Quiet module output

Hi,

I just wanted to ask how the "quiet"-flag is defined. I mean, what
will be still reported to the screen (console)? How is it with
self-written e.g. add-ons
in python. If "quiet" is set are all grass output messages
automatically suppressed?

What about the status report of counting percentages (0%...100%) in general?
If I remember correctly they are not suppressed in r.cost. That is slightly
annoying when running such modules in loops and the screen gets completely
covered with 100%s...

/johannes

On Wednesday 20 of March 2013 15:00:23 Johannes Radinger wrote:

Hi,

I just wanted to ask how the "quiet"-flag is defined. I mean, what
will be still reported to the screen (console)? How is it with
self-written e.g. add-ons
in python. If "quiet" is set are all grass output messages
automatically suppressed?

What about the status report of counting percentages (0%...100%) in general?
If I remember correctly they are not suppressed in r.cost. That is slightly
annoying when running such modules in loops and the screen gets completely
covered with 100%s...

Johannes,

you do know the related environment variables

GRASS_MESSAGE_FORMAT
GRASS_VERBOSE

right?

Check <http://grass.osgeo.org/grass64/manuals/variables.html&gt;\. Especially for
the "VERBOSE" one, the manual states:

"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."

Best, Nikos

Hi,

thank you for the hint with GRASS_VERBOSE...

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? I'd like to get all grass_fatal(_()) error messages of
my own script but no progress message for all dependent modules in the
script (GRASS_VERBOSE=0). So how can I set the GRASS_VERBOSE to "0"
for a script so it is inherited to all underlying modules, as it seems
there is no g.parser flag provided for "0"? Therefore, is e.g.
g.gisenv set="GRASS_VERBOSE=0" before running the script or including
that line within the script the way to go?

/johannes

On Wed, Mar 20, 2013 at 10:01 PM, Nikos Alexandris
<nik@nikosalexandris.net> wrote:

On Wednesday 20 of March 2013 15:00:23 Johannes Radinger wrote:

Hi,

I just wanted to ask how the "quiet"-flag is defined. I mean, what
will be still reported to the screen (console)? How is it with
self-written e.g. add-ons
in python. If "quiet" is set are all grass output messages
automatically suppressed?

What about the status report of counting percentages (0%...100%) in general?
If I remember correctly they are not suppressed in r.cost. That is slightly
annoying when running such modules in loops and the screen gets completely
covered with 100%s...

Johannes,

you do know the related environment variables

GRASS_MESSAGE_FORMAT
GRASS_VERBOSE

right?

Check <http://grass.osgeo.org/grass64/manuals/variables.html&gt;\. Especially for
the "VERBOSE" one, the manual states:

"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."

Best, Nikos

On 21/03/13 11:18, Johannes Radinger wrote:

Hi,

thank you for the hint with GRASS_VERBOSE...

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

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
(http://grasswiki.osgeo.org/wiki/GRASS_Python_Scripting_Library#Interfacing_with_NumPy)
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?

/johannes

On Thu, Mar 21, 2013 at 11:49 AM, Moritz Lennert
<mlennert@club.worldonline.be> wrote:

On 21/03/13 11:18, Johannes Radinger wrote:

Hi,

thank you for the hint with GRASS_VERBOSE...

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