Re: [GRASS-user] [GRASS-dev] experimental Python 3 support in trunk

2018-09-03 Thread Martin Landa
Hi,

po 3. 9. 2018 v 20:47 odesílatel Markus Neteler  napsal:

my first attempt to start GRASS fails with:

(grasspy3) martin@debian:~/src/grass7_trunk$
./bin.x86_64-pc-linux-gnu/grass77 -text
Traceback (most recent call last):
  File "./bin.x86_64-pc-linux-gnu/grass77", line 2162, in 
main()
  File "./bin.x86_64-pc-linux-gnu/grass77", line 2010, in main
set_paths(grass_config_dir=grass_config_dir)
  File "./bin.x86_64-pc-linux-gnu/grass77", line 623, in set_paths
os.environ['MANPATH'] = sys_man_path
  File "/home/martin/Downloads/grasspy3/lib/python3.6/os.py", line
674, in __setitem__
value = self.encodevalue(value)
  File "/home/martin/Downloads/grasspy3/lib/python3.6/os.py", line
744, in encode
raise TypeError("str expected, not %s" % type(value).__name__)
TypeError: str expected, not bytes

Is it expected? Ma

-- 
Martin Landa
http://geo.fsv.cvut.cz/gwiki/Landa
http://gismentors.cz/mentors/landa
___
grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user

Re: [GRASS-user] experimental Python 3 support in trunk

2018-09-03 Thread Markus Neteler
On Mon, Sep 3, 2018 at 3:48 PM Anna Petrášová  wrote:
> On Mon, Sep 3, 2018 at 2:28 AM Markus Neteler  wrote:
...
>> Could you please post a few lines how to properly do the testing with
>> virtualenv?
>
> https://trac.osgeo.org/grass/wiki/Python3Support#Howtotest

Thanks.
I took liberty to expand that section a bit (a bit more text; and with
hints for Fedora users as well).

> also, we have now new small dependency - Python 'six' package

ok, perhaps to be added in REQUIREMENTS.txt as well?

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

Re: [GRASS-user] experimental Python 3 support in trunk

2018-09-03 Thread Rich Shepard

On Mon, 3 Sep 2018, Anna Petrášová wrote:


https://trac.osgeo.org/grass/wiki/Python3Support#Howtotest


Anna,

  I don't use virtualenvs because my projects are small and often
single-project-specific. Installed here are these python3 packages:

python3-3.6.5-i586-1_SBo
python3-PyQt5-5.9.2-i586-1_SBo
python3-Pygments-2.2.0-i586-1_SBo
python3-cycler-0.10.0-i586-1_SBo
python3-dateutil-2.7.3-i586-1_SBo
python3-decorator-4.3.0-i586-1_SBo
python3-ipython-6.5.0-i586-1_SBo
python3-ipython_genutils-0.2.0-i586-1_SBo
python3-jedi-0.12.1-i586-1_SBo
python3-matplotlib-1.5.2-i586-1_SBo
python3-parso-0.3.1-i586-1_SBo
python3-pexpect-4.6.0-i586-1_SBo
python3-pickleshare-0.7.4-i586-1_SBo
python3-pillow-3.0.0-i586-2_SBo
python3-prompt_toolkit-1.0.15-i586-1_SBo
python3-ptyprocess-0.6.0-i586-1_SBo
python3-pyparsing-2.1.8-i586-1_SBo
python3-simplegeneric-0.8.1-i586-1_SBo
python3-sip-4.19.6-i486-1_SBo
python3-six-1.11.0-i586-1_SBo
python3-tornado-5.1.0-i586-1_SBo
python3-traitlets-4.3.2-i586-1_SBo
python3-wcwidth-0.1.7-i586-1_SBo

  Using revision 73232 I just ran these modules:

v.proj loc=OR map=biota in=all_species
g.region vect=wrb
v.clip in=all_species clip=wrb out=fishes

and displayed the results. I don't know that any of these have Python code
in them. Suggestions for more robust tests are welcome.

Regards,

Rich

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

Re: [GRASS-user] experimental Python 3 support in trunk

2018-09-03 Thread Rich Shepard

On Mon, 3 Sep 2018, Anna Petrášová wrote:


https://trac.osgeo.org/grass/wiki/Python3Support#Howtotest
also, we have now new small dependency - Python 'six' package


