Skip to content

Commit

Permalink
Merge remote-tracking branch 'IAMconsortium/master' into docs/clean-u…
Browse files Browse the repository at this point in the history
…p_v0.5
  • Loading branch information
danielhuppmann committed Mar 21, 2020
2 parents 0ab5566 + ce03f5a commit 438279e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
2 changes: 2 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Next release

## API changes
PR [#349](https://github.com/IAMconsortium/pyam/pull/349) changed how appending
checks that time columns are equal.

PR [#341](https://github.com/IAMconsortium/pyam/pull/341) changed
the API of `IamDataFrame.convert_unit()` from a dictionary to explicit kwargs
Expand Down
2 changes: 1 addition & 1 deletion pyam/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ def append(self, other, ignore_meta_conflict=False, inplace=False,
other = IamDataFrame(other, **kwargs)
ignore_meta_conflict = True

if self.time_col is not other.time_col:
if self.time_col != other.time_col:
raise ValueError('incompatible time format (years vs. datetime)!')

ret = self.copy() if not inplace else self
Expand Down
10 changes: 10 additions & 0 deletions tests/test_feature_append_rename.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,16 @@ def test_append_other_scenario(test_df):
npt.assert_array_equal(ts.iloc[2].values, ts.iloc[3].values)


def test_append_reconstructed_time(test_df):
# This tests that dfs with identical time cols created by different methods
# can be appended
other = test_df.filter(scenario='scen_b')\
.rename({'scenario': {'scen_b': 'scen_c'}})
other.time_col = other.time_col[0:1] + other.time_col[1:]
test_df.append(other, inplace=True)
assert "scen_c" in test_df.scenarios().values


def test_append_same_scenario(test_df):
other = test_df.filter(scenario='scen_b')\
.rename({'variable': {'Primary Energy': 'Primary Energy clone'}})
Expand Down

0 comments on commit 438279e

Please sign in to comment.