Closed cwerner closed 4 years ago
In general, I would argue that this type of higher level checks should be in a different package that use pint. Having said that, there was a discusion to annotate quantities, which could allow user defined checks. Look up "Role" in the tracker.
Ah, ok. I’ll try to check out the role() discussion. Thanks
And if that does not suit your needs, start a package that uses pint. We will be happy to support you.
Thanks. I'll try to learn a bit more about pint and then maybe try to create a small package as suggested. My first idea would be to subclass Quantity and customise it slightly... Cheers
Hi.
Very fresh user of the library so I might be missing something. I'm looking for a solution to the following use case (also, I'd +1 for a discourse channel to discuss the use of this great library):
I work with environmental data (greenhouse gas fluxes) and want to encode the units into my computations.
Now, this works fine for basic calculations (i.e. kg ha-1 * area), however I usually have emissions like N2O, NOx or CH4 and their quantities are given in kg N ha-1 or kg C ha-1, respectively
Question 1: Can I somehow enforce a check that additions of N-based substances work, but for instance 12 kg N2O-N + 6 kg CH4-C gives an error? Would I need to redefine kg for that or can the chemistry context help?
Question 2: For N2O, CH4 or CO2 we often convert to CO2-eq (global worming potential, GWP). This is basically a ratio to convert from N2O-> CO2-eq (factor 285) or from CH4->CO2-eq (28). After the conversion the variables can be added up (i.e. the GWP). How would one do that?
Cheers