Anna,

  On my Slackware-14.2 systems I have both six (for Python2) and python3-six
installed.

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

Re: [GRASS-user] [GRASS-dev] experimental Python 3 support in trunk

2018-09-03 Thread Martin Landa
Hi,

po 3. 9. 2018 v 15:48 odesílatel Anna Petrášová  napsal:
>> > I committed the experimental support of Python 3 to trunk (grass77) by 
>> > Sanjeet (GSoC 2018).

great, thanks for hard work! Python3 support will be crucial for GRASS
in a near feature. Will help with testing. Martin

-- 
Martin Landa
http://geo.fsv.cvut.cz/gwiki/Landa
http://gismentors.cz/mentors/landa
___
grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user

Re: [GRASS-user] issue with grass_session on MacOSX: Cannot find GRASS GIS start script

2018-09-03 Thread Jón Eiríksson
Hi again, - replace the python script with the following (apologies 
version confusion):


#!/usr/bin/env python
#-*- coding:utf-8 -*-

from grass.script import core as grass
from grass.script import db as grass

from grass_session import Session
from grass.script import core as gcore

# create a new location from EPSG code
with Session(gisdb="/Users/jon/a_tmp", location="a_tmp_location", 
create_opts="EPSG:3057"):


   print '-'



# create a new mapset in an existing location
with Session(gisdb="/Users/jon/a_tmp", location="a_tmp_location", 
mapset="a_test", create_opts=""):


   print '--'


Jón



On 3 Sep 2018, at 14:49, Moritz Lennert wrote:


Hi,

A student has been confronted with the following error trying to use 
grass_session on Mac:


**
from grass_session import Session

GRASSBIN: /Applications/GRASS-$GRASS_MMVER.app/Contents/MacOS
cmd: /Applications/GRASS-$GRASS_MMVER.app/Contents/MacOS --config path
out: b''
err: b'/bin/sh: /Applications/GRASS-.app/Contents/MacOS: No such file 
or directory\n'

Traceback (most recent call last):
File "", line 1, in 
from grass_session import Session
File 
"/Users/simon/Documents/Stage/Models/WhiteBoxTools/grass_session/__init__.py", 
line 4, in 

from grass_session.session import (get_platform_name,
File 
"/Users/simon/Documents/Stage/Models/WhiteBoxTools/grass_session/session.py", 
line 259, in 

GISBASE = get_grass_gisbase(grassbin=GRASSBIN)
File 
"/Users/simon/Documents/Stage/Models/WhiteBoxTools/grass_session/session.py", 
line 75, in get_grass_gisbase

"variable").format(grassbin=grassbin))
RuntimeError: Cannot find GRASS GIS start script: 
/Applications/GRASS-$GRASS_MMVER.app/Contents/MacOS, set the right one 
using the GRASSBIN environm. variable




Does anyone have a hint ?

Moritz


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

Re: [GRASS-user] issue with grass_session on MacOSX: Cannot find GRASS GIS start script

2018-09-03 Thread Jón Eiríksson
Hi, I do not know if this is helpful, but the following worked, - after 
being confronted with the same error message:


[1]

See:

https://grasswiki.osgeo.org/wiki/Working_with_GRASS_without_starting_it_explicitly#Important_notes



[2]

The following worked for me with Michael Bartons 7.3 binaries. The 
location and mapset were created from outside GRASS


In Terminal

Install pip:

| => sudo easy_install pip
Password:
Searching for pip
Best match: pip 8.1.1
Adding pip 8.1.1 to easy-install.pth file
Installing pip script to /Users/jon/anaconda2/bin
Installing pip2.7 script to /Users/jon/anaconda2/bin
Installing pip2 script to /Users/jon/anaconda2/bin

Using /Users/jon/anaconda2/lib/python2.7/site-packages
Processing dependencies for pip
Finished processing dependencies for pip

[3]

Install grass-session
 

| ~ @ jons-iMac (jon)
| => pip install grass-session
Collecting grass-session
  Downloading 
https://files.pythonhosted.org/packages/ae/be/5b9f707dff22529358c3d147373658a85599540addffbda9c629dcc97366/grass_session-0.1-py2.py3-none-any.whl

Installing collected packages: grass-session
Successfully installed grass-session-0.1
You are using pip version 8.1.1, however version 18.0 is available.
You should consider upgrading via the 'pip install --upgrade pip' 
command.

 

