Re: [GRASS-user] Filling sinks w/ minimum slope

2017-06-20 Thread Ken Mankoff

On 2017-06-20 at 08:45, Markus Metz  wrote:
> Negative values in the drainage direction should only occur at the
> borders of the current region and around NULL cells. Note that if you
> want internal sinks to be drained, you must not use the depression
> option.

I was not using depression option but I have determined that the mask I was 
using had a few NULLs in it that I was not aware of. I think this was the 
problem.

Thank you for assisting,

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

Re: [GRASS-user] Filling sinks w/ minimum slope

2017-06-20 Thread Stefan Blumentrath
Hi Ken,

To my knowledge r.watershed does not require to fill sinks in advance, because 
it has a minimal impact routing for handling (non-real) sinks.

Do you have a particular reason for your wish to fill the DEM in advance?

Cheers
Stefan

-Original Message-
From: grass-user [mailto:grass-user-boun...@lists.osgeo.org] On Behalf Of Ken 
Mankoff
Sent: mandag 19. juni 2017 18.36
To: GRASS user list 
Subject: [GRASS-user] Filling sinks w/ minimum slope

Hi GRASS list,

I'm interested in filling sinks in a DEM before using r.watershed. I currently 
use r.fill.dir.

I've discovered that the SAGA fill command has an option to set a "Minimum 
slope gradient to preserve from cell to cell; with a value of zero sinks are 
filled up to the spill elevation (which results in flat areas)" (see 
http://www.saga-gis.org/saga_tool_doc/2.1.3/ta_preprocessor_4.html ).

Does anyone know of an option for this in GRASS, or an addon that implements 
this feature? I've briefly looked at calling SAGA from GRASS and it seems 
non-trivial. I'd prefer to do this in GRASS if possible.

Thanks,

  -k.
___
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

Re: [GRASS-user] Filling sinks w/ minimum slope

2017-06-20 Thread Markus Metz
On Tue, Jun 20, 2017 at 10:05 AM, Ken Mankoff  wrote:
>
>
> On 2017-06-20 at 06:28, Markus Metz  wrote:
> > You don't need to fill sinks with r.watershed, internal sinks are by
> > default drained.
>
> I have negative values in the drainage direction raster produced by
r.watershed in the interior. Is this a bug? Or am I misunderstanding the
definition of a sink?

Negative values in the drainage direction should only occur at the borders
of the current region and around NULL cells. Note that if you want internal
sinks to be drained, you must not use the depression option.

>
> While looking into this, I also notice that I get different accumulation
maps if I scale the elevation (e.g. divide by 100), even when using the
"-s" flag. At first consideration, this does not make sense to me.

There could be small differences due to floating point representation
differences.
>
> > You can create flat areas (also with r.terraflow), then use the -b
> > flag of r.watershed to create a gentle slope for flat areas.
>
> I tried this and the accumulation map still has end-points (and direction
has negative values) in the interior.

Accumulation stops only if true sinks are defined with the depression
option or if the elevation of any neighbor is unknown (border of the
current region, NULL cells).

I tested with elev_lid792_1m in the NC dataset and don't get negative
drainage in internal sinks:

g.region -p rast=elev_lid792_1m
r.watershed ele=elev_lid792_1m drain=elev_lid792_1m_drain
acc=elev_lid792_1m_acc

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

Re: [GRASS-user] Filling sinks w/ minimum slope

2017-06-20 Thread Ken Mankoff

On 2017-06-20 at 06:28, Markus Metz  wrote:
> You don't need to fill sinks with r.watershed, internal sinks are by
> default drained.

I have negative values in the drainage direction raster produced by r.watershed 
in the interior. Is this a bug? Or am I misunderstanding the definition of a 
sink?

While looking into this, I also notice that I get different accumulation maps 
if I scale the elevation (e.g. divide by 100), even when using the "-s" flag. 
At first consideration, this does not make sense to me.

> You can create flat areas (also with r.terraflow), then use the -b
> flag of r.watershed to create a gentle slope for flat areas.

I tried this and the accumulation map still has end-points (and direction has 
negative values) in the interior.

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

Re: [GRASS-user] Filling sinks w/ minimum slope

2017-06-19 Thread Markus Metz
On Mon, Jun 19, 2017 at 10:35 PM, Ken Mankoff  wrote:
>
>
> On 2017-06-19 at 18:20, Stefan Blumentrath 
wrote:
> > To my knowledge r.watershed does not require to fill sinks in advance,
> > because it has a minimal impact routing for handling (non-real) sinks.
> >
> > Do you have a particular reason for your wish to fill the DEM in
> > advance?
>
> If I don't fill it, then my definition of non-real and the algorithms
definition are different. I need all water to leave the domain, but there
are internal sinks.

You don't need to fill sinks with r.watershed, internal sinks are by
default drained. You could also use r.hydrodem to remove internal sinks.

> My solution is to fill them like this:
>
> # run the filling algorithm until there are no holes left
> A=1
> while [[ $A -ne 0 ]]; do
>   r.fill.dir input=phi output=phi format=agnps direction=d areas=a --o --q
>   A=$(r.info a | egrep -o "max = .*" | cut -c7-20)
> done
> g.remove -f type=raster name=a,d
>
> Then use "phi" as the elevation input to r.watershed. Then all water
leaves the domain, but there are flat areas. I would prefer if these were
gently-sloped. A colleague does this in QGIS w/ SAGA and the minimum slope,
but I am trying to make the work reproducible, and therefore prefer CLI
GRASS to GUI QGIS.

You can create flat areas (also with r.terraflow), then use the -b flag of
r.watershed to create a gentle slope for flat areas.

Markus M

>
>   -k.
> ___
> 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

Re: [GRASS-user] Filling sinks w/ minimum slope

2017-06-19 Thread Ken Mankoff

On 2017-06-19 at 18:20, Stefan Blumentrath  wrote:
> To my knowledge r.watershed does not require to fill sinks in advance,
> because it has a minimal impact routing for handling (non-real) sinks.
>
> Do you have a particular reason for your wish to fill the DEM in
> advance?

If I don't fill it, then my definition of non-real and the algorithms 
definition are different. I need all water to leave the domain, but there are 
internal sinks. My solution is to fill them like this:

# run the filling algorithm until there are no holes left
A=1
while [[ $A -ne 0 ]]; do
  r.fill.dir input=phi output=phi format=agnps direction=d areas=a --o --q
  A=$(r.info a | egrep -o "max = .*" | cut -c7-20)
done
g.remove -f type=raster name=a,d

Then use "phi" as the elevation input to r.watershed. Then all water leaves the 
domain, but there are flat areas. I would prefer if these were gently-sloped. A 
colleague does this in QGIS w/ SAGA and the minimum slope, but I am trying to 
make the work reproducible, and therefore prefer CLI GRASS to GUI QGIS.

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