I am trying to fill in holes in a healpix map made from data with sparse sampling. Using the healpy implementation of healpix, I find that I cannot use healpy.pixelfunc.get_interp_val to interpolate an image with missing data, e.g. NaN values in the vicinity. If any of the 4 neighbor pixels that are used for the interpolation are NaN, then the returned value is also NaN, so the holes are not filled with interpolates.
I have located a single change in the healpy.pixelfunc.get_interp_val routine that would solve the problem. If the last line, which is presently: return np.sum(m2[p] * w, 0) were changed as follows: return np.nansum(m2[p] * w, 0) then it would deal with NaN in the way that I was hoping. I tried pulling this individual routine out of the healpix package and running it separately, but it is integrated with other routines, in particular pixlib._get_interpol_ring, which I cannot figure out how to include in a standalone version. Advice welcome on how to do this either in a change to healpy itself, or as a standalone routine.
I think the best option is to run get_interp_weights
so that you get the indices of the nearby pixels and their proper weights to do the interpolation.
Then you can do the interpolation yourself with the algorithm you prefer.
To check your implementation, initially you can compare your results to get_interp_val
on a simple test case, then implement your changes.