Re: [GRASS-user] SOLVED: How to implement 2D lookup table?

2013-05-24 Thread Rainer M Krug
On Friday, May 24, 2013, Glynn Clements wrote:


 Rainer M. Krug wrote:

   Hmm - sounds interesting, but also for other purposes. But as the
 result
   will be a raster map, I don't think this approach is usable here
 (unless
   I can feed the numbers back into a raster map, i.e. the inverse of
   r.stats -c)
  
   r.cross + r.reclass ?
 
  There is one aspect in r.cross which makes this approach quite
  difficult to implement: the value of the result map layer can not easily
  be traced back to the values of the two input layers:

 If you only have a small number of classes, you can just create the
 cross-product manually, e.g.:

 r.mapcalc 'result = ageClass * 10 + dc'


Yes - This is effectively what I am doing now.



 So a category of 15 would be ageClass=1, dc=5.

 r.cross is more useful when the total number of pairs which actually
 occur is much fewer than the product of the numbers of categories, as
 it only creates a category for each combination which actually occurs,
 not for each potential combination.


True. The problem I have with r.cross is that I have to manually decode
afterwords what combination the value refers to. I could use a she'll
script to translate the category values, but this sounds a little tedious,
especially as the format is not that easily parsable.

Cheers,

Rainer



 --
 Glynn Clements gl...@gclements.plus.com javascript:;



-- 
NEW GERMAN FAX NUMBER!!!

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

Centre of Excellence for Invasion Biology
Natural Sciences Building
Office Suite 2039
Stellenbosch University
Main Campus, Merriman Avenue
Stellenbosch
South Africa

Cell:   +27 - (0)83 9479 042
Fax:+27 - (0)86 516 2782
Fax:+49 - (0)321 2125 2244
email:  rai...@krugs.de

Skype:  RMkrug
Google: r.m.k...@gmail.com
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


Re: [GRASS-user] Getting Started with GRASS Python Scripts

2013-05-24 Thread Moritz Lennert

On 23/05/13 22:49, Martin Lacayo wrote:

Hello,

I am having trouble getting started with GRASS Python scripts. I am
using GRASS 6.4 on Debian. Could some provide a basic example of a
Python script that imports a raster and exports the same raster? In
particular I am interested in seeing the entire setup of a database
(locally on disk), location, and mapset from start to finish. Every
example I have found starts with an existing database, location, and
mapset. I have been able to get past this part by using the GUI, but I
need to be able to script their creation.


A database is just a directory, so new problem creating that.

You can create a new location with g.proj location= and a new mapset 
with g.mapset -c. But for these commands to work, you need to be in an 
existing location. IMHU, the easiest is to have a dummy location set up 
that you can connect to in your script, create the new location and 
mapset, and then connect to that new location.


In theory you could create your own location manually, but that implies 
creating all the support files (PROJ, DEFAULT_WIND, etc).




Have I understood correctly that a database can only contain one
projection, which is set when it is first created, and that besides
importing and exporting data all processing has to happen with data
that is in the database?


