I'm trying to implement something similar to what was answered in this post about regridding in python. The question in that post involved regridding an array such that an output cell would contain the average of all the input cells that contributed to it. The catch was that each input cell only (I think) contributes to one output cell - that is, there's no real way to account for the case where an input cell overlaps with two output cells.
I'm wondering if there's a way to generalize that method to account for cell overlap - if, for example, I have two input bins which span from 0 to 1 and 1 to 2 and an output cell that spans 0.75 to 2, I would want to take some sort of weighted average to calculate the value in the output cell which recognizes that the input cell that spanned 1 to 2 should contribute roughly 4x more to the output cell than the one that spanned 0 to 1.
This isn't interpolation, per se, but pretty much every method I've seen attempting to do something similar uses it. The problem with just straight up interpolating with, eg, np.interp
is that this routine just ignores some of the points if more than one input cell contributes to an output cell.