Open Midnighter opened 3 years ago
Hi,
From a strict metrological standpoint, the substance is not a part of the unit. This is how in everyday life we use units, a kilogram is a kilogram regardless if you measure the mass of apples or flour or whatever (and, often the units are properly additive in that context, 250 g of flour and 100 g of sugar surely is 350 g of a sugar-flour-mixture). However, in many scientific disciplines, the description of the entity being measured is also put into the "unit", and if you want to, you can do that with pint; however, it is some work. If you want to see how it can be done, have a look at https://github.com/openscm/openscm-units , where this is done to have pseudo-units for different gases in a climate context. Most of the magic happens in https://github.com/openscm/openscm-units/blob/master/src/openscm_units/_unit_registry.py . It has the property that, as you describe, different gases cannot be added together and the gas pseudo-units don't cancel out.
Cheers,
Mika
Hello,
I work in the biochemistry/biotechnology area and often have to handle substance specific units. What I mean by that is, for example, concentration measurements given in units of gram cell dry weight (gCDW) such that when I have 0.02 gram of glucose per gram cell dry weight
Can I achieve this with pint? I have seen pyEQL and its Solution class looks quite useful but is not directly what I need. Thank you for any pointers.