environmentalscience / essm

This package contains helpers to deal with physical variables and units.
https://environmentalscience.github.io/essm/
GNU General Public License v2.0
12 stars 5 forks source link

Changes implementation to SymPy #26

Closed jirikuncar closed 7 years ago

schymans commented 7 years ago

Use of MKS in https://github.com/environmentalscience/essm/blob/sympy/essm/variables/units.py#L58 is not adequate, as MKS stands for "meter, kilogram, second". We also need representations for kelvin and mole, others might also need ampere and candela etc.

jirikuncar commented 7 years ago

@schymans can we use the natural system?

schymans commented 7 years ago

No, sorry, natural is even worse:

>>> from essm.variables.units import MKS
>>> quantities = [T_a, nu_a, p_nua1, p_nua2]
>>> print [a.convert_to(MKS.print_unit_base(a)) for a in quantities]
[T_a, meter**2/second, p_nua1, meter**2/second]

This one only fails on T_a, but natural returns useless stuff:

>>> from sympy.physics.units.systems import natural
>>> quantities = [T_a, nu_a, p_nua1, p_nua2]
>>> print [a.convert_to(natural.print_unit_base(a)) for a in quantities]
[T_a, 0.0169042576289485*hbar*speed_of_light**2/electronvolt, p_nua1, 0.0169042576289485*hbar*speed_of_light**2/electronvolt]

We may have to write an additional units system called SI.

schymans commented 7 years ago

MKSA only adds ampere. I created SI, based on MKSA with a complete set of SI base units (i.e. adding K, mol and cd). I will try to also create a PR on SYMPY to include it.

On 07/06/2017 10:15 AM, Jiri Kuncar wrote:

@schymans https://github.com/schymans can we use the MKSA (https://github.com/sympy/sympy/blob/1.1/sympy/physics/units/systems/mksa.py#L32)?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/environmentalscience/essm/pull/26#issuecomment-313328094, or mute the thread https://github.com/notifications/unsubscribe-auth/ADH1pq57mkHZ5UvpWo7QjJVbpQm8Usr5ks5sLJeJgaJpZM4ON9TS.

--


Stan Schymanski Riedstrasse 60 8604 Volketswil Schweiz

Ph: +41 (0)43 5420487