Reshape numpy array to contain logical blocks of values from original array
stackoverflow.com