[GRASS-user] grass-user Digest, Vol 99, Issue 1

Dear grass-user group

Could you help me, How to create watershed boundary using grass-gis (step by steps).

Thank you very much for your support

Best regards

···

2014-07-01 19:05 GMT+07:00 <grass-user-request@lists.osgeo.org>:

Send grass-user mailing list submissions to
grass-user@lists.osgeo.org

To subscribe or unsubscribe via the World Wide Web, visit
http://lists.osgeo.org/mailman/listinfo/grass-user
or, via email, send a message with subject or body ‘help’ to
grass-user-request@lists.osgeo.org

You can reach the person managing the list at
grass-user-owner@lists.osgeo.org

When replying, please edit your Subject line so it is more specific
than “Re: Contents of grass-user digest…”

Today’s Topics:

  1. Python modules problems after last OSX GIS updates
    (Carlos Grohmann)
  2. Re: [Qgis-user] Python modules problems after last OSX GIS
    updates (William Kyngesburye)
  3. Re: [Qgis-user] Python modules problems after last OSX GIS
    updates (Anna Petr??ov?)
  4. Re: [GRASS-dev] Parallelize a job using multiprocess python
    library without destroying environmental variable (Annalisa Minelli)

Message: 1
Date: Mon, 30 Jun 2014 17:28:38 -0300
From: Carlos Grohmann <carlos.grohmann@gmail.com>
To: William Kyngesburye <kyngchaos@kyngchaos.com>, GRASS user list
<grass-user@lists.osgeo.org>, QGis Mailinglist
<qgis-user@lists.osgeo.org>
Subject: [GRASS-user] Python modules problems after last OSX GIS
updates
Message-ID:
<CALkQ4RCN6V93S=Lr5sKDLTUsVJsgMNOFw9pMGf9fjAZ=25ha-Q@mail.gmail.com>
Content-Type: text/plain; charset=“iso-8859-1”

Hello, apologies for cross-posting but this might be happening to other
users

After installing the latest packages updates from William Kyngesburye on
OSX 10.9 Mavericks, I’m getting lots of errors, both in Matplotlib and
GDAL. From what I could see, that all return the “mach-o, but wrong
architecture” error, so this might be related to William’s recent setup for
packaging using a virtual machine.

I’m also getting the some errors with wxpython running GRASS 6.4.4

Unfortunately for me, Matplotlib is pretty much essential, so I’m hoping
this issues get fixed soon.

best

Carlos


Prof. Carlos Henrique Grohmann
Institute of Energy and Environment - Univ. of S?o Paulo, Brazil

  • Digital Terrain Analysis | GIS | Remote Sensing -

http://carlosgrohmann.com
http://orcid.org/0000-0001-5073-5572


Can’t stop the signal.
-------------- next part --------------
An HTML attachment was scrubbed…
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20140630/fb0c3d97/attachment-0001.html>


Message: 2
Date: Mon, 30 Jun 2014 18:57:06 -0500
From: William Kyngesburye <woklist@kyngchaos.com>
To: Carlos Grohmann <carlos.grohmann@gmail.com>
Cc: GRASS user list <grass-user@lists.osgeo.org>, QGis Mailinglist
<qgis-user@lists.osgeo.org>
Subject: Re: [GRASS-user] [Qgis-user] Python modules problems after
last OSX GIS updates
Message-ID: <49A4EFB2-11B1-4F7E-9D1E-99BFB786063A@kyngchaos.com>
Content-Type: text/plain; charset=windows-1252

What are the errors? Do you have simple examples I can try? I updated matplotlib and GDAL a month ago and this is the first I’ve heard of problems. I am not packaging with a virtual machine.

I did hear about GRASS problems. There are font warnings due to a slip in wxPython bugfixing - fixed for wx Carbon but not wx Cocoa. I am now using wxPython 3 Cocoa, and I read that there were fixes in GRASS for that version, but maybe there are other problems, or it may be an OS X thing.

On Jun 30, 2014, at 3:28 PM, Carlos Grohmann <carlos.grohmann@gmail.com> wrote:

Hello, apologies for cross-posting but this might be happening to other users

After installing the latest packages updates from William Kyngesburye on OSX 10.9 Mavericks, I’m getting lots of errors, both in Matplotlib and GDAL. From what I could see, that all return the “mach-o, but wrong architecture” error, so this might be related to William’s recent setup for packaging using a virtual machine.

I’m also getting the some errors with wxpython running GRASS 6.4.4

Unfortunately for me, Matplotlib is pretty much essential, so I’m hoping this issues get fixed soon.

best

Carlos


Prof. Carlos Henrique Grohmann
Institute of Energy and Environment - Univ. of S?o Paulo, Brazil

  • Digital Terrain Analysis | GIS | Remote Sensing -

http://carlosgrohmann.com
http://orcid.org/0000-0001-5073-5572


Can?t stop the signal.


Qgis-user mailing list
Qgis-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-user


