[Numpy-discussion] Another masked array question

Gökhan Sever gokhansever at gmail.com
Sat May 8 20:52:09 EDT 2010


Hello,

Consider my masked arrays:

I[28]: type basic.data['Air_Temp']
-----> type(basic.data['Air_Temp'])
O[28]: numpy.ma.core.MaskedArray

I[29]: basic.data['Air_Temp']
O[29]:
masked_array(data = [-- -- -- ..., -- -- --],
             mask = [ True  True  True ...,  True  True  True],
       fill_value = 999999.9999)


I[17]: basic.data['Air_Temp'].data = np.ones(len(basic.data['Air_Temp']))*30
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)

----> 1
      2
      3
      4
      5

AttributeError: can't set attribute

Why this assignment fails? I want to set each element in the original
basic.data['Air_Temp'].data to another value. (Because the main instrument
was forgotten to turn on for that day, and I am using a secondary
measurement data for Air Temperature for my another calculation. However it
fails. Although single assignment works:

I[13]: basic.data['Air_Temp'].data[0] = 30

Shouldn't this be working like the regular NumPy arrays do?

Thanks.

-- 
Gökhan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20100508/033bc9c8/attachment.html>


More information about the NumPy-Discussion mailing list