# [SciPy-user] amax, amin, mean

Lionel Roubeyrie lroubeyrie at limair.asso.fr
Wed Mar 29 00:46:09 CST 2006

Sorry but I don't understand how to do, replacing nan by an number gives
others errors:

######################################################
lionel[~]17>tv=[1,2,3,4,5,1.e-20,6]

lionel[~]19>amax(tv)
---------------------------------------------------------------------------
MA.MA.MAError                                   Traceback (most recent call
last)

/home/lionel/<console>

/usr/lib/python2.4/site-packages/scipy_base/function_base.py in amax(m, axis)
179         axis = 0
180     else:
--> 181         m = _asarray1d(m)
182     return maximum.reduce(m,axis)
183

/usr/lib/python2.4/site-packages/scipy_base/function_base.py in
_asarray1d(arr)
152     """Ensure 1d array for one array.
153     """
--> 154     m = asarray(arr)
155     if len(m.shape)==0:
156         m = reshape(m,(1,))

/usr/lib/python2.4/site-packages/scipy_base/type_check.py in asarray(a,
typecode, savespace)
23             r.savespace(savespace)
24          return r
---> 25    return multiarray.array(a,typecode,copy=0,savespace=savespace or 0)
26
27 ScalarType = [types.IntType, types.LongType, types.FloatType,
types.ComplexType]

/usr/lib/python2.4/site-packages/Numeric/MA/MA.py in __array__(self, t)
630         if self._mask is not None:
--> 632                 raise MAError, \
633                 """Cannot automatically convert masked array to
Numeric because data
634                    is masked in one or more locations.

MAError: Cannot automatically convert masked array to Numeric because data
is masked in one or more locations.

######################################################

What do I have to do for having real computation on masked arrays?
Thanks

-L. Roubeyrie