Yes. You can possibly work with v./r.external, but IIRC that does not 
give you full topology, so not all all GRASS modules are sure to work as 
expected (don't know about r.viewshed, though).



Is it possible to script the creation of a database (locally on disk),
location, and mapset? And how would you remove them afterwards?


To remove a location or mapset you just delete the relevant directory.


Moritz
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


Re: [GRASS-user] Getting Started with GRASS Python Scripts

2013-05-24 Thread Paolo Cavallini
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Il 23/05/2013 22:49, Martin Lacayo ha scritto:

 My ultimate goal is to decrease our development time for our open
 source ecosystem service tools: http://invest-natcap.googlecode.com,
 but more specifically at the moment I am trying to use r.viewshed so I
 do not have to write my own.

Why not using GRASS through SEXTANTE for this? In this case you have nothing to 
do,
just call whatever module you need.
All the best.
- -- 
Paolo Cavallini - Faunalia
www.faunalia.eu
Full contact details at www.faunalia.eu/pc
Nuovi corsi QGIS e PostGIS: http://www.faunalia.it/calendario
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAlGfGNUACgkQ/NedwLUzIr5QQQCcCyEDZmgSjTO2gnRC+Jk5jGRf
1esAmwSA0nx2cNbrRNNBkPtcotrdZvHt
=NNfh
-END PGP SIGNATURE-
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


[GRASS-user] r.example

2013-05-24 Thread Pedro Mendonça
Hi!
 I'm a newbie to GRASS and would like to do some C programming with its modules.
 I'm having some troubles putting to work just a simple raster example 
(r.example)!
 
 I'm on a Debian squeeze machine and installed Quantum GIS with the GRASS 
plug-in. Nevertheless I installed GRASS (version 6.4.0~rc6+42329-3) via  
Synaptic Package Manager because I just want to use GRASS modules.
 I checked where it was installed and the grass64 is in usr/bin but many 
functions are in usr/lib/grass64/bin.
 From a terminal window I can call GRASS just by typing grass. So far so good.

 Then, I looked for a simple example for reading a raster file in C and found 
out about the r.example (although didn't find it in my local installment). So, 
I downloaded the GRASS source code version 6.4.3RC3 and unzipped it to a folder 
placed in my Desktop.

 Now, from a Terminal window, I went to the r.example directory and typed 
make. Here is the result:


pedro@PedroHost:~/Desktop/grass-6.4.3RC3/doc/raster/r.example$ make
make: @GRASS_HOME@/dist.@host@/tools/g.echo@EXEEXT@: Command not found
make: @GRASS_HOME@/dist.@host@/tools/g.echo@EXEEXT@: Command not found
mkdir -p @GRASS_HOME@/bin.@host@
mkdir -p @GRASS_HOME@/dist.@host@/include/grass
mkdir -p @GRASS_HOME@/dist.@host@/lib
mkdir -p @GRASS_HOME@/dist.@host@/bin
mkdir -p @GRASS_HOME@/dist.@host@/etc
mkdir -p @GRASS_HOME@/dist.@host@/driver
mkdir -p @GRASS_HOME@/dist.@host@/driver/db
mkdir -p @GRASS_HOME@/dist.@host@/fonts
test -d OBJ.@host@ || mkdir -p OBJ.@host@
/bin/sh: CC@: not found
make: *** [OBJ.@host@/main.o] Error 127


Am I doing something wrong, do I need to install anything else or configure 
something?


Best Regards,
 Pedro Mendonca
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


Re: [GRASS-user] r.example

2013-05-24 Thread Hamish
Pedro wrote:
  I'm on a Debian squeeze machine ... installed GRASS
 (version 6.4.0~rc6+42329-3)

(fwiw that is essentially one or two commits away from 6.4.1)

  Then, I looked for a simple example for reading a raster
 file in C and found out about the r.example (although didn't
 find it in my local installment).

yes, it's just an example of the source code.

 So, I downloaded the GRASS source code version 6.4.3RC3 and
 unzipped it to a folder placed in my Desktop.

good,

  Now, from a Terminal window, I went to the r.example
 directory and typed make. Here is the result:

you'll have to install the build dependencies and run ./configure
first,

try as root:
 apt-get build-dep grass

then
 renice +17 -p $$
 CFLAGS=-ggdb -march=native -Wall -Werror-implicit-function-declaration \
  ./configure \
--with-tcltk-includes=/usr/include/tcl8.5 --with-cairo \
--with-motif --with-python=/usr/bin/python2.6-config \
--with-readline --with-cxx --with-odbc --with-sqlite \
--with-freetype --with-freetype-includes=/usr/include/freetype2 \
--without-postgres --with-proj-share=/usr/share/proj \
--enable-64bit --with-pthread -with-openmp \
--with-wxwidgets=/usr/lib/wx/config/gtk2-unicode-release-2.8 \
--with-geos \
21 | tee config_log.txt

 make -j 5


see also the README in the debian/ dir in the source package and
  http://grasswiki.osgeo.org/wiki/Compile_and_Install_Ubuntu



Hamish
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


[GRASS-user] space interpolation of time datasets

2013-05-24 Thread Bianca Federici

Dear all,

I need a suggestion.
I have 180 point dislocated in europe, at which are a value (gps 
tropospheric delay) that vary in time (every 2 hours) for several years.
I want to interpolate between such points to create a raster map for 
each temporal istance (one every 2 hours), and then look at the 
evolution of such parameter in time.
Instead, I do not have to integrate data with different time 
discretization...
Do you suggest me to use temporal modules in Grass7? and store such 
point data in a temporal db?

or to use the old dfb?

Thanks for your time!
Bianca

--
Eng. Bianca Federici, PhD
Assistant Professor in Geomatics
DICCA - Department of Civil, Chemical and Environmental Engineering
Laboratory of Geodesy, Geomatics and GIS
University of Genoa
- Via Montallegro, 1 - 16145 Genova ITALY
  Phone: +39 010 353 2421 - Fax: +39 010 353 2546
- Academic Center of Savona - Delfino Building
  Via A. Magliotto, 2 - 17100 Savona ITALY
  Phone: +39 019 219 45381 - Fax: +39 019 219 45382
- E-mail: bianca.feder...@unige.it - www.dicca.unige.it
-
The only race that I know is that human - A. Einstein
Beginning and end of research is the knowledge - A.M. Manzino
-
Please consider the environment before printing this email!

___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


Re: [GRASS-user] GRASS7 temporal GIS database questions

2013-05-24 Thread Sören Gebbert
Hi Rainer,


2013/5/22 Rainer M. Krug rai...@krugs.de

 Hi

 I am doing spatio-temporal simulations with R and GRASS and IO am
 thinking about using a temporal GIS database to store the resulting
 raster layers in.

 But I have a few questions about the temporal GIS database:

 1) If I register a raster map in a temporal GIS database via r.register,
 can I delete the original raster map and the info is stored in the
 temporal GIS database?


Yes, the info is still stored in the temporal database, unless you call
t.support with -m option.



 2) If 1) is possible, can I extract the raster layer again from the
 temporal GIS database?

 No, that's not possible since only the spatio-temporal extent and some
