I am trying to use scipy.ndimage.zoom on an array that contains a significant amount of NaN values, and wanted to try to use different orders to see how the results varied, but for orders higher than 1 (linear), the entire zoomed array becomes filled with NaN values.
Writing something like this:
z_test = np.array([[0, 1, 3], [1, 3, 5], [2, 4, np.nan]])
linear = ndimage.zoom(z_test, zoom = 20, order=1)
quadratic = ndimage.zoom(z_test, zoom = 20, order=2)
cubic = ndimage.zoom(z_test, zoom = 20, order=3)
Yields a result for the linear zoom, but only NaN for the other two. Is there a way to get this method to ignore the NaN values and only interpolate in-between the actual values?