[SciPy-dev] physical quantities: udunits?
Tue Jul 29 18:35:04 CDT 2008
Darren Dale wrote:
> I was wondering if anyone is familiar with the udunits package, would it be
> suitable as the foundation for physical quantities support in python?
> According to freshmeat, udunits is released under a BSD-style license.
FWIW I have a small units-of-measurement class that I've used a bit in
my own code.
Example of use is here:
The implementation is here:
The interesting thing about this implementation is that it interfaces
with some C++ template-based code that performs units-of-measurement
checking at *compile time*, with no runtime overhead. So the idea is
that Python is used for a slightly 'heavy' system of storing values
(plus their dimension data, eg M L T^-1) and these values are
efficiently passed into C/C++ where units-checked calculations are done
with no overhead.
I'm not suggesting this is a 'mature' and 'complete' system but if
anyone's thinking about making some sort of official implementation for
this stuff, these ideas might be worth some thought.
Also might be worth thinking about efficient storing of arrays of values
with the same unit-dimensions eg via numpy.
More information about the Scipy-dev