How to fill/interpolate missing data to nearest geospatial coordinate?
Mostrar comentarios más antiguos
Hello,
I am trying to interpolate some missing values (NAN) in a dataset that contains Irrigation Well Data with the following columns: Longitude, Latitude, and Pump Rate for each irrigation well. There are no missing Longitude or Latitude values but there are some missing Pump Rate Values. What I would like to do is to fill the missing pump rate values to be interpolated to the nearest Irrigation Well spatially.
I am unsure what function to use and how to do this. I have tried looking at the fillmissing, interp3, and scatterinterpolant but I am not sure what to use or how to use it (i have read through the pages for each and watched videos but am still confused).
Can someone please let me know what function to use and how to use it?
Thank you!!!
Respuesta aceptada
Más respuestas (1)
KSSV
el 8 de Feb. de 2024
% Prepare dummy data
[X,Y] = meshgrid(1:10,1:10) ;
Z = rand(size(X)) ;
% Make random nan's
idx = sort(randsample(numel(X),20)) ;
Z(idx) = NaN ;
% Fill the nans
% interpolation
F = scatteredInterpolant(X(~isnan(Z)),Y(~isnan(Z)),Z(~isnan(Z))) ;
Z(idx) = F(X(idx),Y(idx)) ;
Categorías
Más información sobre Interpolation of 2-D Selections in 3-D Grids en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!