[GRASS-user] r.shade python issues

Anna Petrášová kratochanna at gmail.com
Wed May 25 05:42:19 PDT 2016


On Wed, May 25, 2016 at 5:36 AM, Gareth Grewcock
<garethgrewcock at gmail.com> wrote:
> Hi Vaclav - I agree, the GRASS GIS functionality itself is brilliant and is
> just what I need and the issue does lie with Python.
>
> That said, it is a bit strange with what is going on, using the module
> object works for other modules apart from r.shade, I seem to get an XML
> parsing error: xml.etree.ElementTree.ParseError: no element found: line 1,
> column 0
>
> Can anybody advise what the correct syntax should be for using r.shade with
> pygrass please?
>
> I can't even seem to be able to initialize the r.shade module as per the
> wiki but I can others.
>
> This works:
>
> slope_aspect = Module('r.slope.aspect')

this module is written in C
>
> This doesn't:
>
> shade = Module('r.shade')

and this in Python. Also in the error you posted, the ArcGIS Python is
used instead of the one bundled with OSGeo4W, so there seems to be
some Python mixup going on, but I don't why or how to fix it...

Anna

>
> Thanks,
> Gareth
>
>
> On Tue, May 24, 2016 at 10:29 PM, Vaclav Petras <wenzeslaus at gmail.com>
> wrote:
>>
>>
>> On Tue, May 24, 2016 at 1:11 PM, Laurent C. <lrntct at gmail.com> wrote:
>>>
>>> 2016-05-24 4:36 GMT-05:00 Gareth Grewcock <garethgrewcock at gmail.com>:
>>> > Again - thanks for all the help so far, it is much appreciated.
>>> >
>>> > Laurent - I ran the read2_command and it returned the following:
>>> >
>>> > output='shaded_raster_hillshade_map', brighten='25', overwrite=True)
>>> > AttributeError: 'module' object has no attribute 'read2_command'
>>>
>>> You have to define the function yourself with the code from the wiki,
>>> it is not part of the GRASS scripting library.
>>
>>
>> Hi all,
>>
>> let me enter the conversation here.
>>
>> Gareth, using custom function might be quite an overkill here, the
>> original problem was wrong Python syntax (unrelated to any GRASS GIS
>> functionality).
>>
>> Laurent, if you think you must consistently use some custom function, then
>> you should consider opening a enhancement ticket and ideally provide a patch
>> as well. What you are using might be useful for others.
>>
>> Best,
>> Vaclav
>
>
>
> _______________________________________________
> grass-user mailing list
> grass-user at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-user


More information about the grass-user mailing list