William Kyngesburye <kyngchaosatkyngchaosdotcom>
http://www.kyngchaos.com/

“Those people who most want to rule people are, ipso-facto, those least suited to do it.”

  • A rule of the universe, from the HitchHiker’s Guide to the Galaxy

Message: 3
Date: Mon, 30 Jun 2014 21:08:45 -0400
From: Anna Petr??ov? <kratochanna@gmail.com>
To: William Kyngesburye <kyngchaos@kyngchaos.com>
Cc: GRASS user list <grass-user@lists.osgeo.org>, QGis Mailinglist
<qgis-user@lists.osgeo.org>
Subject: Re: [GRASS-user] [Qgis-user] Python modules problems after
last OSX GIS updates
Message-ID:
<CAE0EDEpbyrRaB2zN2sR2RDU9VoZeGF8U8wk1rm1=6+m7XJBymw@mail.gmail.com>
Content-Type: text/plain; charset=“utf-8”

Hi,

On Mon, Jun 30, 2014 at 7:57 PM, William Kyngesburye <woklist@kyngchaos.com>
wrote:

What are the errors? Do you have simple examples I can try? I updated
matplotlib and GDAL a month ago and this is the first I’ve heard of
problems. I am not packaging with a virtual machine.

I did hear about GRASS problems. There are font warnings due to a slip in
wxPython bugfixing - fixed for wx Carbon but not wx Cocoa. I am now using
wxPython 3 Cocoa, and I read that there were fixes in GRASS for that
version, but maybe there are other problems, or it may be an OS X thing.

Regarding wxPython3 Cocoa, there is still a lot of problems. I found
several tickets on wxWidgets which we are affected by and only for some of
them there is a workaround. WxGUI works only to certain extent, but there
are problems with dialog modality, map selection widget, toolbars and other
pretty serious things. On the other hand, wxnviz seems to work pretty well,
although switching back to 2D mode, makes the GUI unresponsive which is bug
in a notebook widget, not wxNviz.

On Jun 30, 2014, at 3:28 PM, Carlos Grohmann <carlos.grohmann@gmail.com>
wrote:

Hello, apologies for cross-posting but this might be happening to other
users

After installing the latest packages updates from William Kyngesburye on
OSX 10.9 Mavericks, I’m getting lots of errors, both in Matplotlib and
GDAL. From what I could see, that all return the “mach-o, but wrong
architecture” error, so this might be related to William’s recent setup for
packaging using a virtual machine.

I’m also getting the some errors with wxpython running GRASS 6.4.4

Unfortunately for me, Matplotlib is pretty much essential, so I’m hoping
this issues get fixed soon.

sorry, no idea about this

Anna

best

Carlos


Prof. Carlos Henrique Grohmann
Institute of Energy and Environment - Univ. of S?o Paulo, Brazil

  • Digital Terrain Analysis | GIS | Remote Sensing -

http://carlosgrohmann.com
http://orcid.org/0000-0001-5073-5572


Can?t stop the signal.


Qgis-user mailing list
Qgis-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-user


William Kyngesburye <kyngchaosatkyngchaosdotcom>
http://www.kyngchaos.com/

“Those people who most want to rule people are, ipso-facto, those least
suited to do it.”

  • A rule of the universe, from the HitchHiker’s Guide to the Galaxy

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

-------------- next part --------------
An HTML attachment was scrubbed…
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20140630/89412d9f/attachment-0001.html>


Message: 4
Date: Tue, 1 Jul 2014 14:05:33 +0200
From: Annalisa Minelli <annagrass6@gmail.com>
To: Javier Mart?nez-L?pez <javi.martinez.lopez@gmail.com>
Cc: grass-user grass-user <grass-user@lists.osgeo.org>,
grass-dev@lists.osgeo.org” <grass-dev@lists.osgeo.org>
Subject: Re: [GRASS-user] [GRASS-dev] Parallelize a job using
multiprocess python library without destroying environmental variable
Message-ID:
<CAOVnxB8o9iMvAzUjmRBucaDjNAuQJFM6j5rnaPC8+JgSK-Xb3Q@mail.gmail.com>
Content-Type: text/plain; charset=“utf-8”

Thanks to both,
I will have a look at your advices/ideas and tell you if I can solve!

All the best,
Annalisa

2014-06-30 20:17 GMT+02:00 Javier Mart?nez-L?pez <
javi.martinez.lopez@gmail.com>:

Hi Annalisa,

I still need to learn a lot about this and have not tested Vaclav’s
advice yet, which is probably the best way to go, but you can take a
look at some scripts I wrote for doing this:

https://github.com/javimarlop/eHabpy/blob/master/pas/tmp/parallel_segmentation_pca.py

https://github.com/javimarlop/eHabpy/blob/master/pas/parallel_grass_example.py

They are working for me, but as Markus Metz also mentioned me once, if
you are not using a cluster and there is a lot of writing/reading from
the same hard disk, you will probably not speed up considerably the
processing. In any case, I am also very interested in further
developing this script, so any ideas are welcome!

