[GRASS-dev] module input (multiple type) in pyGRASS

Yann Chemin ychemin at gmail.com
Fri Jun 21 03:43:04 PDT 2013


Hi Pietro,
here is the summary of what I want to do...

OVR=True
pref='LE71340442011084PFS00_B'

b1=pref[:-2]+".surf.1"
b2=pref[:-2]+".surf.2"
b3=pref[:-2]+".surf.3"
b4=pref[:-2]+".surf.4"
b5=pref[:-2]+".surf.5"
b7=pref[:-2]+".surf.7"

b_in=[b1,b2,b3,b4,b5,b7]
b_albedo=pref[:-2]+".surf.albedo"
print "Albedo:\t",b_albedo
i.albedo(input=b_in, output=b_albedo, flags="lc", overwrite=OVR)
r.colors(map=b_albedo,color='grey')


Ciao,
Yann




On 21 June 2013 15:40, Pietro Zambelli <peter.zamb at gmail.com> wrote:
> Hi Yann,
>
>
> On Friday 21 Jun 2013 10:48:14 Yann Chemin wrote:
>> Hi,
>>
>> I am having trouble with multiple input in pyGRASS:
>>
>> Example:
>> -------------
>> b_in=[b1,b2,b3,b4,b5,b7]
>> i.albedo(input=b_in, output=b_albedo, flags="lc", overwrite=OVR)
>>
>> input has a multiple raster band names requirement (6 here),
>> using a list to define b_in does not work.
>>
>> What kind of container should I use?
>
>
> you should use a list as you do...
>
> I don't have your map so I'm not able to reproduce the problem on my
> machine...
>
> I've try with:
> {{{
> from grass.pygrass.modules.shortcuts import imagery as i
>
> alb = i.albedo
> alb(input=['b1', 'b2', 'b3', 'b4', 'b5', 'b7'],
>     output='b_albedo', flags="lc", overwrite=True, run_=False)
> alb.get_bash()
> }}}
>
> and return 'i.albedo input=b1,b2,b3,b4,b5,b7 output=b_albedo -l -c --o'
> that it seems correct to me...
>
> Can you provide some more details about "b_in does not work"? :-)
> What kind of error do you have?
>
> Best regards
>
> Pietro
>
> ps: thank you for testing!



--
----


More information about the grass-dev mailing list