Flow accumulation in R?

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

Flow accumulation in R?

Jonathan Greenberg-3
R-sig-geo'ers:

I was wondering if anyone had implemented flow accumulation in R (e.g.
http://www.cs.duke.edu/geo*/terraflow/)?

--j

--
Jonathan A. Greenberg, PhD
Assistant Professor
Department of Geography
University of Illinois at Urbana-Champaign
607 South Mathews Avenue, MC 150
Urbana, IL 61801
Phone: 415-763-5476
AIM: jgrn307, MSN: [hidden email], Gchat: jgrn307, Skype: jgrn3007
http://www.geog.illinois.edu/people/JonathanGreenberg.html

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Reply | Threaded
Open this post in threaded view
|

Re: Flow accumulation in R?

Rainer M Krug-6
On Thu, Sep 29, 2011 at 4:20 AM, Jonathan Greenberg <[hidden email]>wrote:

> R-sig-geo'ers:
>
> I was wondering if anyone had implemented flow accumulation in R (e.g.
> http://www.cs.duke.edu/geo*/terraflow/)?
>

Not that I know if - but you can use spgrass6 to use thr GRASS version.

Cheers,

Rainer



>
> --j
>
> --
> Jonathan A. Greenberg, PhD
> Assistant Professor
> Department of Geography
> University of Illinois at Urbana-Champaign
> 607 South Mathews Avenue, MC 150
> Urbana, IL 61801
> Phone: 415-763-5476
> AIM: jgrn307, MSN: [hidden email], Gchat: jgrn307, Skype: jgrn3007
> http://www.geog.illinois.edu/people/JonathanGreenberg.html
>
> _______________________________________________
> R-sig-Geo mailing list
> [hidden email]
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>



--
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology,
UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Stellenbosch University
South Africa

Tel :       +33 - (0)9 53 10 27 44
Cell:       +33 - (0)6 85 62 59 98
Fax (F):       +33 - (0)9 58 10 27 44

Fax (D):    +49 - (0)3 21 21 25 22 44

email:      [hidden email]

Skype:      RMkrug

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Reply | Threaded
Open this post in threaded view
|

Re: Flow accumulation in R?

Ashton Shortridge-2
In reply to this post by Jonathan Greenberg-3
On 09/28/11, Jonathan Greenberg, wrote:
> R-sig-geo'ers:
>
> I was wondering if anyone had implemented flow accumulation in R (e.g.
> http://www.cs.duke.edu/geo*/terraflow/)?
>
> --j

Hi Jonathan,

I couldn't say if it has been implemented in R for sure, but several surface
flow variations are implemented in the GRASS GIS, and GRASS can be connected to
R, if that is helpful. Check out r.watershed and r.terraflow in GRASS.

Yours,

Ashton



-----
Ashton Shortridge
Associate Professor [hidden email]
Dept of Geography http://www.msu.edu/~ashton
235 Geography Building ph (517) 432-3561
Michigan State University fx (517) 432-1671

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Reply | Threaded
Open this post in threaded view
|

Re: Flow accumulation in R?

jgarcia-2
Hi Jonathan,
I think the function topidx (in library topmodel) is what you are after.
It returns two rasters; look at the second one.
Best wishes,
Javier
---

> On 09/28/11, Jonathan Greenberg, wrote:
>> R-sig-geo'ers:
>>
>> I was wondering if anyone had implemented flow accumulation in R (e.g.
>> http://www.cs.duke.edu/geo*/terraflow/)?
>>
>> --j
>
> Hi Jonathan,
>
> I couldn't say if it has been implemented in R for sure, but several
> surface
> flow variations are implemented in the GRASS GIS, and GRASS can be
> connected to
> R, if that is helpful. Check out r.watershed and r.terraflow in GRASS.
>
> Yours,
>
> Ashton
>
>
>
> -----
> Ashton Shortridge
> Associate Professor [hidden email]
> Dept of Geography http://www.msu.edu/~ashton
> 235 Geography Building ph (517) 432-3561
> Michigan State University fx (517) 432-1671
>
> _______________________________________________
> R-sig-Geo mailing list
> [hidden email]
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Reply | Threaded
Open this post in threaded view
|

Re: Flow accumulation in R?

Jonathan Greenberg-3
In reply to this post by Jonathan Greenberg-3
Thanks for the responses -- one of the issues with the GRASS
implementation of terraflow is that there is not, to my knowledge,
parallel support for the code -- the C++ version, I suppose, we can
try to compile, although it seems to be fairly out of date.  I figured
with the quickly increasing capabilities in spatial programming beyond
just spatial statistics in R (e.g. via raster, rgdal, maptools), as
well as other people developing parallel interfaces for R (e.g.
snowfall, Rmpi), R may do well as a scalable system for doing large
scale image processing/GIS analyses.  Certainly, other programs have
not scaled well (ArcMap and GRASS to name a few).

topidx looked interesting but I can tell that it won't scale -- it
requires the image be in memory as a matrix, so any reasonably large
DEM won't work.

Sounds like this may require some programming!

--j



On Thu, Sep 29, 2011 at 6:02 AM, Rich Shepard <[hidden email]> wrote:

> On Wed, 28 Sep 2011, Jonathan Greenberg wrote:
>
>> I was wondering if anyone had implemented flow accumulation in R (e.g.
>> http://www.cs.duke.edu/geo*/terraflow/)?
>
> Jon,
>
>  I use r.terraflow (and other hydrological modules) within GRASS
> <http://grass.osgeo.org/>. Terrain and hydrologic modeling is best done, in
> my opinion, in GRASS and leave the spatial statistics to R. There is an
> interface between the two that allows us users to take advantage of both.
>
> Rich
>
> --
> Richard B. Shepard, Ph.D.          |   Integrity - Credibility - Innovation
> Applied Ecosystem Services, Inc.   |    Helping Ensure Our Clients' Futures
> <http://www.appl-ecosys.com>     Voice: 503-667-4517      Fax: 503-667-8863
>



--
Jonathan A. Greenberg, PhD
Assistant Professor
Department of Geography
University of Illinois at Urbana-Champaign
607 South Mathews Avenue, MC 150
Urbana, IL 61801
Phone: 415-763-5476
AIM: jgrn307, MSN: [hidden email], Gchat: jgrn307, Skype: jgrn3007
http://www.geog.illinois.edu/people/JonathanGreenberg.html

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Reply | Threaded
Open this post in threaded view
|

Re: Flow accumulation in R?

Stephen Sefick-2
I would be very interested in your work of getting flow accumulation
working in R.  I might be able to help (with my limited skills).

Stephen

On Thu 29 Sep 2011 01:50:10 PM CDT, Jonathan Greenberg wrote:

> Thanks for the responses -- one of the issues with the GRASS
> implementation of terraflow is that there is not, to my knowledge,
> parallel support for the code -- the C++ version, I suppose, we can
> try to compile, although it seems to be fairly out of date.  I figured
> with the quickly increasing capabilities in spatial programming beyond
> just spatial statistics in R (e.g. via raster, rgdal, maptools), as
> well as other people developing parallel interfaces for R (e.g.
> snowfall, Rmpi), R may do well as a scalable system for doing large
> scale image processing/GIS analyses.  Certainly, other programs have
> not scaled well (ArcMap and GRASS to name a few).
>
> topidx looked interesting but I can tell that it won't scale -- it
> requires the image be in memory as a matrix, so any reasonably large
> DEM won't work.
>
> Sounds like this may require some programming!
>
> --j
>
>
>
> On Thu, Sep 29, 2011 at 6:02 AM, Rich Shepard<[hidden email]>  wrote:
>> On Wed, 28 Sep 2011, Jonathan Greenberg wrote:
>>
>>> I was wondering if anyone had implemented flow accumulation in R (e.g.
>>> http://www.cs.duke.edu/geo*/terraflow/)?
>>
>> Jon,
>>
>>   I use r.terraflow (and other hydrological modules) within GRASS
>> <http://grass.osgeo.org/>. Terrain and hydrologic modeling is best done, in
>> my opinion, in GRASS and leave the spatial statistics to R. There is an
>> interface between the two that allows us users to take advantage of both.
>>
>> Rich
>>
>> --
>> Richard B. Shepard, Ph.D.          |   Integrity - Credibility - Innovation
>> Applied Ecosystem Services, Inc.   |    Helping Ensure Our Clients' Futures
>> <http://www.appl-ecosys.com>       Voice: 503-667-4517      Fax: 503-667-8863
>>
>
>
>

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Reply | Threaded
Open this post in threaded view
|

Re: Flow accumulation in R?

francesco.pirotti
>From my experience, GRASS also has another module which does a very good
job (at least from my limited experience) at calculating flow accumulation
for each cell: r.watershed. Some time ago I successfully adapted the GRASS
code to my own c++ code; I used GDAL raster library to read a raster DTM
and used the r.watershed code to run the accumulation analysis on the
matrix with height values.
Cheers,
Francesco Pirotti
CIRGEO - University of Padova - Italy

> I would be very interested in your work of getting flow accumulation
> working in R.  I might be able to help (with my limited skills).
>
> Stephen
>
> On Thu 29 Sep 2011 01:50:10 PM CDT, Jonathan Greenberg wrote:
>> Thanks for the responses -- one of the issues with the GRASS
>> implementation of terraflow is that there is not, to my knowledge,
>> parallel support for the code -- the C++ version, I suppose, we can
>> try to compile, although it seems to be fairly out of date.  I figured
>> with the quickly increasing capabilities in spatial programming beyond
>> just spatial statistics in R (e.g. via raster, rgdal, maptools), as
>> well as other people developing parallel interfaces for R (e.g.
>> snowfall, Rmpi), R may do well as a scalable system for doing large
>> scale image processing/GIS analyses.  Certainly, other programs have
>> not scaled well (ArcMap and GRASS to name a few).
>>
>> topidx looked interesting but I can tell that it won't scale -- it
>> requires the image be in memory as a matrix, so any reasonably large
>> DEM won't work.
>>
>> Sounds like this may require some programming!
>>
>> --j
>>
>>
>>
>> On Thu, Sep 29, 2011 at 6:02 AM, Rich Shepard<[hidden email]>
>> wrote:
>>> On Wed, 28 Sep 2011, Jonathan Greenberg wrote:
>>>
>>>> I was wondering if anyone had implemented flow accumulation in R (e.g.
>>>> http://www.cs.duke.edu/geo*/terraflow/)?
>>>
>>> Jon,
>>>
>>>   I use r.terraflow (and other hydrological modules) within GRASS
>>> <http://grass.osgeo.org/>. Terrain and hydrologic modeling is best
>>> done, in
>>> my opinion, in GRASS and leave the spatial statistics to R. There is an
>>> interface between the two that allows us users to take advantage of
>>> both.
>>>
>>> Rich
>>>
>>> --
>>> Richard B. Shepard, Ph.D.          |   Integrity - Credibility -
>>> Innovation
>>> Applied Ecosystem Services, Inc.   |    Helping Ensure Our Clients'
>>> Futures
>>> <http://www.appl-ecosys.com>       Voice: 503-667-4517      Fax:
>>> 503-667-8863
>>>
>>
>>
>>
>
> _______________________________________________
> R-sig-Geo mailing list
> [hidden email]
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
>

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Reply | Threaded
Open this post in threaded view
|

Re: Flow accumulation in R?

Mathieu Rajerison
Has anyone heard of the hydromad package?
http://hydromad.catchment.org/

"*hydromad* is an R package (i.e. a software package for the R statistical
computing environment <http://www.r-project.org/>). It provides a modelling
framework for environmental hydrology: water balance accounting and flow
routing in spatially aggregated catchments. It supports simulation,
estimation, assessment and visualisation of flow response to time series of
rainfall and other drivers."

2011/9/30 <[hidden email]>

> >From my experience, GRASS also has another module which does a very good
> job (at least from my limited experience) at calculating flow accumulation
> for each cell: r.watershed. Some time ago I successfully adapted the GRASS
> code to my own c++ code; I used GDAL raster library to read a raster DTM
> and used the r.watershed code to run the accumulation analysis on the
> matrix with height values.
> Cheers,
> Francesco Pirotti
> CIRGEO - University of Padova - Italy
>
> > I would be very interested in your work of getting flow accumulation
> > working in R.  I might be able to help (with my limited skills).
> >
> > Stephen
> >
> > On Thu 29 Sep 2011 01:50:10 PM CDT, Jonathan Greenberg wrote:
> >> Thanks for the responses -- one of the issues with the GRASS
> >> implementation of terraflow is that there is not, to my knowledge,
> >> parallel support for the code -- the C++ version, I suppose, we can
> >> try to compile, although it seems to be fairly out of date.  I figured
> >> with the quickly increasing capabilities in spatial programming beyond
> >> just spatial statistics in R (e.g. via raster, rgdal, maptools), as
> >> well as other people developing parallel interfaces for R (e.g.
> >> snowfall, Rmpi), R may do well as a scalable system for doing large
> >> scale image processing/GIS analyses.  Certainly, other programs have
> >> not scaled well (ArcMap and GRASS to name a few).
> >>
> >> topidx looked interesting but I can tell that it won't scale -- it
> >> requires the image be in memory as a matrix, so any reasonably large
> >> DEM won't work.
> >>
> >> Sounds like this may require some programming!
> >>
> >> --j
> >>
> >>
> >>
> >> On Thu, Sep 29, 2011 at 6:02 AM, Rich Shepard<[hidden email]>
> >> wrote:
> >>> On Wed, 28 Sep 2011, Jonathan Greenberg wrote:
> >>>
> >>>> I was wondering if anyone had implemented flow accumulation in R (e.g.
> >>>> http://www.cs.duke.edu/geo*/terraflow/)?
> >>>
> >>> Jon,
> >>>
> >>>   I use r.terraflow (and other hydrological modules) within GRASS
> >>> <http://grass.osgeo.org/>. Terrain and hydrologic modeling is best
> >>> done, in
> >>> my opinion, in GRASS and leave the spatial statistics to R. There is an
> >>> interface between the two that allows us users to take advantage of
> >>> both.
> >>>
> >>> Rich
> >>>
> >>> --
> >>> Richard B. Shepard, Ph.D.          |   Integrity - Credibility -
> >>> Innovation
> >>> Applied Ecosystem Services, Inc.   |    Helping Ensure Our Clients'
> >>> Futures
> >>> <http://www.appl-ecosys.com>       Voice: 503-667-4517      Fax:
> >>> 503-667-8863
> >>>
> >>
> >>
> >>
> >
> > _______________________________________________
> > R-sig-Geo mailing list
> > [hidden email]
> > https://stat.ethz.ch/mailman/listinfo/r-sig-geo
> >
> >
>
> _______________________________________________
> R-sig-Geo mailing list
> [hidden email]
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Reply | Threaded
Open this post in threaded view
|

Re: Flow accumulation in R?

Sylvain Maillard
In reply to this post by Jonathan Greenberg-3
2011/9/29 Jonathan Greenberg <[hidden email]>

> Thanks for the responses -- one of the issues with the GRASS
> implementation of terraflow is that there is not, to my knowledge,
> parallel support for the code -- the C++ version, I suppose, we can
> try to compile, although it seems to be fairly out of date.  I figured
> with the quickly increasing capabilities in spatial programming beyond
> just spatial statistics in R (e.g. via raster, rgdal, maptools), as
> well as other people developing parallel interfaces for R (e.g.
> snowfall, Rmpi), R may do well as a scalable system for doing large
> scale image processing/GIS analyses.  Certainly, other programs have
> not scaled well (ArcMap and GRASS to name a few).
>

you may have a look at the r.watershed module in GRASS, there were a lot of
improvment in the futur 7.0 version ...
but on the man page (
http://grass.osgeo.org/gdp/html_grass64/r.watershed.html), they say "The
algorithm produces results similar to those obtained when running
*r.cost<http://grass.osgeo.org/gdp/html_grass64/r.cost.html>
* and *r.drain <http://grass.osgeo.org/gdp/html_grass64/r.drain.html>* on
every cell on the map" so i think it should be not too difficult to write a
small script to parallelize the operation !



cheers,
Sylvain

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Reply | Threaded
Open this post in threaded view
|

Re: Flow accumulation in R?

Rainer M Krug-6
In reply to this post by Jonathan Greenberg-3
On Thu, Sep 29, 2011 at 8:50 PM, Jonathan Greenberg <[hidden email]>wrote:

> Thanks for the responses -- one of the issues with the GRASS
> implementation of terraflow is that there is not, to my knowledge,
> parallel support for the code -- the C++ version, I suppose, we can
> try to compile, although it seems to be fairly out of date.  I figured
> with the quickly increasing capabilities in spatial programming beyond
> just spatial statistics in R (e.g. via raster, rgdal, maptools), as
> well as other people developing parallel interfaces for R (e.g.
> snowfall, Rmpi), R may do well as a scalable system for doing large
> scale image processing/GIS analyses.  Certainly, other programs have
> not scaled well (ArcMap and GRASS to name a few).
>

If you would like to process large maps, I would definitely go the GRASS
route, and adopt the C code, so that it utilises multiple cores. i would
actually suggest to get in contacts with the developers as they might give
you some input and ideas. I would definitely not go the route of doing the
computations directly in R, as that would sloe does the analysis. If you
have the parallel implementation in GRASS, you could use it from R. Another
option would be to adapt the C implementation used in GRASS to be called
directly from R, and that you simply provide the names of the rasters and
the C routines are doing the rest and returning the names of the resulting
maps.

I thought quite a few times, that one implementation in a C library of these
kinds of algorithms, so that they could be used from GRASS and R, with
simple wrappers - A framework like that would be very useful for GRASS and
R.

Cheers and keep us posted,

Rainer


>
> topidx looked interesting but I can tell that it won't scale -- it
> requires the image be in memory as a matrix, so any reasonably large
> DEM won't work.
>
> Sounds like this may require some programming!
>
> --j
>
>
>
> On Thu, Sep 29, 2011 at 6:02 AM, Rich Shepard <[hidden email]>
> wrote:
> > On Wed, 28 Sep 2011, Jonathan Greenberg wrote:
> >
> >> I was wondering if anyone had implemented flow accumulation in R (e.g.
> >> http://www.cs.duke.edu/geo*/terraflow/)?
> >
> > Jon,
> >
> >  I use r.terraflow (and other hydrological modules) within GRASS
> > <http://grass.osgeo.org/>. Terrain and hydrologic modeling is best done,
> in
> > my opinion, in GRASS and leave the spatial statistics to R. There is an
> > interface between the two that allows us users to take advantage of both.
> >
> > Rich
> >
> > --
> > Richard B. Shepard, Ph.D.          |   Integrity - Credibility -
> Innovation
> > Applied Ecosystem Services, Inc.   |    Helping Ensure Our Clients'
> Futures
> > <http://www.appl-ecosys.com>     Voice: 503-667-4517      Fax:
> 503-667-8863
> >
>
>
>
> --
> Jonathan A. Greenberg, PhD
> Assistant Professor
> Department of Geography
> University of Illinois at Urbana-Champaign
> 607 South Mathews Avenue, MC 150
> Urbana, IL 61801
> Phone: 415-763-5476
> AIM: jgrn307, MSN: [hidden email], Gchat: jgrn307, Skype: jgrn3007
> http://www.geog.illinois.edu/people/JonathanGreenberg.html
>
> _______________________________________________
> R-sig-Geo mailing list
> [hidden email]
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>



--
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology,
UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Stellenbosch University
South Africa

Tel :       +33 - (0)9 53 10 27 44
Cell:       +33 - (0)6 85 62 59 98
Fax (F):       +33 - (0)9 58 10 27 44

Fax (D):    +49 - (0)3 21 21 25 22 44

email:      [hidden email]

Skype:      RMkrug

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Reply | Threaded
Open this post in threaded view
|

Re: Flow accumulation in R?

Rich Shepard
On Fri, 30 Sep 2011, Rainer M Krug wrote:

> If you would like to process large maps, I would definitely go the GRASS
> route, and adopt the C code, so that it utilises multiple cores.

   The GRASS modules are being modified to work with openmp to allow parallel
processing when appropriate. I don't recall which modules currently take
advantage of the library (I run 6.5svn), but I always configure the builds
'--with-openmp'.

Rich

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo