Skip to content

[Bug] Cross-flow issue from the r.stream.extract function #6541

@xuezhicang

Description

@xuezhicang

Describe the bug

When I use the r.stream.extract function to generate streams, I found that it forms cross-flows and the streams appear twisted.

To reproduce

// I upload the data and paste the core code below.

data.zip

DEM_path =  os.path.join(working_dir,"dem_cutted.tif")
skl_paths = os.path.join(working_dir,"skl.tif")

mapset_path = os.path.join(working_dir, "test_1") 
subprocess.run(["grass", "-c", DEM_path,"-e", mapset_path], check=True)

gisrc = gsetup.init(mapset_path)


gscript.run_command('r.in.gdal', flags= 'or', input= DEM_path , output='dem', memory= 10000, overwrite=True)
gscript.run_command('r.in.gdal', flags= 'or', input= skl_paths , output='skl', memory= 10000, overwrite=True)

elevation = 'dem'
threshold= 1
accumulation= 'skl' 
stream_length= 50
stream_raster= 'str_ras'
stream_vector= 'str_vec'
direction= 'str_fdr'

gscript.run_command('r.stream.extract', elevation=elevation, threshold=threshold, accumulation=accumulation, stream_length= stream_length, memory=30000, stream_raster=stream_raster, stream_vector=stream_vector, direction=direction, overwrite=True)

str_ori_ln_export_path = os.path.join(working_dir,"str_wProblems.gpkg")
gscript.run_command('v.out.ogr', flags='e', input= stream_vector , output=str_ori_ln_export_path, type='line', overwrite=True)

Expected behavior

I expect the stream polylines to have a dendritic structure, with no intersections between lines.

Screenshots

Image Image

System description

  • Operating System: Linux
  • GRASS version: 8.2.0

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions