Description
Overview
When trying to do operations on emissions, e.g.,
df = pyam.IamDataFrame(pd.DataFrame(
[
["model_a", "scen_a", "World", "foo", "Mt CO2/yr", 1, 6.0],
["model_a", "scen_a", "World", "bar", "Mt CO2/yr", 0.5, 3],
],
columns=pyam.IAMC_IDX + [2010, 2020],
))
df.add('foo', 'bar', 'baz')
we get an error as
UndefinedUnitError: 'CO2' is not defined in the unit registry
standard unit conversion works fine, so we somehow have the capability to work with the emissions units
df.convert_units("Mt CO2/yr", "Gt CO2/yr") # etc
It seems that there was quite some discussion on pyam
unit support in IAMconsortium/units#19.
Desired Outcome
I would argue that this is a situation where operations should "just work". In a worst case scenario, if I want to add two emissions time series with the same units, I shouldn't have to worry about units at all. In a best and ideal case scenario, we should leverage the power of pint to do the auto conversions as any other pint-dependent library.
So, I am wondering if we can lay out what are the pros and cons - and what are the options in terms of supporting such a feature.
@khaeru curious what you think as the units master =)
cc others who might be interested - @coroa @danielhuppmann @znicholls