At first I didn't use broadcast_arrays() because it strip off the mask of masked arrays. But I think it should be preferred to be consistent with rest of APIs. Used a alternative way to handle the masked array so that broadcast can be used too.