I have generated a numpy array from an existing raster in ArcGIS using RasterToNumPyArray
, but when it is imported the array shape is (bands,rows,columns) and I need to convert to (rows,columns,bands). However, I can't quite figure out how to do it.
Here is an example, with a toy raster with 5 bands and 10x10 cells:
old = np.arange(500).reshape(5,10,10)
new = old.reshape((10,10,5))
band1 would have values from 0:99 (old[0,:,:]. However, new[:,:,0] is not the same. I just can't quite figure it out.