You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If I have an IamDataFrame df with two variables, 'Primary Energy|Gas' with unit 'TWh/yr' and 'Emission Factor|Gas' with unit 'Mt/TWh'. If I want to aggregate both variables to 'Emissions|Gas' doing the following:
You are trying to do something that's going beyond the intent of the aggregation-function. But you actually found a nice workaround using standard pyam functions, so kudos!
Anyway, @gaurav-ganti started a similar issue (see #332) and in response @gidden started a PR a few months ago (see #333) that implemented basic operations (multiplication, division, addition, subtraction). Unfortunately, this development didn't quite make it into the master branch, but if you feel up to the task, you could look into this and bring it to completion! What do you think?
If I have an IamDataFrame df with two variables, 'Primary Energy|Gas' with unit 'TWh/yr' and 'Emission Factor|Gas' with unit 'Mt/TWh'. If I want to aggregate both variables to 'Emissions|Gas' doing the following:
df.aggregate('Emissions|Gas', components=['Primary Energy|Gas', 'Emission Factor|Gas'], method=np.prod)
instead of getting the unit 'Mt/yr' I get two entries with units 'TWh/yr' and 'Mt/TWh'.
I'd like to have either
df.aggregate('Emissions|Gas', components=['Primary Energy|Gas', 'Emission Factor|Gas'], method=np.prod, unit='Mt/TWh)
Currently as a workaround I'm doing something like
temp_df = df.convert_unit('Mt/TWh', to='Mt/yr', factor=1)
temp_df = temp_df.convert_unit('TWh/yr', to='Mt/yr', factor=1)
temp_df.aggregate('Emissions|Gas', components=['Primary Energy|Gas', 'Emission Factor|Gas'], method=np.prod)
The text was updated successfully, but these errors were encountered: