Much proper way of handling NaN values when computing cloud/mehs distances