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

Pierre GM pgmdevlist@gmail....
Thu Mar 29 13:09:07 CDT 2007


On Thursday 29 March 2007 13:47:48 Bryce Hendrix wrote:
> doh! I followed the example on the Wiki which does not define the class
> attribute in the class scope, but in __new__. Adding the declaration to
> the class scope seems to work.

Yeah, sorry about that, I really should update this wiki page. I gonna try 
later this afternoon/evening.
Glad it works, though.

However, that only part of your problem:
With concatenate, what unit should take precedence ? In your example, 
concatenating unit_ary_1 and unit_ary_2 should give a unit_array w/ meters as 
units. But what if you concatenate unit_1 and unit_3 ? Meters or feet ?

The idea would be to write a custom concatenate function, that would convert 
the units of each argument to the unit of the first one (for example), and 
call numpy.concatenate. Or something like that.


More information about the Numpy-discussion mailing list