From 8f42a9d9688993ce5a9e3c5acf851d71163ef76f Mon Sep 17 00:00:00 2001 From: Daniel Huppmann Date: Mon, 19 Dec 2022 15:40:08 +0100 Subject: [PATCH] Release candidate 1.7 (#719) --- RELEASE_NOTES.md | 12 +++++++++++- pyam/core.py | 9 +++------ setup.cfg | 2 +- tests/test_feature_rename.py | 17 +++++++++++++++++ 4 files changed, 32 insertions(+), 8 deletions(-) diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 573a8416b..d062bea7c 100644 --- a/RELEASE_NOTES.md +++ b/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 diff --git a/pyam/core.py b/pyam/core.py index 2dea8098f..457778283 100755 --- a/pyam/core.py +++ b/pyam/core.py @@ -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}) @@ -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 ): diff --git a/setup.cfg b/setup.cfg index 17829230c..0e6631b52 100644 --- a/setup.cfg +++ b/setup.cfg @@ -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] diff --git a/tests/test_feature_rename.py b/tests/test_feature_rename.py index c5024a29f..567f9da5f 100644 --- a/tests/test_feature_rename.py +++ b/tests/test_feature_rename.py @@ -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"},