Skip to content

Instantly share code, notes, and snippets.

@Majramos
Last active December 24, 2024 20:52
Show Gist options
  • Save Majramos/5e8985adc467b80cccb0cc22d140634e to your computer and use it in GitHub Desktop.
Save Majramos/5e8985adc467b80cccb0cc22d140634e to your computer and use it in GitHub Desktop.
Simple inverse distance weighted (IDW) interpolation with python
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@arashmad
Copy link

arashmad commented Jul 15, 2022

Thanks for sharing this code.

I think in terms of visualizing the grid, it works better, at least for points projected in the UTM prj:

plt.imshow(
    grid,
    extent=(x.min(), x.max(), y.min(), y.max()),
    cmap='rainbow',
    interpolation='gaussian',
    origin="lower")

@AY131313
Copy link

can I pease ask that how I can import data from a real dataset set file foe example excel forman?

@TuhinaN
Copy link

TuhinaN commented Jul 6, 2023

can i know that how to save this output Raster format?

@Majramos
Copy link
Author

@TuhinaN can you specify what you mean/what?

to convert the graphics to raster and save it to pdf:
https://www.tutorialspoint.com/how-to-save-figures-to-pdf-as-raster-images-in-matplotlib

@tawhidhossain13
Copy link

@Majramos how can measure the accuracy of the different power values that I am using (like 1 or 2 or 5), also, is it possible to run the power values in a loop, like one out put for power 1, one for 2 and so on... and then try to understand which power parameters provide best interpolation.

@Enrra44
Copy link

Enrra44 commented Nov 10, 2023

Thank you for the code ! I am not really sure of this but I think that if you want to change the norm you can't use the hypothenus anymore.
distance = (np.abs(d0)**p + np.abs(d1)**p)**(1/p)
would be for the Lp-norm in general

@cody-elhard
Copy link

Now to try and figure out how to avoid memory issues on 1000x1000 image :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment