I am trying to write a subclass of a masked_array . What I still know:
class gridded_array(ma.core.masked_array): def __init__(self, data, dimensions, mask=False, dtype=None, copy=False, subok=True, ndmin=0, fill_value=None, keep_mask=True, hard_mask=None, shrink=True): ma.core.masked_array.__init__(data, mask, dtype, copy, subok, ndmin, fill_value, keep_mask, hard_mask, shrink) self.dimensions = dimensions
However, when I create gridded_array , I do not get the expected:
dims = OrderedDict() dims['x'] = np.arange(4) gridded_array(np.random.randn(4), dims) masked_array(data = [-- -- -- --], mask = [ True True True True], fill_value = 1e+20)
I would expect an unscaled array. I have a suspicion that the dimensions argument I pass in is passed by calling masked_array.__init__ , but since I'm pretty new to OOP, I don't know how to resolve this.
Any help is greatly appreciated.
PS: I'm on Python 2.7