Cheers,

Javier

On Mon, Jun 30, 2014 at 4:05 PM, Vaclav Petras <wenzeslaus@gmail.com>
wrote:

On Mon, Jun 30, 2014 at 5:21 AM, Annalisa Minelli <annagrass6@gmail.com>
wrote:

Hi all,
I’m attempting to parallelize a job in a python script using
multiprocess
library in grass70.
I had a look at the following links:
http://grasswiki.osgeo.org/wiki/Parallel_GRASS_jobs
and http://grasswiki.osgeo.org/wiki/Parallelizing_Scripts.

I would like to work in the same location but in different mapsets
because
my jobs touch the region settings, but I don’t know how to set separate
mapset for separate jobs.

Since now I discovered that this processes, if run in the same mapset,
clean all the environmental variables (GISDBASE, LOCATION, MAPSET) so
then
GRASS does not start anymore and I have to restore the .grass70/rc
file…

can anyone hint me on how to set different mapsets for different jobs?

First, look at the PyGRASS GridModule [1] whether this can help you.

For general case, there is unfortunately no API. From what I understand,
you
have to create a file “gisrc” somewhere and then do something like env =
copy(os.environ) and change GISRC there to your custom “gisrc”. Then you
the
change the mapset and region by standard GRASS means but you must pass
env
parameter to all command/module calls (env is used by Python subprocess
to
set environment just for one process).

Note that GISRC, GISBASE and LOCATION are (system) environmental
variables
while GISDBASE, LOCATION_NAME and MAPSET are GRASS GIS
session/environment
variables and are stored in “gisrc” file. I don’t have an idea what
LOCATION
variable is for (it contains full path to the mapset).

I would be glad to hear what others think about this.

You can of course read source code of GridModule, rendering in wxGUI,
g.gui.animation, or the following snipped but I don’t say that it will be
easy to understand and there might be a lot of imperfections.

Vaclav

we rely on the tmp dir having enough space for our map

tgt_gisdbase = tempfile.mkdtemp()

this is not needed if we use mkdtemp but why not

tgt_location = ‘r.out.png.proj_location_%s’ % epsg_code

because we are using PERMANENT we don’t have to create mapset

explicitly
tgt_mapset_name = ‘PERMANENT’

src_mapset = Mapset(src_mapset_name)

get source (old) and set target (new) GISRC enviromental variable

TODO: set environ only for child processes could be enough and it

would

enable (?) parallel runs

src_gisrc = os.environ[‘GISRC’]
tgt_gisrc = gsetup.write_gisrc(tgt_gisdbase,
tgt_location, tgt_mapset_name)

we should use a copy and pass it but then it would not be possible

to

use create_location
os.environ[‘GISRC’] = tgt_gisrc
if os.environ.get(‘WIND_OVERRIDE’):
old_temp_region = os.environ[‘WIND_OVERRIDE’]
del os.environ[‘WIND_OVERRIDE’]
else:
old_temp_region = None

these lines looks good but anyway when developing the module

switching location seemed fragile and on some errors (while running

unfinished module) location was switched in the command line

try:

the function itself is not safe for other (backgroud) processes

(e.g. GUI), however we already switched GISRC for us

and child processes, so we don’t influece others

gcore.create_location(dbase=tgt_gisdbase,
location=tgt_location,
epsg=epsg_code,
datum=None,
datum_trans=None)

Mapset object cannot be created if the real mapset does not

exists

tgt_mapset = Mapset(gisdbase=tgt_gisdbase, location=tgt_location,
mapset=tgt_mapset_name)

set the current mapset in the library

we actually don’t need to switch when only calling modules

(right GISRC is enough for them)

tgt_mapset.current()

[1] http://grass.osgeo.org/grass71/manuals/pygrass/modules_grid.html

All the best,
Annalisa


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


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

-------------- next part --------------
An HTML attachment was scrubbed…
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20140701/405b02e6/attachment.html>



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

End of grass-user Digest, Vol 99, Issue 1



Lê Anh Hùng
Center for Forest Information and Consultancy (CFIC)
No. 340, Bach Dang street, Hoan Kiem district, Ha Noi,
Tel (office): 04.3.9320734
Mobile: 0914574246
Email1: Hungcfic@gmail.com
Email2: Hung_cfic75@yahoo.com

On Wed, Jul 2, 2014 at 3:18 AM, Hung Le <hungcfic@gmail.com> wrote:

Dear grass-user group
Could you help me, How to create watershed boundary using grass-gis (step by
steps).
Thank you very much for your support
Best regards

You can find an example here:

http://grass.osgeo.org/grass70/manuals/r.watershed.html#create-watershed-basins-map-and-convert-to-a-vector-polygon-map

The sample dataset "Spearfish" is available here:
http://grass.osgeo.org/download/sample-data/
--> Spearfish data set

Markus