I was trying to define the drainage patterns and to delineate some catchments based on a 30m DEM using

r.watershed --overwrite elev=DEM accumulation=Accum drainage=Drainage -m

but grass would constantly crash and i would obtain the following error

WARNING: segment zero_fill(): Unable to write (No space left on device) WARNING: seg_open(): could not write segment file

I did some searching about this error here and here, and this help me understanding that the program was running out of memory when processing the order, however it did not provide much more insight into how to address this issue.

Does anyone know what i can do to solve this and run r.watershed?


After trying many things, I found that the solution was simpler than I thought. Despite the terrain data was relatively coarse (30m), the region settings in grass were defined at a 1m x 1m resolution. This meant that the program was doing a very detailed analysis in relatively large area.

The solution was simple, modify the region settings to fit the DEM (could be coarser as well)

g.region nsres=30 ewres=30

After doing this the whole analysis ran perfectly!

| improve this answer | |
  • 2
    The eastiest is this: g.region raster=my_elevation -p – markusN Jan 13 '19 at 11:03
  • (you may want to accept your answer!) – markusN Jan 15 '19 at 14:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.