khan18

Writing multiple rasters failed

Discussion created by khan18 on Aug 14, 2011
Hi,

I am trying to loop certain set of conditions through all rasters in a workspace and then write them all at the end of process in the same loop. But it writes only one file and then stops.
I have couple of Qs:

Do python really takes care of if else statements this way in python?
What is the difference between using Numpy and approach below to compute certain values?

Please anyone can take a look at whats going wrong. Thanks. Code is below:

for k in range(0,11):
        print k
        sum1 = Con(False,"oc_lyr"+str(k+1),0)
        for l in range(0,11):
            str_fin="oc_lyr"+str(l+1)
            Sum1 = Con(t[l]<=nt[k] and b[l]>=nb[k],Times(str_fin, (nb[k]-nt[k])),\
                       Con(t[l]<=nt[k] and  b[l]>nt[k],  Plus(0, Times(str_fin,(b[l] -nt[l]))),\
                           Con(t[l]>nt[k]  and  b[l]<nb[k],  Plus(0, Times(str_fin,(b[l] - t[l]))),\
                               Con(t[l]<nb[k]  and  b[l]>=nb[k], Plus(0, Times(str_fin,(nb[k]- t[l])))))))

            Sum1.save("oc"+str(k))

Outcomes