[SciPy-dev] masked_array drops fill_value

Tim Leslie tim.leslie at gmail.com
Sat Mar 25 04:51:59 CST 2006


Hi all,

In ma.py the masked_array function the fill_value of the array passed in is
not used. The code currently looks like this:

def masked_array (a, mask=nomask, fill_value=None):
    """masked_array(a, mask=nomask) =
       array(a, mask=mask, copy=0, fill_value=fill_value)
    """
    return array(a, mask=mask, copy=0, fill_value=fill_value)


It seems to me that using the fill_value from a (if it is a MaskedArray)
would be the sane thing to do? Something like

if fill_value == None and isinstance(a, MaskedArray):
    fill_value = a.fill_value()
return array(a, mask=mask, copy=0, fill_value=fill_value)

As it stands, all the ma functions such as transpose, reshape, etc lose the
fill_value which seems wrong to me.

Tim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/scipy-dev/attachments/20060325/650df33b/attachment.html 


More information about the Scipy-dev mailing list