cols = 2
data = numpy.array([[[253, 0], [128, 0], [128, 0]], [[254, 0], [129, 144],
    [129, 0]], [[255, 0], [130, 243], [130, 5]], [[127, 0], [255, 120], [
    255, 5]]])
new_data = numpy.zeros((rows, cols), numpy.float32)
for i in range(0, rows):
    for j in range(0, cols):
        new_data[i, j] = codeTable.get(tuple(data[:, (i), (j)]), -9999)

def create_output(data):
    reshaped_data = data.reshape((4, -1))
Improving performance of numpy mapping operation