I have some ship track based data missing one of the variables (Var1) that I want to extract from a gridded database (1 x 1 degree).
At one location of my ship track, there will be 4 grid points (Left up, left down, right up and right down). Sometimes, 1 to 3 of them can be NaNs when they are close to land near the coastline. Is there a way I can quickly find the order of the distance between my data point and these 4 points? That way, I can use the one with the shortest distance that is non-NaN.
Many thanks!