Re: [GRASS-user] r.forestfrag AddOn
Hi Maning, > In the script there is an option to slect a windows size: > > #%option > #% key: window > #% type: integer > #% description: window size default is 5 > #% answer : 5 > #% required : yes > #%END > > You can modify the r.neighbors section like this: > > r.neighbors input=A output=C method=sum size=$GIS_OPT_window --o > r.neighbors input=B output=D method=sum size= $GIS_OPT_window --o ok, so with that I have control on the window size from r.neighbours. That's already something. This applies well for the calculation of pf. However, for the calculation of pff I cannot use r.neighbours, because it does not provide for counting pixel-pairs or other more complex functions for neighbourhood relations. I had to put that into a separate r.mapcalc expression, here e.g. to calculate the number of 'forest-forest' pairs in a 3x3 window: x--x--x | | | x--0--x | | | x--x--x r.mapcalc "F=((A[ 1,-1]*A[ 1, 0])+(A[ 1, 0]*A[ 1, 1])+ # upper row horizontal pairs (A[ 0,-1]*A[ 0, 0])+(A[ 0, 0]*A[ 0, 1])+ # midrow horizontal pairs (A[-1,-1]*A[-1, 0])+(A[-1, 0]*A[-1, 1])+ # lower row horizontal pairs (A[ 1,-1]*A[ 0,-1])+(A[ 0,-1]*A[-1,-1])+ # left column vertical pairs (A[ 1, 0]*A[ 0, 0])+(A[ 0, 0]*A[-1, 0])+ # mid column vertical pairs (A[ 1, 1]*A[ 0, 1])+(A[ 0, 1]*A[-1, 1]))" # right column vertical pairs Now I need to find out how the window size could be fitted according to an input value (e.g. 3 for 3x3, 9 for 9x9 etc.) for this r.mapcalc expression. Only alternative is that the user adjusts the window size manually by adding the respective cell-pairs to the r.mapcalc expression. E.g. for a 5x5 moving window this would look like: x--x--x--x--x | | | | | x--x--x--x--x | | | | | x--x--0--x--x | | | | | x--x--x--x--x | | | | | x--x--x--x--x r.mapcalc "F=((A[ 2,-2]*A[ 2,-1])+(A[ 2,-1]*A[ 2, 0])+(A[ 2, 0]*A[ 2, 1])+(A[ 2, 1]*A[ 2, 2])+ # upper row horizontal pairs ... (A[ 2,-2]*A[ 1,-2])+(A[ 1,-2]*A[ 0, -2])+(A[ 0,-2]*A[-1,-2])+(A[-1,-2]*A[ -2,-2])+ # left column vertical pairs ... Any ideas how to generate a general description for window-sizes with this r.mapcalc expression? Stefan Quoting maning sambale : > Dear Stefan, > > If i remember it right, the window size is an input to the > r.neighbors command. > In the script there is an option to slect a windows size: > > #%option > #% key: window > #% type: integer > #% description: window size default is 5 > #% answer : 5 > #% required : yes > #%END > > You can modify the r.neighbors section like this: > > r.neighbors input=A output=C method=sum size=$GIS_OPT_window --o > r.neighbors input=B output=D method=sum size= $GIS_OPT_window --o > > On Sun, Feb 26, 2012 at 5:51 PM, Stefan Sylla wrote: >> By now, the script can only calculate the forest fraction for a 3x3 window. >> Any ideas on how to automatically generate different window-sizes would be >> welcome. > > > > -- > cheers, > maning > -- > "Freedom is still the most radical idea of all" -N.Branden > wiki: http://esambale.wikispaces.com/ > blog: http://epsg4253.wordpress.com/ > -- > -- View this message in context: http://osgeo-org.1560.n6.nabble.com/Re-GRASS-user-r-forestfrag-AddOn-tp4557482p4557482.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
Re: [GRASS-user] r.forestfrag AddOn
Dear Stefan, If i remember it right, the window size is an input to the r.neighbors command. In the script there is an option to slect a windows size: #%option #% key: window #% type: integer #% description: window size default is 5 #% answer : 5 #% required : yes #%END You can modify the r.neighbors section like this: r.neighbors input=A output=C method=sum size=$GIS_OPT_window --o r.neighbors input=B output=D method=sum size= $GIS_OPT_window --o On Sun, Feb 26, 2012 at 5:51 PM, Stefan Sylla wrote: > By now, the script can only calculate the forest fraction for a 3x3 window. > Any ideas on how to automatically generate different window-sizes would be > welcome. -- cheers, maning -- "Freedom is still the most radical idea of all" -N.Branden wiki: http://esambale.wikispaces.com/ blog: http://epsg4253.wordpress.com/ -- ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user
Re: [GRASS-user] r.forestfrag AddOn
Hi Stefan, On Sun, Feb 26, 2012 at 10:51 AM, Stefan Sylla wrote: > Dear all, > > I used the existing forest-fraction shell-script from manning > (http://osgeo-org.1560.n6.nabble.com/GRASSLIST-270-Fwd-Developing-a-forest-fragmentation-index-td3946212.html#a4366751), > reviewed/updated it a little bit and made some changes on the code, > particularly the calculation of pff and the indexing. > > The script is based on the method from Riitters et al. (s. > http://www.consecol.org/vol4/iss2/art3). > > I already posted the script on the GRASS-AddOns page: > http://grass.osgeo.org/grass-wiki/index.php?title=GRASS_AddOns&action=submit#r.forestfrag > > However, the link to the script is temporary and I would like to put the > shell-script and html-description somewhere. So far, I could not find out > where to put it. Should it be here: > http://trac.osgeo.org/grass/browser/grass-addons/grass7/raster ? How would I > generate a new folder there? You need to request for SVN write access for Addons, see the top entry here: http://grass.osgeo.org/wiki/Addons Best, Markus > By now, the script can only calculate the forest fraction for a 3x3 window. > Any ideas on how to automatically generate different window-sizes would be > welcome. > > Stefan > > -- > View this message in context: > http://osgeo-org.1560.n6.nabble.com/r-forestfrag-AddOn-tp4508985p4508985.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 ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user
[GRASS-user] r.forestfrag AddOn
Dear all, I used the existing forest-fraction shell-script from manning (http://osgeo-org.1560.n6.nabble.com/GRASSLIST-270-Fwd-Developing-a-forest-fragmentation-index-td3946212.html#a4366751), reviewed/updated it a little bit and made some changes on the code, particularly the calculation of pff and the indexing. The script is based on the method from Riitters et al. (s. http://www.consecol.org/vol4/iss2/art3). I already posted the script on the GRASS-AddOns page: http://grass.osgeo.org/grass-wiki/index.php?title=GRASS_AddOns&action=submit#r.forestfrag However, the link to the script is temporary and I would like to put the shell-script and html-description somewhere. So far, I could not find out where to put it. Should it be here: http://trac.osgeo.org/grass/browser/grass-addons/grass7/raster ? How would I generate a new folder there? By now, the script can only calculate the forest fraction for a 3x3 window. Any ideas on how to automatically generate different window-sizes would be welcome. Stefan -- View this message in context: http://osgeo-org.1560.n6.nabble.com/r-forestfrag-AddOn-tp4508985p4508985.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