metadata is stored in the temporal database. The map data itself will not
copied.


 3) Summarizing: Is the temporal GIS database a good archiving place for
 the layers I create during the simulation?


If you think that GRASS is a good archiving place then yes. But be aware
that a large temporal database with lots of maps with slow down the
temporal database access. If you want to store 10.000 maps, then you
should use postgresql as temporal database backend.


Best regards
Soeren



 Thanks,

 Rainer


 --
 Rainer M. Krug

 ___
 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


Re: [GRASS-user] GRASS7 temporal GIS database questions

2013-05-24 Thread Rainer M. Krug
Hi

Sören Gebbert soerengebb...@googlemail.com writes:

 Hi Rainer,


 2013/5/22 Rainer M. Krug rai...@krugs.de

 Hi

 I am doing spatio-temporal simulations with R and GRASS and IO am
 thinking about using a temporal GIS database to store the resulting
 raster layers in.

 But I have a few questions about the temporal GIS database:

 1) If I register a raster map in a temporal GIS database via r.register,
 can I delete the original raster map and the info is stored in the
 temporal GIS database?


 Yes, the info is still stored in the temporal database, unless you call
 t.support with -m option.



 2) If 1) is possible, can I extract the raster layer again from the
 temporal GIS database?

 No, that's not possible since only the spatio-temporal extent and some
 metadata is stored in the temporal database. The map data itself will not
 copied.


OK - that is the info I needed. In this case, the spatio temporal
database is not an option for me for archiving.

 3) Summarizing: Is the temporal GIS database a good archiving place for
 the layers I create during the simulation?


 If you think that GRASS is a good archiving place then yes. But be aware
 that a large temporal database with lots of maps with slow down the
 temporal database access. If you want to store 10.000 maps, then you
 should use postgresql as temporal database backend.

I was thinking about this - but seting up a postgresql server on a
cluster and to maintain it (or bug the administrator to do it) as I am
the only one using it, is not an option at the moment - but I'll keep it
definitely in mind.

Thanks a lot,

Rainer



 Best regards
 Soeren



 Thanks,

 Rainer


 --
 Rainer M. Krug

 ___
 grass-user mailing list
 grass-user@lists.osgeo.org
 http://lists.osgeo.org/mailman/listinfo/grass-user



-- 
Rainer M. Krug


pgpylhKi0O8fj.pgp
Description: PGP signature
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


Re: [GRASS-user] Getting Started with GRASS Python Scripts

2013-05-24 Thread Martin Lacayo
Hello Paolo,

Yes, my initial thought was to just use GRASS via SEXTANTE. I tired to
do this, but did not have any luck. I posted previously on 14/5/2013
to qgis-users with the subject How to run SEXTANTE algorithms outside
of QGIS Python console? but did not get a solution to the problem I
encountered, which I thought was related to creating a QGIS instance
so that I could make calls to SEXTANTE. If you have any suggestions
that would be much appreciated.

Thank you,
Martin


On Fri, May 24, 2013 at 12:37 AM, Paolo Cavallini cavall...@faunalia.it wrote:
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1

 Il 23/05/2013 22:49, Martin Lacayo ha scritto:

 My ultimate goal is to decrease our development time for our open
 source ecosystem service tools: http://invest-natcap.googlecode.com,
 but more specifically at the moment I am trying to use r.viewshed so I
 do not have to write my own.

 Why not using GRASS through SEXTANTE for this? In this case you have nothing 
 to do,
 just call whatever module you need.
 All the best.
 - --
 Paolo Cavallini - Faunalia
 www.faunalia.eu
 Full contact details at www.faunalia.eu/pc
 Nuovi corsi QGIS e PostGIS: http://www.faunalia.it/calendario
 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1.4.12 (GNU/Linux)
 Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

 iEYEARECAAYFAlGfGNUACgkQ/NedwLUzIr5QQQCcCyEDZmgSjTO2gnRC+Jk5jGRf
 1esAmwSA0nx2cNbrRNNBkPtcotrdZvHt
 =NNfh
 -END PGP SIGNATURE-
 ___
 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.viewshed Python Script OSError

2013-05-24 Thread Martin Lacayo
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?

Thank you,
Martin
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user