Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove special handling for dimensions indexed by a 'year' set #220

Merged
merged 1 commit into from
Nov 25, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 1 addition & 11 deletions ixmp/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -925,17 +925,7 @@ def par(self, name, filters=None, **kwargs):
filters : dict
index names mapped list of index set elements
"""
result = self._backend('item_get_elements', 'par', name, filters)

# FIXME message_ix requires 'year' columns to be returned as integers
# This code should be in a message_ix override of this method.
dtypes = {}
for idx_set, col_name in zip(self.idx_sets(name),
self.idx_names(name)):
if idx_set == 'year':
dtypes[col_name] = int

return result.astype(dtypes) if len(dtypes) else result
return self._backend('item_get_elements', 'par', name, filters)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Should kwargs be passed to backend's item_get_elements method?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think these kwargs should be removed entirely; they exist only to be forgiving of sloppy user code.


def add_par(self, name, key_or_data=None, value=None, unit=None,
comment=None, key=None, val=None):
Expand Down