I want to create a 1d masked array from a list of one-element (0d) masked arrays using numpy.ma
. This works as expected if the values are not masked, it does not in the other case:
import numpy.ma as ma
ma.MaskedArray([ma.masked_array(data=-99, mask=False), ma.masked_array(data=-99, mask=False)])
ma.MaskedArray([ma.masked_array(data=-99, mask=True), ma.masked_array(data=-99, mask=True)])
The second commands produces
numpy.ma.core.MaskError: Cannot convert masked element to a Python int.
Is there a reason for this behaviour? Do I need to manually extract the data and the masks?