Hi,
I'm trying to run the i.zc module in parallel on several tiles. I use this syntax
if options['tile_width']:
parallel = True
width = int(options['tile_width'])
height = int(options['tile_height'])
overlap = int(options['overlap'])
processes = int(options['processes'])
kwargs = {'input' : inputraster,
'output' : temp_edge_map,
'width' : int(options['zc_width']),
'threshold' : float(options['zc_threshold']),
'quiet' : True}
if parallel:
grd = GridModule('i.zc',
width=width,
height=height,
overlap=overlap,
processes=processes,
split=False,
**kwargs)
However, this fails (understandably) with
TypeError: type object got multiple values for keyword argument 'width'
Is there a way to work around this name conflict ? Do I have to define my own class derived from GridModule to change the parameter names ?
Moritz
No one for an answer to this one ?
On 06/03/18 14:59, Moritz Lennert wrote:
Hi,
I'm trying to run the i.zc module in parallel on several tiles. I use
this syntax
if options['tile_width']:
parallel = True
width = int(options['tile_width'])
height = int(options['tile_height'])
overlap = int(options['overlap'])
processes = int(options['processes'])
kwargs = {'input' : inputraster,
'output' : temp_edge_map,
'width' : int(options['zc_width']),
'threshold' : float(options['zc_threshold']),
'quiet' : True}
if parallel:
grd = GridModule('i.zc',
width=width,
height=height,
overlap=overlap,
processes=processes,
split=False,
**kwargs)
However, this fails (understandably) with
TypeError: type object got multiple values for keyword argument 'width'
Is there a way to work around this name conflict ? Do I have to define
my own class derived from GridModule to change the parameter names ?
Moritz
_______________________________________________
grass-dev mailing list
grass-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-dev
On Tue, Mar 6, 2018 at 8:59 AM, Moritz Lennert <mlennert@club.worldonline.be
wrote:
Hi,
I'm trying to run the i.zc module in parallel on several tiles. I use this
syntax
if options['tile_width']:
parallel = True
width = int(options['tile_width'])
height = int(options['tile_height'])
overlap = int(options['overlap'])
processes = int(options['processes'])
kwargs = {'input' : inputraster,
'output' : temp_edge_map,
'width' : int(options['zc_width']),
'threshold' : float(options['zc_threshold']),
'quiet' : True}
if parallel:
grd = GridModule('i.zc',
width=width,
height=height,
overlap=overlap,
processes=processes,
split=False,
**kwargs)
However, this fails (understandably) with
TypeError: type object got multiple values for keyword argument 'width'
Is there a way to work around this name conflict ? Do I have to define my
own class derived from GridModule to change the parameter names ?
Try `width_` instead of `width` for the module parameter. This is how
grass.script works (mostly to avoid conflicts with Python keywords namely
lambda), but without checking the code, I don't know if PyGRASS has this
implemented.
Vaclav
On 08/03/18 15:18, Vaclav Petras wrote:
On Tue, Mar 6, 2018 at 8:59 AM, Moritz Lennert <mlennert@club.worldonline.be <mailto:mlennert@club.worldonline.be>> wrote:
Hi,
I'm trying to run the i.zc module in parallel on several tiles. I
use this syntax
if options['tile_width']:
parallel = True
width = int(options['tile_width'])
height = int(options['tile_height'])
overlap = int(options['overlap'])
processes = int(options['processes'])
kwargs = {'input' : inputraster,
'output' : temp_edge_map,
'width' : int(options['zc_width']),
'threshold' : float(options['zc_threshold']),
'quiet' : True}
if parallel:
grd = GridModule('i.zc',
width=width,
height=height,
overlap=overlap,
processes=processes,
split=False,
**kwargs)
However, this fails (understandably) with
TypeError: type object got multiple values for keyword argument 'width'
Is there a way to work around this name conflict ? Do I have to
define my own class derived from GridModule to change the parameter
names ?
Try `width_` instead of `width` for the module parameter. This is how grass.script works (mostly to avoid conflicts with Python keywords namely lambda), but without checking the code, I don't know if PyGRASS has this implemented.
It doesn't. I tried width_ for both the i.zc parameter and the GridModule parameter. Neither were accepted as valid parameters.
Moritz
Hi Pietro and greetings from the Bonn code sprint !
Le Fri, 16 Mar 2018 08:26:11 +0100,
Pietro <peter.zamb@gmail.com> a écrit :
Dear Moritz,
On Thu, Mar 8, 2018 at 3:22 PM, Moritz Lennert
<mlennert@club.worldonline.be
> wrote:
> On 08/03/18 15:18, Vaclav Petras wrote:
>
> Try `width_` instead of `width` for the module parameter. This is
> how
>> grass.script works (mostly to avoid conflicts with Python keywords
>> namely lambda), but without checking the code, I don't know if
>> PyGRASS has this implemented.
>>
>
> It doesn't. I tried width_ for both the i.zc parameter and the
> GridModule parameter. Neither were accepted as valid parameters.
I've modifiredt the Module class to support this in r72367 [0].
Let me know if fixed your problem,
[0] https://trac.osgeo.org/grass/changeset/72367
Yes, this fixes my problem. Thanks a lot !
Moritz
Le Sun, 18 Mar 2018 21:19:11 +0100,
Moritz Lennert <mlennert@club.worldonline.be> a écrit :
Hi Pietro and greetings from the Bonn code sprint !
Le Fri, 16 Mar 2018 08:26:11 +0100,
Pietro <peter.zamb@gmail.com> a écrit :
> Dear Moritz,
>
> On Thu, Mar 8, 2018 at 3:22 PM, Moritz Lennert
> <mlennert@club.worldonline.be
> > wrote:
>
> > On 08/03/18 15:18, Vaclav Petras wrote:
> >
> > Try `width_` instead of `width` for the module parameter. This is
> > how
> >> grass.script works (mostly to avoid conflicts with Python
> >> keywords namely lambda), but without checking the code, I don't
> >> know if PyGRASS has this implemented.
> >>
> >
> > It doesn't. I tried width_ for both the i.zc parameter and the
> > GridModule parameter. Neither were accepted as valid
> > parameters.
>
>
> I've modifiredt the Module class to support this in r72367 [0].
>
> Let me know if fixed your problem,
>
>
> [0] https://trac.osgeo.org/grass/changeset/72367
Yes, this fixes my problem. Thanks a lot !
Maybe a candidate for backport to 7.4 ?
Moritz
On Sun, Mar 18, 2018 at 9:24 PM, Moritz Lennert
<mlennert@club.worldonline.be> wrote:
Le Sun, 18 Mar 2018 21:19:11 +0100,
Moritz Lennert <mlennert@club.worldonline.be> a écrit :
Hi Pietro and greetings from the Bonn code sprint !
Le Fri, 16 Mar 2018 08:26:11 +0100,
Pietro <peter.zamb@gmail.com> a écrit :
> Dear Moritz,
>
> On Thu, Mar 8, 2018 at 3:22 PM, Moritz Lennert
> <mlennert@club.worldonline.be
> > wrote:
>
> > On 08/03/18 15:18, Vaclav Petras wrote:
> >
> > Try `width_` instead of `width` for the module parameter. This is
> > how
> >> grass.script works (mostly to avoid conflicts with Python
> >> keywords namely lambda), but without checking the code, I don't
> >> know if PyGRASS has this implemented.
> >>
> >
> > It doesn't. I tried width_ for both the i.zc parameter and the
> > GridModule parameter. Neither were accepted as valid
> > parameters.
>
>
> I've modifiredt the Module class to support this in r72367 [0].
>
> Let me know if fixed your problem,
>
>
> [0] https://trac.osgeo.org/grass/changeset/72367
Yes, this fixes my problem. Thanks a lot !
Maybe a candidate for backport to 7.4 ?
For the (list) record, it has been done recently.
Markus