I have an array of topography data (n x m) which is rectangular but inscribed in an array of zeros (a x b) . I want to remove the zeros and shift the array is a rectangle.
image of array where the white is the data I want and the black are extra zeros.
How do I shift the data over and get rid of not only the zeros but also the extra indices (thus it will be all data no zeros of shape nxm )?
Just removing the zeros does not help since they just become extra indices. I thought about shifting it by moving them up or down a set amount but I realized it needs to rotate around a center point which I have no idea how to do.
Any help is very appreciated ( I am familiar with both python and matlab).