[GRASS-user] r.stream.basins "Stream and direction map probably do not match" solution

This is to confirm that solution mentioned below for problems related with large DEM processing using r.stream.basins really works:

Problem: ( I don’t know why it is not in my mail.)

r.stream.basins returns " Stream and direction map probably do not match" when run on BIG DEMs.
For detail of problems , please see this discussion below:

Francesco Mirabella pisze:

Hi,
more detailes are these,  I can not reproduce it on speafish,

Grass 6.4 rc6 compiled on debian testing

The dem is the srtm 90 m dem, cut on an area of 12064631712 Square ``meters (1206463 hectars). ``The region was set to the dem raster, I provided a minimum flow ``accumulation of 100 to get a "reasonable" river network.

Hope this can help

Francesco

J

It looks very strange:

if your 90 m srtm has 12064631712 m2 it means it has more or less ``1.500.000 number of cells (depending on latitude). It also means that it ``is more or less 1250x1250 cells DEM. If you have used 100 cells ``accumulation threshold you shouldn't receive such dense network with ``7500 streams. With DEM of such size and such threshold expected number ``of streams is about 1000-2000. ``However if you created 7500 network on such small dem it shouldn't work ``indeed. ``r.stream.basins is not prepared for calculation of direct basins (half ``basins) it it rather expanded version of r.water.outlet. If you however ``need direct basins for such dense network you can do it "hacking" source ``code.

find this fragment of code:
(catchment.c, line 24)

int out_max = ncols + nrows;

and change it into this:

int out_max = (ncols + nrows)*10;

and recompile program again.

If this is the reason (however values you wrote are not consistent) I ``will not change the source code because as I wrote it is not prepared ``for that what you're try to do

hth
Jarek

 In the line above,  I multiplied by 100.

Output of manual compilation and compiled file ( only .o files, "sudo make install" still to be run over it.) are attached, if it helps.

On Wed, Feb 16, 2011 at 10:30 PM, <grass-user-request@lists.osgeo.org> wrote:

Send grass-user mailing list submissions to
grass-user@lists.osgeo.org

To subscribe or unsubscribe via the World Wide Web, visit
http://lists.osgeo.org/mailman/listinfo/grass-user
or, via email, send a message with subject or body ‘help’ to
grass-user-request@lists.osgeo.org

You can reach the person managing the list at
grass-user-owner@lists.osgeo.org

When replying, please edit your Subject line so it is more specific
than “Re: Contents of grass-user digest…”

Today’s Topics:

  1. Re: Calculate averagfe of raster maps without mapcalc
    (daniel mcinerney)
  2. Re: GRASS-6.5svn Build Error (Rich Shepard)
  3. Re: Calculate averagfe of raster maps without mapcalc
    (Marcello Gorini)
  4. Re: Eliminating values based on a null (Marcello Gorini)

Message: 1
Date: Wed, 16 Feb 2011 15:30:27 +0100
From: daniel mcinerney <daniel.o.mcinerney@gmail.com>
Subject: Re: [GRASS-user] Calculate averagfe of raster maps without
mapcalc
To: Kim Besson <kimbesson1981@gmail.com>
Cc: GRASS user list <grass-user@lists.osgeo.org>
Message-ID:
<AANLkTikXMO3SvEu5fiNLL6s0JcgK=kMameCrtS382JwL@mail.gmail.com>
Content-Type: text/plain; charset=“iso-8859-1”

Hi Kim,

You can use r.univar to compute univariate statistics of
your raster data.

http://grass.fbk.eu/grass65/manuals/html65_user/r.univar.html

Regards,
Daniel.

On Wed, Feb 16, 2011 at 2:31 PM, Kim Besson <kimbesson1981@gmail.com> wrote:

Greetings

I need to calculate the average of a set of raster images. How can I
calculate it without using mapcalc?
THanks

Kim


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

-------------- next part --------------
An HTML attachment was scrubbed…
URL: http://lists.osgeo.org/pipermail/grass-user/attachments/20110216/782cab3b/attachment-0001.html


Message: 2
Date: Wed, 16 Feb 2011 06:39:53 -0800 (PST)
From: Rich Shepard <rshepard@appl-ecosys.com>
Subject: Re: [GRASS-user] GRASS-6.5svn Build Error
To: grass-user@lists.osgeo.org
Message-ID:
<alpine.LNX.2.00.1102160638450.19529@salmo.appl-ecosys.com>
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed

On Wed, 16 Feb 2011, Rich Shepard wrote:

Thanks! This is the first build error I’ve encountered with GRASS. I’ll
get the new code and build it today.

BTW, while the code now compiles, I see syntax errors in glext.h flash by
on the console.

Rich


Message: 3
Date: Wed, 16 Feb 2011 08:00:53 -0800 (PST)
From: Marcello Gorini <gorini@gmail.com>
Subject: [GRASS-user] Re: Calculate averagfe of raster maps without
mapcalc
To: grass-user@lists.osgeo.org
Message-ID: <1297872053859-6032330.post@n2.nabble.com>
Content-Type: text/plain; charset=us-ascii

Kim:

I need to calculate the average of a set of raster images. How can I
calculate it without using mapcalc?
THanks

Hello Kim,

You can use the module r.series. Like this, if you have few images:

r.series input=image1,image2,image3… method=average output=averaged_image

Or if you have a bunch of images with similar names, you can do:

r.series input=“g.mlist pattern=the_pattern_within_the_ names sep=,
method=average output=averaged_image

Hope this helps.

Marcello.


View this message in context: http://osgeo-org.1803224.n2.nabble.com/Calculate-averagfe-of-raster-maps-without-mapcalc-tp6031736p6032330.html
Sent from the Grass - Users mailing list archive at Nabble.com.


Message: 4
Date: Wed, 16 Feb 2011 08:12:37 -0800 (PST)
From: Marcello Gorini <gorini@gmail.com>
Subject: [GRASS-user] Re: Eliminating values based on a null
To: grass-user@lists.osgeo.org
Message-ID: <1297872757829-6032382.post@n2.nabble.com>
Content-Type: text/plain; charset=us-ascii

Jenny:

in my base map (called X) I have a few null values and, in Y map I want to
eliminate pixels that match with null values in X. How can I do this?
besides using mapcalc

Hello Jenny,

I don’t know if it is a coincidence, but your problem can be solved in the
same way as Kim’s problem.

You can use the module r.series with the -n flag. It will propagate the
nulls among your input rasters. The method you use does not matter because
the -n flag overrides it. So it would be like this:

r.series -n input=X,Y output=Y_without_X_nulls method=average (or any
method)

Hope this helps,

Marcello.

View this message in context: http://osgeo-org.1803224.n2.nabble.com/Eliminating-values-based-on-a-null-tp6031771p6032382.html
Sent from the Grass - Users mailing list archive at Nabble.com.



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

End of grass-user Digest, Vol 58, Issue 31


(attachments)

manual compilation of r.stream.basins (5.47 KB)
raster_r.stream.basin.tar.gz (38.5 KB)