| ~ @ jons-iMac (jon)
| => pip install --upgrade pip
Collecting pip
  Downloading 
https://files.pythonhosted.org/packages/5f/25/e52d3f31441505a5f3af41213346e5b6c221c9e086a166f3703d2ddaf940/pip-18.0-py2.py3-none-any.whl 
(1.3MB)
100% 
|| 
1.3MB 517kB/s

Installing collected packages: pip
  Found existing installation: pip 8.1.1
Uninstalling pip-8.1.1:
  Successfully uninstalled pip-8.1.1
Successfully installed pip-18.0



[4]

My script:

#!/usr/bin/env python
#-*- coding:utf-8 -*-

from grass.script import core as grass
from grass.script import db as grass

from grass_session import Session
from grass.script import core as gcore

# create a new location from EPSG code
with Session(gisdb="/Users/jon/a_tmp", location="a_tmp_location", 
create_opts="EPSG:3057"):


   print '-'



# create a new mapset in an existing location
with Session(gisdb="/tmp", location="location", mapset="test", 
create_opts=""):


   print '--'


[5]

In Terminal:

| => export GISBASE="/Applications/GRASS-7.3.app/Contents/MacOS"
| => export PYTHONPATH="${PYTHONPATH}:$GISBASE/etc/python/"
| => export LD_LIBRARY_PATH="$DYLD_LIBRARY_PATH:$GISBASE/lib"
| => export GIS_LOCK=$$
| => export GISRC="/Users/jon/.grass7"


| => GRASSBIN=/Applications/GRASS/grass7.app/Contents/MacOS/grass.sh 
python a.py

GRASSBIN: /Applications/GRASS/grass7.app/Contents/MacOS/grass.sh
GISBASE: Rebuilding Addon HTML manual pages index...
Rebuilding Addon menu...
Python 2.7.10 found.
/Applications/GRASS/grass7.app/Contents/MacOS
-
--


Cheers, Jon


On 3 Sep 2018, at 14:49, Moritz Lennert wrote:


Hi,

A student has been confronted with the following error trying to use 
grass_session on Mac:


**
from grass_session import Session

GRASSBIN: /Applications/GRASS-$GRASS_MMVER.app/Contents/MacOS
cmd: /Applications/GRASS-$GRASS_MMVER.app/Contents/MacOS --config path
out: b''
err: b'/bin/sh: /Applications/GRASS-.app/Contents/MacOS: No such file 
or directory\n'

Traceback (most recent call last):
File "", line 1, in 
from grass_session import Session
File 
"/Users/simon/Documents/Stage/Models/WhiteBoxTools/grass_session/__init__.py", 
line 4, in 

from grass_session.session import (get_platform_name,
File 
"/Users/simon/Documents/Stage/Models/WhiteBoxTools/grass_session/session.py", 
line 259, in 

GISBASE = get_grass_gisbase(grassbin=GRASSBIN)
File 
"/Users/simon/Documents/Stage/Models/WhiteBoxTools/grass_session/session.py", 
line 75, in get_grass_gisbase

"variable").format(grassbin=grassbin))
RuntimeError: Cannot find GRASS GIS start script: 
/Applications/GRASS-$GRASS_MMVER.app/Contents/MacOS, set the right one 
using the GRASSBIN environm. variable




Does anyone have a hint ?

Moritz


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

[GRASS-user] issue with grass_session on MacOSX: Cannot find GRASS GIS start script

2018-09-03 Thread Moritz Lennert

Hi,

A student has been confronted with the following error trying to use 
grass_session on Mac:


**
from grass_session import Session

GRASSBIN: /Applications/GRASS-$GRASS_MMVER.app/Contents/MacOS
cmd: /Applications/GRASS-$GRASS_MMVER.app/Contents/MacOS --config path
out: b''
err: b'/bin/sh: /Applications/GRASS-.app/Contents/MacOS: No such file or 
directory\n'

Traceback (most recent call last):
File "", line 1, in 
from grass_session import Session
File 
"/Users/simon/Documents/Stage/Models/WhiteBoxTools/grass_session/__init__.py", 
line 4, in 

