[GRASS-user] Re: Trying python scripts.

Marcello Gorini gorini at gmail.com
Fri May 28 10:34:39 EDT 2010



Carlos Grohmann-2 wrote:
> 
> Hello Marcello.
> 
> It's good to _finally_ see you here :)
> 
> I tried your script and it worked for me, but I had to change the last
> line from
> 
> sys.exit(main())
> 
> to:
> 
> main()
> 
> 
> could you try that?
> 
> best
> 
> Carlos
> 
> 
> 
> On Fri, May 28, 2010 at 08:23, Marcello Gorini <gorini at gmail.com> wrote:
>>
>>
>> Nikos Alexandris wrote:
>>>
>>> Marcello Gorini wrote:
>>>> Thanks for the try. I tested it again with other rasters, but I got the
>>>> same error. Could it possibly be something related to the 64bits
>>>> architecture?
>>>
>>> I don't think so. I work with Kubuntu Lucid 64 bit :-)
>>>
>>>> Or could GRASS be sending the outcome somewhere else?
>>>
>>> Negative. You are running the script from within a grass-session (as you
>>> wrote
>>> in the first post). Let's try to take this step by step. What is the
>>> result of
>>> each of the following commands:
>>>
>>> ls -l myscript.py
>>> g.gisenv
>>> g.region -p
>>> r.info map1
>>> r.info map2
>>>
>>>> Well, I guess that eventually I will go around this problem or even
>>>> bump
>>>> into the solution, but the most important thing to say is that I
>>>> appreciated the effort and that it was a very good reception to this
>>>> list.
>>>
>>> Bah... it was only me trying to not forget the basics with python
>>> scripts.
>>> You will get better and more precise replies from other advanced users
>>> and
>>> developers.
>>>
>>>> Thank you very much Nikos. And thank you also for the explanations with
>>>> respect to the right way to answer posts. I will do my best to make my
>>>> posts as clean and explanatory as possible.
>>>
>>> You are warned, you might get yourself into trouble ;-p
>>> Cheers, Nikos
>>> _______________________________________________
>>> grass-user mailing list
>>> grass-user at lists.osgeo.org
>>> http://lists.osgeo.org/mailman/listinfo/grass-user
>>>
>>>
>>
>> OK, thank you, so let's go step by step:
>> ls -l myscript.py
>> result:
>> -rwxr-xr-x 1 marcello marcello 1227 2010-05-28 08:13 myscript.py
>>
>> g.gisenv
>> result:
>> GISDBASE=/home/marcello/grassdata
>> LOCATION_NAME=Ocean_floor
>> MAPSET=level4
>> MONITOR=x0
>> GRASS_GUI=tcltk
>>
>> g.region -p
>> result:
>> projection: 99 (Mercator)
>> zone:       0
>> datum:      wgs84
>> ellipsoid:  wgs84
>> north:      3947900
>> south:      3633400
>> west:       -7366700
>> east:       -7022600
>> nsres:      3700
>> ewres:      3700
>> rows:       85
>> cols:       93
>> cells:      7905
>>
>> r.info map1
>> result:
>> +----------------------------------------------------------------------------+
>>  | Layer:    map1                           Date: Thu May 27 18:48:30
>> 2010
>> |
>>  | Mapset:   level4                         Login of Creator: marcello
>> |
>>  | Location: Ocean_floor
>> |
>>  | DataBase: /home/marcello/grassdata
>> |
>>  | Title:     ( topmod )
>> |
>>  | Timestamp: none
>> |
>>
>> |----------------------------------------------------------------------------|
>>  |
>> |
>>  |   Type of Map:  raster               Number of Categories: 255
>> |
>>  |   Data Type:    FCELL
>> |
>>  |   Rows:         1177
>> |
>>  |   Columns:      1388
>> |
>>  |   Total Cells:  1633676
>> |
>>  |        Projection: Mercator
>> |
>>  |            N:    6358450    S:    2003550   Res:  3700
>> |
>>  |            E:   -3920150    W:   -9055750   Res:  3700
>> |
>>  |   Range of data:    min = 0.000000  max = 10000.000000
>> |
>>  |
>> |
>>  |   Data Description:
>> |
>>  |    generated by r.mapcalc
>> |
>>  |
>> |
>>  |   Comments:
>> |
>>  |    if(topmod > 0, 0, -topmod)
>> |
>>  |
>> |
>>
>> +----------------------------------------------------------------------------+
>>
>> r.info map2
>> result:
>> +----------------------------------------------------------------------------+
>>  | Layer:    map2                           Date: Thu May 27 18:49:29
>> 2010
>> |
>>  | Mapset:   level4                         Login of Creator: marcello
>> |
>>  | Location: Ocean_floor
>> |
>>  | DataBase: /home/marcello/grassdata
>> |
>>  | Title:     ( topmod2 )
>> |
>>  | Timestamp: none
>> |
>>
>> |----------------------------------------------------------------------------|
>>  |
>> |
>>  |   Type of Map:  raster               Number of Categories: 255
>> |
>>  |   Data Type:    FCELL
>> |
>>  |   Rows:         1177
>> |
>>  |   Columns:      1388
>> |
>>  |   Total Cells:  1633676
>> |
>>  |        Projection: Mercator
>> |
>>  |            N:    6358450    S:    2003550   Res:  3700
>> |
>>  |            E:   -3920150    W:   -9055750   Res:  3700
>> |
>>  |   Range of data:    min = 1000.000000  max = 1000.000000
>> |
>>  |
>> |
>>  |   Data Description:
>> |
>>  |    generated by r.mapcalc
>> |
>>  |
>> |
>>  |   Comments:
>> |
>>  |    if(topmod > -2, 1000, topmod)
>> |
>>  |
>> |
>>
>> +----------------------------------------------------------------------------+
>>
>> Now just to emphasize :)
>> Result of "r.info outmap":
>> ERROR: Raster map <outmap> not found
>>
>> Can you make anything out of it?
>>
>> Best regards,
>> Marcello.
>> --
>> View this message in context:
>> http://osgeo-org.1803224.n2.nabble.com/Trying-python-scripts-tp5109105p5112658.html
>> Sent from the Grass - Users mailing list archive at Nabble.com.
>> _______________________________________________
>> grass-user mailing list
>> grass-user at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/grass-user
>>
> 
> 
> 
> -- 
> Prof. Carlos Henrique Grohmann - Geologist D.Sc.
> Institute of Geosciences - Univ. of São Paulo, Brazil
> http://www.igc.usp.br/pessoais/guano
> http://lattes.cnpq.br/5846052449613692
> Linux User #89721
> ________________
> Can’t stop the signal.
> _______________________________________________
> grass-user mailing list
> grass-user at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-user
> 
> 


Hey Carlos, how are you my friend?

I used to understand only 10% of the posts, but I raised it to 20%, so I
took the courage to come in :)

Thanks for the hint, but I tried it and it still doesn't work. That is a
very weird problem!

Cheers,

Marcello.
-- 
View this message in context: http://osgeo-org.1803224.n2.nabble.com/Trying-python-scripts-tp5109105p5113324.html
Sent from the Grass - Users mailing list archive at Nabble.com.


More information about the grass-user mailing list