Skip to main content

Hi, I use the LinearInterpolation from eolearn.features (and other techniques provided) in a t x m x n x b dataset. I play with the interpolate_pixel_wise boolean parameter. I expected that setting it to True would implement a pixel-wise temporal interpolation on the NaN values, while setting it to False would implement an image-wise spatial interpolation on the NaN values. However, the outcome of both settings seems pretty much the same and I’m almost sure it is a pixel-wise temporal interpolation. I think that I misunderstand the documentation of that.


My questions are:


  1. Can someone explain the difference between the two settings?

  2. Is there an already implemented way to apply an image-wise spatial interpolation?

  3. Is there an already implemented way to apply a spatiotemporal interpolation?

Thank you.


Best Regards,

Kostas

Hi @kvlachos.geo,


Parameter interpolate_pixel_wise actually originates from a technical problem that Python doesn’t have the best support to implement an interpolation on a large number of pixel time series that would work fast.



  • If interpolate_pixel_wise is set to True this will use a Python for loop to iterate over spatial dimensions and interpolate values for each pixel over the temporal dimension. Because of that the process will be very slow.




  • If interpolate_pixel_wise is set to False then we use a trick that we stack pixel time series one after another in a 1D array and interpolate all of them at once. This runs much faster but there is a very small side effect that each pair of neighboring time series have on each other.



It turns out that for LinearInterpolation task we don’t have to do that. Instead we can loop over pixel time series as if interpolate_pixel_wise=True and use numba to speed up the computation. That gives us the best result and the fastest time performance. Unfortunately, the same is not possible for other types of interpolations.


So to sum up:


  • For LinearInterpolation parameter interpolate_pixel_wise has no effect whatsoever.

  • For most of the other interpolation tasks interpolate_pixel_wise can be used to choose between computation performance and accuracy of results.


@maleksandrov

Hi Matej, thank you so much for you detailed explanation.


So, any interpolation approach implemented in eolearn is a per-pixel temporal interpolation, so to say. Is that right? Which means that there are no spatial (per-image) or spatiotemporal interpolation approaches implemented.


Thanks in advance,

Kostas


@maleksandrov Hi there, I second Kostas’ question: Are there any spatial interpolation built-in methods right now?


Reply