Re: [GRASS-user] Suggestion for creating a script to create a map of agricultural capacity

2013-05-29 Thread Moritz Lennert

On 28/05/13 21:33, Glynn Clements wrote:

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



Or keep the FCELL or DCELL and just use r.recode:

r.recode input=slope output=slope.recode rules=-EOF
*:2:1
2:5:2
5:10:3
10:15:4
15:45:5
45:70:6
70:*:7
EOF

?

Moritz
___
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?

2013-05-29 Thread Rainer M. Krug


Hamish hamis...@yahoo.com writes:

 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=,`


True - should have thought about this. Could an example using g.mlist
added to the g.gui.animation manual?

Thanks,

Rainer


 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


-- 
Rainer M. Krug


pgpuUShF_xwXv.pgp
Description: PGP signature
___
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

2013-05-29 Thread Hamish
Glynn wrote:
 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


note that r.reclass can read floating point maps too, but
it's a bit buggy/weird,
  https://trac.osgeo.org/grass/ticket/1525#comment:10


Hamish
___
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

2013-05-29 Thread Martin Lacayo
Hi Markus,

Thank you for the link, that is very helpful.

I would prefer to use SEXTANTE over GRASS since it also gives access
to other tools as well, but so far I have had more luck with GRASS. I
will post an update once one of these approaches works.

I've compiled and installed GRASS 6.4.3RC3 from source, but now I'm
having trouble installing the r.viewshed extension.

I'm getting the following error:

make: *** No rule to make target `/usr/local/grass-6.4.3RC3/
lib/libgrass_iostream.6.4.3RC3.a', needed by
`/home/mlacayo/grass/newLocation/PERMANENT/.tmp/ncp-
cloos/10168.0/r.viewshed/bin/r.viewshed'.  Stop.
ERROR: Compilation failed, sorry. Please check above error messages.
(Wed May 29 11:53:36 2013) Command finished (7 sec)

As a test I tried installing g.md5sum and r.area, which installed
without problems.

Any suggestions?

-Martin


On Tue, May 28, 2013 at 11:20 AM, Markus Metz
markus.metz.gisw...@gmail.com wrote:
 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


Re: [GRASS-user] Suggestion for creating a script to create a map of agricultural capacity

2013-05-29 Thread Glynn Clements

Hamish wrote:

  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
 
 note that r.reclass can read floating point maps too, but
 it's a bit buggy/weird,
   https://trac.osgeo.org/grass/ticket/1525#comment:10

Right; r.reclass just generates the table, the actuall reclass is
performed by lib/raster. If the base map is floating-point, it will be
coerced to integer using its associated quantisation rules.

Note that r.reclass doesn't pay any attention to the map's
quantisation rules (even if it did, they could be changed between the
reclass being created and being used, and the rules at the time of use
would have effect).

The buggy rounding code should probably be replaced with e.g.

*v = (CELL) floor(fv + 0.5);
or:
*v = (CELL) ceil(fv - 0.5);
or:
*v = (CELL) (fv  0 ? floor(fv + 0.5) : ceil(fv - 0.5));

These differ on whether values lying exactly on a 0.5 boundary are
rounded toward positive infinity, toward negative infinity, or away
from zero respectively. The last one mimics the behaviour of C99's
round() function.

-- 
Glynn Clements gl...@gclements.plus.com
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user