I thought most/all of the numpy ufuncs would consider if masked-arrays are used but for the np.median (and np.average) this is not the case:
import numpy as np
normal_array = np.arange(10)
masked_array = np.ma.array(normal_array, mask=normal_array>7)
np.median(normal_array) # Returns 4.5
np.median(masked_array) # Returns 4.5
np.ma.median(masked_array)[0] # Returns 3.5 (it returns a masked array instead of a scalar btw)
whereas for sums it works as one would expect:
np.sum(normal_array) # Returns 45
np.sum(masked_array) # Returns 28
mean/std/var all work like sum, why the exception for median/average?