Skip to content

Commit

Permalink
Release candidate 1.7 (#719)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielhuppmann committed Dec 19, 2022
1 parent 4cd4c7d commit 8f42a9d
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 8 deletions.
12 changes: 11 additions & 1 deletion RELEASE_NOTES.md
@@ -1,4 +1,14 @@
# Next Release
# Release v1.7.0

## Highlights

- Add a feature to compute (weighted) quantiles for scenario data
- Implement a `require_data()` method for scenario validation
- Remove 'xls' as by-default-supported file format to harmonize behavior with **pandas**

## API changes

The method `compute_bias()` was removed; please use `compute.bias()` instead.

## Dependency changes

Expand Down
9 changes: 3 additions & 6 deletions pyam/core.py
Expand Up @@ -1019,6 +1019,9 @@ def require_variable(self, variable, unit=None, year=None, exclude_on_fail=False
exclude_on_fail : bool, default False
flag scenarios missing the required variables as `exclude: True`
"""
# TODO: deprecated, remove for release >= 2.0
deprecation_warning("Use `df.require_data()` instead.")

criteria = {"variable": variable}
if unit:
criteria.update({"unit": unit})
Expand Down Expand Up @@ -1082,12 +1085,6 @@ def validate(self, criteria={}, exclude_on_fail=False):
self._exclude_on_fail(df)
return df.reset_index()

def compute_bias(self, name, method, axis):
"""DEPRECATED - please use :meth:`IamDataFrame.compute.bias()`"""
# TODO: deprecated, remove for release >= 1.7
deprecation_warning("Use `df.compute.bias()` instead.")
self.compute.bias(name, method, axis)

def rename(
self, mapping=None, inplace=False, append=False, check_duplicates=True, **kwargs
):
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Expand Up @@ -27,7 +27,7 @@ python_requires = >=3.7.1, <3.11
# Please also add a section "Dependency changes" to the release notes
install_requires =
iam-units >= 2020.4.21
numpy >= 1.19.0
numpy >= 1.19.0, < 1.24
requests
pyjwt
httpx[http2]
Expand Down
17 changes: 17 additions & 0 deletions tests/test_feature_rename.py
Expand Up @@ -198,6 +198,23 @@ def test_rename_empty(test_df_year):
assert_iamframe_equal(empty_df, empty_df.rename(model={"model_a": "model_b"}))


@pytest.mark.parametrize("append", (False, True))
@pytest.mark.parametrize("inplace", (False, True))
def test_rename_no_change(test_df_year, append, inplace):
"""Check that renaming with an "irrelevant" mapping works as expected"""

df = test_df_year.copy()

mapping = dict(variable={"Primary Energy": "Other Variable"}, unit={"foo": "bar"})
obs = df.rename(**mapping, append=append, inplace=inplace)

if inplace:
assert obs is None
assert_iamframe_equal(df, test_df_year)
else:
assert_iamframe_equal(obs, test_df_year)


def test_rename_index_data_fail(test_df):
mapping = {
"scenario": {"scen_a": "scen_c"},
Expand Down

0 comments on commit 8f42a9d

Please sign in to comment.