Sounds like you should be storing your data in a masked array instead of this hacky method with 99999 no-data value. Start looking in np.ma
.
Simple example:
>>> a = np.array([1, 2, 99999, 3])
>>> a.mean()
25001.25
>>> a_ = np.ma.masked_array(a, a == 99999)
>>> a_.mean()
2.0
>>> a_
masked_array(data = [1 2 -- 3],
mask = [False False True False],
fill_value = 999999)