Re: [GRASS-user] Suggestion for creating a script to create a map of agricultural capacity
On 27/05/2013 22:36, Marcello Benigno wrote: Hi Micha, About: Not sure I understand the logic of taking the highest value This was defined by an agronomist, I also do not understand why =/ However, your answer is exactly what I need, did not know r.series, thank you! If you can help me also in this tip, I would be very grateful, I'm reclassifying the slope as follows: r.mapcalc class_1 = 'if(slope = 2.0, 1, null())' r.mapcalc class_2 = 'if(2.0 slope = 5, 2, null())' r.mapcalc class_3 = 'if(5 slope = 10, 3, null())' r.mapcalc class_4 = 'if(10 slope = 15, 4, null())' r.mapcalc class_5 = 'if(15 slope = 45, 5, null())' r.mapcalc class_6 = 'if(45 slope = 70, 6, null())' r.mapcalc class_7 = 'if(slope 70, 7, null())' r.mapcalc slope.reclass = class_1 + class_2 + class_3 + class_4 + class_5 + class_6 + class_7 How do I create a single _expression_ for this problem? How about using r.reclass ? Create a text file "slope_reclass.txt" which contains rows: 0 thru 2 = 1 2 thru 5 = 2 5 thru 10 = 3 ... 70 thru 100 = 7 then run r.reclass in=slope out=slope_rc rule=slope_reclass.txt Be aware that the reclass map is not a "real" raster. If you need to use it for other things, then a second r.mapcalc _expression_ will be necessary to create on on-disk raster map. Such as: r.mapcalc slope_reclass=slope_rc Regards, Micha Regards -- Marcello Benigno B. de Barros Filho Prof. do Curso Superior de Tecnologia em Geoprocessamento - IFPB Mestre em Cincias Geodsicas e Tecnologias da Geoinformao - UFPE Doutorando em Tecnologia Ambiental e Recursos Hdricos - UFPE http://profmarcello.blogspot.com http://about.me/marcello.benigno This mail was received via Mail-SeCure System. -- Micha Silver GIS Consulting 052-3665918 http://www.surfaces.co.il ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user
Re: [GRASS-user] Suggestion for creating a script to create a map of agricultural capacity
Micha, Thank you very for helping me. Regards, -- *Marcello Benigno B. de Barros Filho* Prof. do Curso Superior de Tecnologia em Geoprocessamento - IFPB Mestre em Ciências Geodésicas e Tecnologias da Geoinformação - UFPE Doutorando em Tecnologia Ambiental e Recursos Hídricos - UFPE http://profmarcello.blogspot.com http://about.me/marcello.benigno ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user
[GRASS-user] Using wildcards or regular expressions in r.gui.animation?
Hi is it possible to specify the names of the raster maps to be animated by using UNIX style wild cards as in r.out.mpeg, i.e. , | g.gui.animation rast=rain[1-9],rain1[0-2] ` is not working. It would be very useful to be able to use these. Second question concerns the different panels: Can I specify these from the commandline? My reasoning is that I would like to check different time series, and each one has a slightly different name - being able to use UNIX style wild cards would make y life so much easier. Cheers, Rainer -- Rainer M. Krug pgphx2I0DirZS.pgp Description: PGP signature ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user
Re: [GRASS-user] r.viewshed Python Script OSError
Hi Markus, I did install r.viewshed (it is located in ~/.grass6/addons/), and the full path does appear in $PATH. I am executing the Python script from outside of GRASS. Is this normal? I am hoping for some advice on this. The intent is to liberate some software (naturalcapitalproject.org) from ArcGIS for users on Windows. When I start GRASS (in text mode) it says Welcome to GRASS 6.4.2 (2012). Thank you, Martin On Sun, May 26, 2013 at 1:27 PM, Markus Metz markus.metz.gisw...@gmail.com wrote: On Fri, May 24, 2013 at 11:32 PM, Martin Lacayo mlac...@stanford.edu wrote: Hello, I am using GRASS 6.4 on Debian. I am trying to make a call to r.viewshed from Python, but it fails with the following exception: OSError: [Errno 2] No such file or directory Any suggestions? Did you install r.viewshed? Where is the r.viewshed binary? Is the location of r.viewshed in the PATH (within GRASS, test with echo $PATH)? Did you execute the python script from within GRASS? Which GRASS 6.4 version are you using? Recommended is 6.4.3.svn. Markus M ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user
Re: [GRASS-user] r.viewshed Python Script OSError
On Tue, May 28, 2013 at 7:09 PM, Martin Lacayo mlac...@stanford.edu wrote: Hi Markus, I did install r.viewshed (it is located in ~/.grass6/addons/), and the full path does appear in $PATH. I am executing the Python script from outside of GRASS. Is this normal? I am hoping for some advice on this. You need to execute the Python script from within GRASS, or set some environment variables first, see [1]. Within your script, you could also first use a dummy location, for example the GRASS demolocation, then create a new location with the projection information in the raster map to be used as input for r.viewshed, change to that location, import the raster map, run r.viewshed, export the result. This is essentially what the SEXTANTE plugin in QGIS is doing. The intent is to liberate some software (naturalcapitalproject.org) from ArcGIS for users on Windows. Nice! When I start GRASS (in text mode) it says Welcome to GRASS 6.4.2 (2012). If possible, update to GRASS 6.4.3. HTH, Markus M [1] http://grasswiki.osgeo.org/wiki/Working_with_GRASS_without_starting_it_explicitly Thank you, Martin On Sun, May 26, 2013 at 1:27 PM, Markus Metz markus.metz.gisw...@gmail.com wrote: On Fri, May 24, 2013 at 11:32 PM, Martin Lacayo mlac...@stanford.edu wrote: Hello, I am using GRASS 6.4 on Debian. I am trying to make a call to r.viewshed from Python, but it fails with the following exception: OSError: [Errno 2] No such file or directory Any suggestions? Did you install r.viewshed? Where is the r.viewshed binary? Is the location of r.viewshed in the PATH (within GRASS, test with echo $PATH)? Did you execute the python script from within GRASS? Which GRASS 6.4 version are you using? Recommended is 6.4.3.svn. Markus M ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user
[GRASS-user] reset zone in projection settings
Hello GRASS users, i have reset my locations projection settings - for the purpose of updating the zone from 0 to 11. however, after running g.setproj to make this change, g.region -p still shows the zone set to 0. is there another command that i should use, or a series of commands that need to be executed to make this change? any guidance would be appreciated. thank you, Janet ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user
Re: [GRASS-user] Suggestion for creating a script to create a map of agricultural capacity
Marcello Benigno wrote: If you can help me also in this tip, I would be very grateful, I'm reclassifying the slope as follows: r.mapcalc class_1 = 'if(slope = 2.0, 1, null())' r.mapcalc class_2 = 'if(2.0 slope = 5, 2, null())' r.mapcalc class_3 = 'if(5 slope = 10, 3, null())' r.mapcalc class_4 = 'if(10 slope = 15, 4, null())' r.mapcalc class_5 = 'if(15 slope = 45, 5, null())' r.mapcalc class_6 = 'if(45 slope = 70, 6, null())' r.mapcalc class_7 = 'if(slope 70, 7, null())' 1. Note that a b = c is wrong; you need to use a b b = c. 2. You could optimise the above by using a single r.mapcalc command, e.g. (assuming Unix shell syntax): r.mapcalc EOF class_1 = if(slope = 2.0, 1, null()) class_2 = if(2.0 slope slope = 5, 2, null()) class_3 = if(5 slope slope = 10, 3, null()) class_4 = if(10 slope slope = 15, 4, null()) class_5 = if(15 slope slope = 45, 5, null()) class_6 = if(45 slope slope = 70, 6, null()) class_7 = if(slope slope 70, 7, null()) EOF This will generate all 7 output maps in one go, reading the input map only once (most r.mapcalc calculations spend more time reading and writing raster maps than performing calculations). 3. This: r.mapcalc slope.reclass = class_1 + class_2 + class_3 + class_4 + class_5 + class_6 + class_7 will result in an all-null map, as arithmetic operators return null if either input is null. Changing the null() with 0 in the calculation of the class_* maps would fix this, or you could just use r.patch instead of r.mapcalc. Sticking with r.mapcalc, it would be simpler (and more efficient) to generate the output map directly from the input, without generating any intermediate maps, e.g.: r.mapcalc EOF slope.reclass = \ if(slope = 2, 1,\ if(slope = 5, 2,\ if(slope = 10, 3,\ if(slope = 15, 4,\ if(slope = 45, 5,\ if(slope = 70, 6,\ 7)) EOF [The above could be written on one line, but splitting the expression with backslash-newline improves legibility.] But for this specific case, it's probably simpler to just generate an integer version of the slope map (if it isn't already) and use r.reclass, e.g. r.reclass input=slope output=slope.reclass rules=- EOF 0 thru 2 = 1 3 thru 5 = 2 6 thru 10 = 3 11 thru 15 = 4 16 thru 45 = 5 46 thru 70 = 6 * = 7 EOF -- Glynn Clements gl...@gclements.plus.com ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user
Re: [GRASS-user] reset zone in projection settings
On Tue, 28 May 2013, Janet Choate wrote: Hello GRASS users,i have reset my locations projection settings - for the purpose of updating the zone from 0 to 11. however, after running g.setproj to make this change, g.region -p still shows the zone set to 0. is there another command that i should use, or a series of commands that need to be executed to make this change? any guidance would be appreciated. One possibility is that g.setproj has correctly updated your default region, but you now need to reset your current region to the (new) default. You can do this by running: g.region -d Does that help? Paul___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user
Re: [GRASS-user] reset zone in projection settings
Janet Choate wrote: Hello GRASS users,i have reset my locations projection settings - for the purpose of updating the zone from 0 to 11. however, after running g.setproj to make this change, g.region -p still shows the zone set to 0. is there another command that i should use, or a series of commands that need to be executed to make this change? any guidance would be appreciated. Paul Kelly wrote: One possibility is that g.setproj has correctly updated your default region, but you now need to reset your current region to the (new) default. You can do this by running: g.region -d Does that help? Janet, Paul, what about g.proj -c without specifying a new location=? Isn't this another option? Best, Nikos ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user
Re: [GRASS-user] Using wildcards or regular expressions in r.gui.animation?
Rainer wrote: is it possible to specify the names of the raster maps to be animated by using UNIX style wild cards as in r.out.mpeg, i.e. use g.mlist. for example: r.patch out=mosaic.dem in=`g.mlist rast patt=tile.* sep=,` there's another example in the r.series help page. Hamish ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user