[R-sig-Geo] calculate "regional" slope
reudenbach at uni-marburg.de
Fri Feb 19 22:00:19 CET 2016
If you want to deal with bigger data sets in a fast and more flexible way I strongly suggest to use GRASS7. Rgrass7 provides a very good "r-ish" wrapper to use it from R. If You are interested i 'll post a typical setup and example for your question. Please note you need obligatory a GRASS 7 installation on your system.
Am 19. Februar 2016 16:55:32 MEZ, schrieb Dominik Schneider <Dominik.Schneider at colorado.edu>:
>Thanks for the suggestion Chris. I'm familiar with gdaldem, which
>raster::terrain is based on, to compute slope from a dem. I now realize
>that my example isnt a good one because neighbors=8 would achieve what
>described. However I actually want some flexibility such that I can
>specifiy neighbors=16 so that it uses the next "ring" of cells.
>I played around with focal() with weight argument =
>matrix(rep(c(1,0,0,0,1),5),byrow=T) but couldn't figure out how to
>for a directional slope.
>On Fri, Feb 19, 2016 at 4:09 AM, chris english <
>englishchristophera at gmail.com> wrote:
>> r <- raster(nrows=22, ncols=20, xmn=-58, xmx=-48, ymn=-33, ymx=-22)
>> vals <- sample.int(1e3,440)
>> r[ ] <- vals
>> terr_r <- terrain(r, opt='slope', unit='degrees', neighbors=8)
>> Ah, but it appears you want up sampling to 1.5 degrees rather than
>> so maybe spatial.tools::projectRaster_rigorous then raster:terrain.
>> I'm inclined to end that last so maybe with a question mark. Sorry
>> essentially inconclusive response but I was happy to find terrain in
>> On Fri, Feb 19, 2016 at 2:59 AM, Dominik Schneider <
>> Dominik.Schneider at colorado.edu> wrote:
>>> I need to calculate slope at different scales. In the case below, r
>>> 0.5deg resolution raster and I want the slope for 1.5 deg centered
>>> of those 0.5 deg pixels. I'm trying to estimate which side of
>>> range each pixel is on. So the resulting raster would have the same
>>> of pixels as r. The edges can be NA.
>>> any suggestions would be appreciated. Thanks
>>> r <- raster(nrows=22, ncols=20, xmn=-58, xmx=-48, ymn=-33, ymx=-22)
>>> [[alternative HTML version deleted]]
>>> R-sig-Geo mailing list
>>> R-sig-Geo at r-project.org
> [[alternative HTML version deleted]]
>R-sig-Geo mailing list
>R-sig-Geo at r-project.org
Diese Nachricht wurde von meinem Android-Mobiltelefon mit K-9 Mail gesendet.
[[alternative HTML version deleted]]
More information about the R-sig-Geo