[GRASS-user] Errors returned for r.stream.order

Hello

OS = Win 10

GRASS GIS Version 8.3.0 64 Bit

I am attempting to create a stream classification and have tried the two approaches below.

Is there something wrong with my approach?

Try 1

gs.run_command(‘r.fill.dir’, input=input_raster, output=‘fill’, direction=‘flowdir_fill’, overwrite=True)

gs.run_command(‘r.watershed’, flags=‘sa’, elevation=‘fill’, threshold=500000, basin=‘raster_basin’, accumulation=‘flowacc’, stream=‘stream_raster_watershed’, overwrite=True)

gs.run_command(‘r.stream.order’, stream_rast=‘stream_raster_watershed’, direction=‘flowdir_fill’, elevation=input_raster, accumulation=‘flowacc’, stream_vect=‘stream_vect’, strahler=‘strahler’, overwrite=True)

Try 2

gs.run_command(‘r.fill.dir’, input=input_raster, output=‘fill’, direction=‘flowdir_fill’, overwrite=True)

gs.run_command(‘r.stream.extract’, elevation=input_raster, threshold=stream_threshold, stream_raster=‘stream_raster’, stream_vector=‘stream_vector’, direction=‘flowdir_extract’, overwrite=True)

gs.run_command(‘r.stream.order’, stream_rast=‘stream_raster_watershed’, direction=‘flowdir_extract’, elevation=input_raster, accumulation=‘flowacc’, stream_vect=‘stream_vect’, strahler=‘strahler’, overwrite=True)

The GRASS GIS system returns the following error message to me;

Traceback (most recent call last):

File

“F:\grassdata\hydro\PERMANENT.tmp\unknown\4728.20.py”, line

255, in

main()

File

“F:\grassdata\hydro\PERMANENT.tmp\unknown\4728.20.py”, line

217, in main

gs.run_command(‘r.stream.order’,

File "C:\Program Files\GRASS GIS

8.3\etc\python\grass\script\core.py", line 466, in

run_command

return handle_errors(returncode, result=None, args=args,

kwargs=kwargs)

File "C:\Program Files\GRASS GIS

8.3\etc\python\grass\script\core.py", line 345, in

handle_errors

raise CalledModuleError(module=module, code=code,

returncode=returncode)

grass.exceptions.CalledModuleError: Module run

`r.stream.order --o stream_rast=stream_raster_watershed

direction=flowdir_extract elevation=dtm-002-004

accumulation=flowacc stream_vect=stream_vect

strahler=strahler` ended with an error.

The subprocess ended with a non-zero return code:

3221225781. See errors above the traceback or in the error

output.

Regards

Ben Davies

Please provide also your computational region settings. Could be that
you are simply running out of RAM?

Māris.

trešd., 2025. g. 12. marts, plkst. 07:24 — lietotājs Ben Davies via
grass-user (<grass-user@lists.osgeo.org>) rakstīja:

OFFICIAL

Hello

OS = Win 10

GRASS GIS Version 8.3.0 64 Bit

I am attempting to create a stream classification and have tried the two approaches below.

Is there something wrong with my approach?

Try 1

gs.run_command('r.fill.dir', input=input_raster, output='fill', direction='flowdir_fill', overwrite=True)

gs.run_command('r.watershed', flags='sa', elevation='fill', threshold=500000, basin='raster_basin', accumulation='flowacc', stream='stream_raster_watershed', overwrite=True)

gs.run_command('r.stream.order', stream_rast='stream_raster_watershed', direction='flowdir_fill', elevation=input_raster, accumulation='flowacc', stream_vect='stream_vect', strahler='strahler', overwrite=True)

Try 2

gs.run_command('r.fill.dir', input=input_raster, output='fill', direction='flowdir_fill', overwrite=True)

gs.run_command('r.stream.extract', elevation=input_raster, threshold=stream_threshold, stream_raster='stream_raster', stream_vector='stream_vector', direction='flowdir_extract', overwrite=True)

gs.run_command('r.stream.order', stream_rast='stream_raster_watershed', direction='flowdir_extract', elevation=input_raster, accumulation='flowacc', stream_vect='stream_vect', strahler='strahler', overwrite=True)

The GRASS GIS system returns the following error message to me;

Traceback (most recent call last):

  File

"F:\grassdata\hydro\PERMANENT\.tmp\unknown\4728.20.py", line

255, in <module>

    main()

  File

"F:\grassdata\hydro\PERMANENT\.tmp\unknown\4728.20.py", line

217, in main

    gs.run_command('r.stream.order',

  File "C:\Program Files\GRASS GIS

8.3\etc\python\grass\script\core.py", line 466, in

run_command

    return handle_errors(returncode, result=None, args=args,

kwargs=kwargs)

  File "C:\Program Files\GRASS GIS

8.3\etc\python\grass\script\core.py", line 345, in

handle_errors

    raise CalledModuleError(module=module, code=code,

returncode=returncode)

grass.exceptions.CalledModuleError: Module run

`r.stream.order --o stream_rast=stream_raster_watershed

direction=flowdir_extract elevation=dtm-002-004

accumulation=flowacc stream_vect=stream_vect

strahler=strahler` ended with an error.

The subprocess ended with a non-zero return code:

3221225781. See errors above the traceback or in the error

output.

Regards

Ben Davies

________________________________
This message is confidential and is intended for the recipient named above. If you are not the intended recipient, you must not disclose, use or copy the message or any part of it. If you received this message in error, please notify the sender immediately by replying to this message, then delete it from your system.
_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user

The flow accumulation from r.watershed should go into r.stream.exrract as the input accumulation to calculate a stream raster and flow direction. Then the flow accumulation, flow direction, stream raster, etc should go into r.stream.order.

From a glance, try one is missing r.stream.extract. Try two is missing r.watershed. See my tutorial here: https://baharmon.github.io/watersheds-in-grass/#stream-order

On Wed, Mar 12, 2025, 2:27 AM Maris Nartiss via grass-user <grass-user@lists.osgeo.org> wrote:

Please provide also your computational region settings. Could be that
you are simply running out of RAM?

Māris.

trešd., 2025. g. 12. marts, plkst. 07:24 — lietotājs Ben Davies via
grass-user (<grass-user@lists.osgeo.org>) rakstīja:

OFFICIAL

Hello

OS = Win 10

GRASS GIS Version 8.3.0 64 Bit

I am attempting to create a stream classification and have tried the two approaches below.

Is there something wrong with my approach?

Try 1

gs.run_command(‘r.fill.dir’, input=input_raster, output=‘fill’, direction=‘flowdir_fill’, overwrite=True)

gs.run_command(‘r.watershed’, flags=‘sa’, elevation=‘fill’, threshold=500000, basin=‘raster_basin’, accumulation=‘flowacc’, stream=‘stream_raster_watershed’, overwrite=True)

gs.run_command(‘r.stream.order’, stream_rast=‘stream_raster_watershed’, direction=‘flowdir_fill’, elevation=input_raster, accumulation=‘flowacc’, stream_vect=‘stream_vect’, strahler=‘strahler’, overwrite=True)

Try 2

gs.run_command(‘r.fill.dir’, input=input_raster, output=‘fill’, direction=‘flowdir_fill’, overwrite=True)

gs.run_command(‘r.stream.extract’, elevation=input_raster, threshold=stream_threshold, stream_raster=‘stream_raster’, stream_vector=‘stream_vector’, direction=‘flowdir_extract’, overwrite=True)

gs.run_command(‘r.stream.order’, stream_rast=‘stream_raster_watershed’, direction=‘flowdir_extract’, elevation=input_raster, accumulation=‘flowacc’, stream_vect=‘stream_vect’, strahler=‘strahler’, overwrite=True)

The GRASS GIS system returns the following error message to me;

Traceback (most recent call last):

File

“F:\grassdata\hydro\PERMANENT.tmp\unknown[4728.20.py](http://4728.20.py)”, line

255, in

main()

File

“F:\grassdata\hydro\PERMANENT.tmp\unknown[4728.20.py](http://4728.20.py)”, line

217, in main

gs.run_command(‘r.stream.order’,

File "C:\Program Files\GRASS GIS

8.3\etc\python\grass\script\core.py", line 466, in

run_command

return handle_errors(returncode, result=None, args=args,

kwargs=kwargs)

File "C:\Program Files\GRASS GIS

8.3\etc\python\grass\script\core.py", line 345, in

handle_errors

raise CalledModuleError(module=module, code=code,

returncode=returncode)

grass.exceptions.CalledModuleError: Module run

`r.stream.order --o stream_rast=stream_raster_watershed

direction=flowdir_extract elevation=dtm-002-004

accumulation=flowacc stream_vect=stream_vect

strahler=strahler` ended with an error.

The subprocess ended with a non-zero return code:

3221225781. See errors above the traceback or in the error

output.

Regards

Ben Davies


This message is confidential and is intended for the recipient named above. If you are not the intended recipient, you must not disclose, use or copy the message or any part of it. If you received this message in error, please notify the sender immediately by replying to this message, then delete it from your system.


grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user


grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user