Skip to content

Commit

Permalink
Appease stickler
Browse files Browse the repository at this point in the history
  • Loading branch information
znicholls committed Sep 23, 2019
1 parent 06d6157 commit 1349e1d
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 28 deletions.
4 changes: 2 additions & 2 deletions pyam/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -911,8 +911,8 @@ def _variable_components(self, variable, all=False):
"""Get all components (sub-categories) of a variable for a given level
If `all`, for `variable='foo'`, return `['foo|bar']`, but don't include
`'foo|bar|baz'`, which is a sub-sub-category. Otherwise return all variables
below `variable` in the hierarchy"""
`'foo|bar|baz'`, which is a sub-sub-category. Otherwise return all
variables below `variable` in the hierarchy"""
var_list = pd.Series(self.data.variable.unique())
if all:
return var_list[pattern_match(var_list, '{}|*'.format(variable))]
Expand Down
53 changes: 27 additions & 26 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,33 +126,34 @@



ms = ['AIM', 'cscen']
CHECK_AGG_REGIONAL_DF = pd.DataFrame([
['AIM', 'cscen', 'World', 'Emissions|N2O', 'Mt N/yr', 1.9, 15.7],
['AIM', 'cscen', 'World', 'Emissions|N2O|AFOLU', 'Mt N/yr', 0.1, 0.1],
['AIM', 'cscen', 'World', 'Emissions|N2O|Ind', 'Mt N/yr', 1.8, 15.6],
['AIM', 'cscen', 'World', 'Emissions|N2O|Ind|Shipping', 'Mt N/yr', 1, 6],
['AIM', 'cscen', 'World', 'Emissions|N2O|Ind|Solvents', 'Mt N/yr', 1.6, 3.8],
['AIM', 'cscen', 'World', 'Emissions|N2O|Ind|Transport', 'Mt N/yr', -0.8, 5.8],
['AIM', 'cscen', 'RASIA', 'Emissions|N2O', 'Mt N/yr', 0, 5.9],
['AIM', 'cscen', 'RASIA', 'Emissions|N2O|Ind', 'Mt N/yr', 0, 5.9],
['AIM', 'cscen', 'RASIA', 'Emissions|N2O|Ind|Solvents', 'Mt N/yr', 0.8, 2.6],
['AIM', 'cscen', 'RASIA', 'Emissions|N2O|Ind|Transport', 'Mt N/yr', -0.8, 3.3],
['AIM', 'cscen', 'REUROPE', 'Emissions|N2O', 'Mt N/yr', 0.8, 3.7],
['AIM', 'cscen', 'REUROPE', 'Emissions|N2O|Ind', 'Mt N/yr', 0.8, 3.7],
['AIM', 'cscen', 'REUROPE', 'Emissions|N2O|Ind|Solvents', 'Mt N/yr', 0.8, 1.2],
['AIM', 'cscen', 'REUROPE', 'Emissions|N2O|Ind|Transport', 'Mt N/yr', 0, 2.5],
['AIM', 'cscen', 'China', 'Emissions|N2O', 'Mt N/yr', 0.2, 1.3],
['AIM', 'cscen', 'China', 'Emissions|N2O|Ind', 'Mt N/yr', 0.2, 1.3],
['AIM', 'cscen', 'China', 'Emissions|N2O|Ind|Transport', 'Mt N/yr', 0.2, 1.3],
['AIM', 'cscen', 'Japan', 'Emissions|N2O', 'Mt N/yr', -1, 2],
['AIM', 'cscen', 'Japan', 'Emissions|N2O|Ind', 'Mt N/yr', -1, 2],
['AIM', 'cscen', 'Japan', 'Emissions|N2O|Ind|Transport', 'Mt N/yr', -1, 2],
['AIM', 'cscen', 'Germany', 'Emissions|N2O', 'Mt N/yr', 2, 3],
['AIM', 'cscen', 'Germany', 'Emissions|N2O|Ind', 'Mt N/yr', 2, 3],
['AIM', 'cscen', 'Germany', 'Emissions|N2O|Ind|Transport', 'Mt N/yr', 2, 3],
['AIM', 'cscen', 'UK', 'Emissions|N2O', 'Mt N/yr', -2, -0.5],
['AIM', 'cscen', 'UK', 'Emissions|N2O|Ind', 'Mt N/yr', -2, -0.5],
['AIM', 'cscen', 'UK', 'Emissions|N2O|Ind|Transport', 'Mt N/yr', -2, -0.5],
ms + ['World', 'Emissions|N2O', 'Mt N/yr', 1.9, 15.7],
ms + ['World', 'Emissions|N2O|AFOLU', 'Mt N/yr', 0.1, 0.1],
ms + ['World', 'Emissions|N2O|Ind', 'Mt N/yr', 1.8, 15.6],
ms + ['World', 'Emissions|N2O|Ind|Shipping', 'Mt N/yr', 1, 6],
ms + ['World', 'Emissions|N2O|Ind|Solvents', 'Mt N/yr', 1.6, 3.8],
ms + ['World', 'Emissions|N2O|Ind|Transport', 'Mt N/yr', -0.8, 5.8],
ms + ['RASIA', 'Emissions|N2O', 'Mt N/yr', 0, 5.9],
ms + ['RASIA', 'Emissions|N2O|Ind', 'Mt N/yr', 0, 5.9],
ms + ['RASIA', 'Emissions|N2O|Ind|Solvents', 'Mt N/yr', 0.8, 2.6],
ms + ['RASIA', 'Emissions|N2O|Ind|Transport', 'Mt N/yr', -0.8, 3.3],
ms + ['REUROPE', 'Emissions|N2O', 'Mt N/yr', 0.8, 3.7],
ms + ['REUROPE', 'Emissions|N2O|Ind', 'Mt N/yr', 0.8, 3.7],
ms + ['REUROPE', 'Emissions|N2O|Ind|Solvents', 'Mt N/yr', 0.8, 1.2],
ms + ['REUROPE', 'Emissions|N2O|Ind|Transport', 'Mt N/yr', 0, 2.5],
ms + ['China', 'Emissions|N2O', 'Mt N/yr', 0.2, 1.3],
ms + ['China', 'Emissions|N2O|Ind', 'Mt N/yr', 0.2, 1.3],
ms + ['China', 'Emissions|N2O|Ind|Transport', 'Mt N/yr', 0.2, 1.3],
ms + ['Japan', 'Emissions|N2O', 'Mt N/yr', -1, 2],
ms + ['Japan', 'Emissions|N2O|Ind', 'Mt N/yr', -1, 2],
ms + ['Japan', 'Emissions|N2O|Ind|Transport', 'Mt N/yr', -1, 2],
ms + ['Germany', 'Emissions|N2O', 'Mt N/yr', 2, 3],
ms + ['Germany', 'Emissions|N2O|Ind', 'Mt N/yr', 2, 3],
ms + ['Germany', 'Emissions|N2O|Ind|Transport', 'Mt N/yr', 2, 3],
ms + ['UK', 'Emissions|N2O', 'Mt N/yr', -2, -0.5],
ms + ['UK', 'Emissions|N2O|Ind', 'Mt N/yr', -2, -0.5],
ms + ['UK', 'Emissions|N2O|Ind|Transport', 'Mt N/yr', -2, -0.5],

],
columns=['model', 'scenario', 'region', 'variable', 'unit', 2005, 2010],
Expand Down

0 comments on commit 1349e1d

Please sign in to comment.