I would like to do element wise addition over matrices while skipping NaN values.
MATLAB and Octave have nansum, but it does column wise addition within a matrix.
Let:
a = NaN * zeros(3)
b = ones(3)
I want:
c = nan+(a, b)
and
c = b
and:
d = nan+(a,a)
and
d = a
You can still use nansum, if you catenate your n-d arrays along the n+1st dimension.
For 2D
The general case