from grass_session.session import (get_platform_name,
File 
"/Users/simon/Documents/Stage/Models/WhiteBoxTools/grass_session/session.py", 
line 259, in 

GISBASE = get_grass_gisbase(grassbin=GRASSBIN)
File 
"/Users/simon/Documents/Stage/Models/WhiteBoxTools/grass_session/session.py", 
line 75, in get_grass_gisbase

"variable").format(grassbin=grassbin))
RuntimeError: Cannot find GRASS GIS start script: 
/Applications/GRASS-$GRASS_MMVER.app/Contents/MacOS, set the right one 
using the GRASSBIN environm. variable




Does anyone have a hint ?

Moritz


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

Re: [GRASS-user] experimental Python 3 support in trunk

2018-09-03 Thread Anna Petrášová
On Mon, Sep 3, 2018 at 2:28 AM Markus Neteler  wrote:

> On Mon, Sep 3, 2018 at 4:21 AM Anna Petrášová 
> wrote:
> >
> > Hi,
> >
> > I committed the experimental support of Python 3 to trunk (grass77) by
> Sanjeet (GSoC 2018).
>
> This is excellent, thanks for much for your hard work, Sanjeet, Anna
> and all involved!
>
> > In the first stage of testing, we need to make sure GRASS can compile
> and run with Python 2 without problems. Python 3 support is highly
> experimental, we are still having problems with ctypes and libraries using
> them. However, you should be able to compile GRASS, launch GUI and run
> modules. I tested it on Ubuntu 16.04 with Python 2.7 and Python 3.5
> (virtualenv), utf8 English locale, other platforms were not tested.
>
> Could you please post a few lines how to properly do the testing with
> virtualenv?
>

https://trac.osgeo.org/grass/wiki/Python3Support#Howtotest

also, we have now new small dependency - Python 'six' package


> > For reporting bugs related to this, please create tickets and put
> 'Python3' as keyword (even for problems running GRASS on Python2 related to
> this commit).
> >
> > Anna
>
> thanks again,
> Markus
>
___
grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user

Re: [GRASS-user] experimental Python 3 support in trunk

2018-09-03 Thread Rich Shepard

On Sun, 2 Sep 2018, Anna Petrášová wrote:


I committed the experimental support of Python 3 to trunk (grass77) by
Sanjeet (GSoC 2018). In the first stage of testing, we need to make sure
GRASS can compile and run with Python 2 without problems. Python 3 support
is highly experimental, we are still having problems with ctypes and
libraries using them. However, you should be able to compile GRASS, launch
GUI and run modules. I tested it on Ubuntu 16.04 with Python 2.7 and
Python 3.5 (virtualenv), utf8 English locale, other platforms were not
tested.

For reporting bugs related to this, please create tickets and put
'Python3' as keyword (even for problems running GRASS on Python2 related
to this commit).


Anna,

  Good news. Prior to my invoking grass I update from svn trunk; I see only
7.5 on the source code download page, not 7.7. Regardless, how do I tell
grass to use Python3?

Regards,

Rich

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

Re: [GRASS-user] Understanding Raster Map Input Files

2018-09-03 Thread Pedro Venâncio
Hi Vidura,

Just like Moritz said, you need to start by the basics about GRASS.

That said, it is better to create new raster layers than change the
existing ones.

To test other wind speed and direction, moisture, etc, just create new
rasters with r.mapcalc

https://grass.osgeo.org/grass74/manuals/r.mapcalc.html

Start with constant rasters, using the example in the r.mapcalc manual.

Best regards,
Pedro Venâncio


A seg, 3/09/2018, 06:22, Vidura Dantanarayana  escreveu:

