[GRASS-dev] GRASS Scripts access to channel headers info
António Rocha
antonio.rocha at deimos.com.pt
Wed Feb 10 11:03:31 EST 2010
Hey All
Both suggestions worked. Thanks
By the way, I'm having some difficulties in using mapcalc in a python
scripts.
I'm doing this
grass.mapcalc(options['output']=options['raster1']+options['raster2'])
And I get:
File "/usr/local/grass-6.4.0svn/scripts/python.teste",
line 61
grass.mapcalc(options['output']=options['raster1']+options['raster2'])
SyntaxError: keyword can't be an expression
How can I use an option as an input in mapcalc funtion, called from a
Python script?
Thanks
Antonio
Glynn Clements wrote:
> Massimo Di Stefano wrote:
>
>
>> Hi, maybe the grass-python bindings can help you ?
>>
>> from grass, starting python :
>>
>> In [1]: import grass.script as grass
>>
>> In [2]: dict_region_info = dict(x.split('=', 1) for x in
>> grass.read_command('r.info', flags = 'rstgudmp', map =
>> 'elevation.10m').strip().replace('"','').replace('(','').replace(')','').split('\n')
>> if '=' in x)
>>
>
> raster_info() already does this; it also converts the bounds and range
> to numbers:
>
>
>> grass.raster_info('elevation.dem')
>>
> {'north': 4928000.0,
> 'timestamp': '"none"',
> 'min': 1066.0,
> 'datatype': 'CELL',
> 'max': 1840.0,
> 'ewres': 30.0,
> 'vertical_datum': '(none)',
> 'west': 590010.0,
> 'units': '(none)',
> 'title': 'DEM (7.5 minute) (elevation)',
> 'east': 609000.0,
> 'nsres': 30.0,
> 'south': 4914020.0}
>
>
__________ Information from ESET NOD32 Antivirus, version of virus signature database 4854 (20100210) __________
The message was checked by ESET NOD32 Antivirus.
http://www.eset.com
More information about the grass-dev
mailing list