I was able to do this by the following functions
def fill_mismatch(ds_grid_spec, ds_data):
ds_data_o = ds_data.copy()
count = 0.0
for i in range(ds_grid_spec.shape):
for j in range(ds_grid_spec.shape):
if ds_grid_spec[i,j].values > 0.0 and (not ds_data[i,j] > 0.0):
count = count + 1.0
If I were you, I would exclude the NaN values and then perform gridding on the resulting irregularly spaced data.
There are already the tools to perform this in Python and using the library SciPy
But please document exactly what step you are doing and why. ...