Hi Michelle
You can use "scatteredInterpolant" function for interpolate missing pump rate values.
The "scatteredInterpolant" function works with unstructured data in N dimensions (in your case, 2 dimensions for the spatial coordinates) and can interpolate values at query points based on the values at the known points.
You can refer to the below steps:
- Separate your known and unknown pump rate data. Let's say you have a matrix wellData with columns for Longitude, Latitude, and Pump Rate.
knownData = wellData(~isnan(wellData(:,3)), :);
unknownData = wellData(isnan(wellData(:,3)), :);
- Use the known data to create the interpolant function.
F = scatteredInterpolant(knownData(:,1), knownData(:,2), knownData(:,3), 'nearest');
- Use the interpolant to estimate the missing pump rate values.
interpolatedPumpRates = F(unknownData(:,1), unknownData(:,2));
- Replace the NaN values in the original data with the interpolated values.
wellData(isnan(wellData(:,3)), 3) = interpolatedPumpRates;
When opting for the "nearest" method, you assign the unknown pump rate the value of the closest known pump rate geographically. If you desire a different interpolation approach, such as considering a weighted average of nearby points, you can choose "linear" or "natural" instead of 'nearest' when generating the scatteredInterpolant.
Hope this helps!