> Hi Pedro,
>
> Thank you very much for the explanation. That helped me to get a basic
> idea of what these files do. Then what I did was to change these files. I
> changed some records in wind speed and wind direction (the files in
> demomapset/cats). But what I observed was there was no change in the shape
> of spread even after the alterations. Is there anyone who willing to help
> me in crating custom files if I provide the relevent information. I need to
> crate wind, moisture, and fire origin files.
>
> BR,
> Vidura Dantanarayana.
>
> On Sat, Sep 1, 2018 at 7:23 PM Pedro Venâncio 
> wrote:
>
>> Hi Vidura,
>>
>> You need to prepare the input data to r.ros algorithm
>>
>> https://grass.osgeo.org/grass74/manuals/r.ros.html
>>
>> The input data needs to be in raster format.
>>
>> First you need to use the standard NFFL 13 fuel models system (
>> https://www.fs.fed.us/rm/pubs/rmrs_gtr153.pdf) as fuel model input
>> raster.
>>
>> You also need the fuel moisture content for all sizes and response times
>> (dead 1h, 10h, 100h and live), in percentage.
>>
>> As Moritz explained to you, you can see that the 1hour_moisture raster of
>> the sample data is composed by:
>>
>> - 3% moisture in areas of fuel model 4;
>> - 15% moisture in areas of fuel model 8.
>>
>> You can give homogeneous fuel moisture content for each response times,
>> or different if you have that information, like in the sample data.
>>
>> Then you need an elevation raster (DEM), calculate slope and aspect (if
>> you don't have them yet, with r.slope.aspect), and a raster with wind speed
>> (in feet/minute) and another with wind direction (clockwise from north, in
>> degrees).
>>
>> With this data, you run r.ros and with the output rasters, run r.spread
>>
>> https://grass.osgeo.org/grass74/manuals/r.spread.html
>>
>> r.spread just need the an additional raster, with the
>> ignition(s)/starting sources. Pixels of starting sources raster needs to be
>> only values of 1 (ignition points/areas) and 0 (other areas). If you have
>> the ignitions in vector format, just use v.to.rast.
>>
>> I hope this helps.
>>
>> Best regards,
>> Pedro Venâncio
>>
>>
>>
>> Vidura Dantanarayana  escreveu no dia sábado,
>> 1/09/2018 à(s) 14:12:
>>
>>> Hi all,
>>>
>>> Thank you very much Moritz Lennert for the explanation and apologize for
>>> the mistake I've done. I will try what you suggest by myself.  Hope It's
>>> okay to questioning again if I found a problem again. Have a wonderful day.
>>> Cheers!!!
>>>
>>> BR,
>>> Vidura Dantanarayana.
>>>
>>> On Sat, Sep 1, 2018 at 2:04 AM Moritz Lennert <
>>> mlenn...@club.worldonline.be> wrote:
>>>
 Hi Vidura,

 First of all, please keep discussions on the list.

 On 31/08/18 09:48, Vidura Dantanarayana wrote:
 > Hi Moritz,
 >
 > Really appreciate your help as we are facing this problem for some
 days
 > now. First I'm a beginner user. Can you explain what are the
 categories
 > and how those used in GRASS GIS?

 GRASS GIS is an extremely wonderful and powerful tool, but it does need
 some initial learning in order to understand how to use it. Just
 answering the questions below will not provide that for you.

 I would suggest that you go through some of the basic introductory
 material, just in order to get a feeling for GRASS GIS, before
 attacking
 your specific problem.

 You could have a look at the following resources (at least for their
 introductory parts):

 - https://grass.osgeo.org/grass74/manuals/helptext.html
 - https://grass.osgeo.org/grass74/manuals/rasterintro.html
 - https://grass.osgeo.org/grass74/manuals/vectorintro.html
 -

 https://grasswiki.osgeo.org/wiki/From_GRASS_GIS_novice_to_power_user_(workshop_at_FOSS4G_Boston_2017)
 -

 http://www.training.gismentors.eu/isprs-summer-school-2016/lesson1/grass-gis.html

 Or search for "GRASS GIS" in YouTube for some videos.

 > Let's say I need to create custom
 > 1hour_moisture (or any other file), so how can I create these files?

 How you create these files depends on the data that you have as input.

 If you look at the metadata of the file in the demolocation
 (right-click->Metadata or 'r.info 1hour_moisture' you will this
 information at the end:

 |   Data Description:
  |
 |generated by r.mapcalc
  |
 |
  |
 |   Comments:
  |
 |if(fuel_class==4,3

Re: [GRASS-user] [GRASS-dev] experimental Python 3 support in trunk

2018-09-03 Thread Moritz Lennert
Le Mon, 3 Sep 2018 08:27:53 +0200,
Markus Neteler  a écrit :

> On Mon, Sep 3, 2018 at 4:21 AM Anna Petrášová 
> wrote:
> >
> > Hi,
> >
> > I committed the experimental support of Python 3 to trunk (grass77)
> > by Sanjeet (GSoC 2018).  
> 
> This is excellent, thanks for much for your hard work, Sanjeet, Anna
> and all involved!

+1

This is a great step forward. Many thanks !

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