NEP 42 mentions physical units as a possible use case for the new DType.
Having worked on `unyt`, which is an ndarray subclass, and other unit
system implementations based on the dispatch mechanism, I am quite familiar
with the challenges. One challenge is integration with Matplotlib that has
a unit conversion interface. This interface is invoked by a registry
mapping from unit array type, such as `unyt_array`, and its conversion
class. A custom DType will still result in an ndarray type - correct? If
so, Matplotlib will attempt to perform its internal calculations eventually
leading to an invalid operation when adding a physical quantity to a pure
number. This happens today with `unyt_array` and some of the plotting
functions that allow the subclass to leak through into the internals. Has
this been discussed? I can imagine other libraries will have the same
challenge.
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@python.org
https://mail.python.org/mailman/listinfo/numpy-discussion

Reply via email to