[Numpy-discussion] use of concatenate with subclass of ndarray

Bryce Hendrix bhendrix@enthought....
Thu Mar 29 13:40:35 CDT 2007

Yup, we've decided to write custom concatenate & where methods. Thanks 
for all the help.


Pierre GM wrote:
> On Thursday 29 March 2007 14:09:38 Bryce Hendrix wrote:
>> I really should widen my tests before proclaiming success... If you
>> change the default units to "feet", the result of concatenating two
>> UnitArrays instances with "meters" units is a UnitArray with "feet".
> Not a surprise at all, and I should have thought about it:
> concatenate creates a plain ndarray first and ends up calling 
> Unit_array.__array_finalize__. As the caller has no unit yet 
> (it's a plain ndarray), the result gets the Unit_array.default_unit. 
> That's why you should really write a custom concatenate function that checks 
> the units of its inputs, and sets the unit of the output accordingly.
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion@scipy.org
> http://projects.scipy.org/mailman/listinfo/numpy-discussion

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20070329/4af29fd1/attachment-0001.html 

More information about the Numpy-discussion mailing list