This response is not necessarily about Resampling, however, it is more of a rant about the Sample tool.
Man, I struggled with this one for a while. I rewrote the Spatial Analyst Sample using numpy/gdal.
it was painful cause I was so confused on how arcpy actually interpolates. a few things I found out.
- arcpy Sample does not actually do bilinear interpolation.
- arcpy sample BILINEAR is actually average 4 - which takes the average of the closest centers, including the source.
I was very upset cause I had written my own bilinear interpolation based on the actual function, and it kept giving me a different number than ArcGIS. I was sure I had written it correctly. I tried many things, ultimately I used another software called FME (to see if my python was correct) to do a point on raster and they had several options for interpolation.
- nearest = arcpy nearest
- bilinear != arcpy bilinear
- average4 == arcpy bilinear
Lone behold, I found out that arcpy bilinear is not actually a true bilinear rather just an average four including the source cell.
here is what arcpy does with bilinear in the following situations
- a point within the raster
2. Top left of the raster
3. Top right of the raster
my conclusion is the bilinear in arcpy is not a true bilinear rather an average 4. however what it does do is it takes the three cells as seen in my illustrations.