Opened 8 years ago

Last modified 4 years ago

#1556 new defect

wingrass - g.message in a python-script - no output

Reported by: hellik Owned by: grass-dev@…
Priority: normal Milestone: 6.4.6
Component: Python Version: svn-releasebranch64
Keywords: wingrass, python, script, g.message() Cc:
CPU: x86-32 Platform: MSWindows Vista

Description

Hi,

in a python-script (tested in selfcompiled standalone wingrass, python 2.7.2) there are following code lines:

stream_stats = grass.read_command('r.stream.stats', stream = r_strahler, 
                                                dir = r_drainage_e, 
                                                dem = 'r_elevation_crop' )
grass.message( "##################################" )        
grass.message( "output r.stream.stats %s" % stream_stats ) 
grass.message( "##################################" )

the output is only, the content of r.stream.stats-output seems to be missing.

##################################
output r.stream.stats
##################################

with DEBUG=1

D1/1: grass.script.core.start_command(): r.stream.stats
dir=a_sqlelev_drainage_e dem=r_elevation_crop
stream=a_sqlelev_strahler
D1/1: grass.script.core.start_command(): g.message
message=##################################
##################################
D1/1: grass.script.core.start_command(): g.message
message=output r.stream.stats
Summary:
Max order | Tot.N.str. | Tot.str.len. | Tot.area. | Dr.dens.
| Str.freq.
  (num)   |    (num)   |     (km)     |   (km2)   | (km/km2)
| (num/km2)
        4 |         49 |       7.0884 |    0.9233 |   7.6772
| 53.0705
Stream ratios with standard deviations:
 Bif.rt. | Len.rt. | Area.rt. | Slo.rt. | Grd.rt.
  3.5606 |  2.3439 |   3.3353 |  1.3381 |  1.3885
  1.7805 |  1.7012 |   3.5408 |  0.5520 |  0.2264
Order | Avg.len |  Avg.ar  |  Avg.sl |  Avg.grad. |
Avg.el.dif
 num  |   (km)  |  (km2)   |  (m/m)  |    (m/m)   |     (m)
    1 |  0.0989 |   0.0149 |  0.0555 |     0.0445 |  4.9936
    2 |  0.1449 |   0.0439 |  0.0576 |     0.0382 |  4.9866
    3 |  0.6236 |   0.3096 |  0.0292 |     0.0277 | 16.5627
    4 |  0.7870 |   0.9233 |  0.0271 |     0.0171 | 13.4513
Order | Std.len |  Std.ar  |  Std.sl |  Std.grad. |
Std.el.dif
 num  |   (km)  |  (km2)   |  (m/m)  |    (m/m)   |     (m)
    1 |  0.0748 |   0.0102 |  0.0274 |     0.0229 |  4.3425
    2 |  0.1401 |   0.0214 |  0.0546 |     0.0245 |  3.9989
    3 |  0.2321 |   0.1373 |  0.0041 |     0.0059 |  2.7196
    4 | -0.0000 |   0.0000 |  0.0000 |     0.0000 | -0.0000
Order | N.streams | Tot.len (km) | Tot.area (km2)
    1 |        35 |       3.4609 |  0.5201
    2 |        11 |       1.5934 |  0.4830
    3 |         2 |       1.2471 |  0.6192
    4 |         1 |       0.7870 |  0.9233
Order | Bif.rt. | Len.rt. | Area.rt. | Slo.rt. | Grd.rt. |
d.dens. | str.freq.
    1 |  3.1818 |  1.4649 |   0.0000 |  0.9647 |  1.1661 |
6.6543 | 67.2947
    2 |  5.5000 |  4.3047 |   2.9549 |  1.9723 |  1.3806 |
3.2989 | 22.7743
    3 |  2.0000 |  1.2621 |   7.0509 |  1.0775 |  1.6187 |
2.0141 |  3.2300
    4 |  0.0000 |  0.0000 |   2.9822 |  0.0000 |  0.0000 |
0.8524 |  1.0831
output r.stream.stats

any idea?

Helmut

Change History (6)

comment:1 in reply to:  description ; Changed 8 years ago by hellik

Replying to hellik:

Hi,

in a python-script (tested in selfcompiled standalone wingrass, python 2.7.2)

on a ubuntu 11.10 the r.stream.stats-output is written by g.message.

Helmut

comment:2 Changed 8 years ago by madi

Keywords: g.message() added

comment:3 in reply to:  description Changed 8 years ago by hellik

Replying to hellik:

Hi,

in a python-script (tested in selfcompiled standalone wingrass, python 2.7.2) there are following code lines:

additional information: the r.basin-script started within the grass-wxgui-command-console.

Helmut

comment:4 Changed 8 years ago by madi

Hi,

Additional info: In the same python script (r.basin),

grass.message( "##################################" )
grass.message( "Morphometric parameters of basin :" )
grass.message( "##################################\n" )	
grass.message( "Easting Centroid of basin : %s " % basin_east )
grass.message( "Northing Centroid of Basin : %s " % basin_north )
grass.message( "Rectangle containing basin N-W : %s , %s " % nw ) 
grass.message( "Rectangle containing basin S-E : %s , %s " % se )
grass.message( "Area of basin [km^2] : %s " % area_basin )

etc. work normally. So, could the problem be related to the length of the variable to print out?

Regards, madi

comment:5 in reply to:  1 Changed 8 years ago by hellik

Replying to hellik:

Replying to hellik:

Hi,

in a python-script (tested in selfcompiled standalone wingrass, python 2.7.2)

on a ubuntu 11.10 the r.stream.stats-output is written by g.message.

but not not windows, any ideas?

Helmut

comment:6 Changed 4 years ago by neteler

Milestone: 6.4.26.4.6
Note: See TracTickets for help on using tickets.