In [19]: a[yy,xx] Out[19]: array([ 0, 3, 6, 9, 12, 15, 18]) In [20]: a[yy,xx] = 999 In [21]: a Out[21]: array([[999, 1, 2, 999, 4], [ 5, 999, 7, 8, 999], [ 10, 11, 999, 13, 14], [999, 16, 17, 999, 19]]) In [22]: a[yy,xx] = -a[yy,xx] In [23]: a Out[23]: array([[-999, 1, 2, -999, 4], [ 5, -999, 7, 8, -999], [ 10, 11, -999, 13, 14], [-999, 16, 17, -999, 19]]) In [34]: a[ np.where((a>2) & (a<12)) ] Out[34]: array([ 3, 4, 5, 6, 7, 8, 9, 10, 11])