iterate through paired values in dictionary

Discussion created by khan18 on Nov 17, 2012
Latest reply on Nov 21, 2012 by khan18
I have converted grid1 and grid2 into arrays using numpy and using following function which iterates through table and should return corresponding value form table when grid1 and grid2 values are matched. But somehow the final output contain only 4 integer values which isn't correct. Any suggestion what is possibly wrong here?

def grid(grid1,grid2):
    table = {(10,1):61,(10,2):75,(10,3):83,(10,4):87,
    grid3 = np.zeros(grid1.shape, dtype =

    for k,v in table.iteritems():
        grid3[[grid1 == k[0]] and [grid2 == k[1]]] = v

    return grid3