From f5df656739109359687233c7875d5a73e75343c6 Mon Sep 17 00:00:00 2001 From: alex chamberlain-clay Date: Tue, 12 Sep 2023 16:57:40 +0100 Subject: [PATCH 1/7] Updated all np.product calls to np.prod --- lib/iris/fileformats/_structured_array_identification.py | 2 +- lib/iris/pandas.py | 2 +- lib/iris/tests/integration/netcdf/test_thread_safety.py | 2 +- lib/iris/tests/unit/pandas/test_pandas.py | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/iris/fileformats/_structured_array_identification.py b/lib/iris/fileformats/_structured_array_identification.py index b313500de7..11c62983e3 100644 --- a/lib/iris/fileformats/_structured_array_identification.py +++ b/lib/iris/fileformats/_structured_array_identification.py @@ -417,7 +417,7 @@ def filter_strides_of_length(length): # If we are to build another dimension on top of this possible # structure, we need to compute the stride that would be # needed for that dimension. - next_stride = np.product( + next_stride = np.prod( [struct.size for (_, struct) in potential] ) diff --git a/lib/iris/pandas.py b/lib/iris/pandas.py index 4d6681e94e..4c06530627 100644 --- a/lib/iris/pandas.py +++ b/lib/iris/pandas.py @@ -398,7 +398,7 @@ def as_cubes( cube_shape = getattr(pandas_index, "levshape", (pandas_index.nunique(),)) n_rows = len(pandas_structure) - if np.product(cube_shape) > n_rows: + if np.prod(cube_shape) > n_rows: message = ( f"Not all index values have a corresponding row - {n_rows} rows " f"cannot be reshaped into {cube_shape}. Consider padding with NaN " diff --git a/lib/iris/tests/integration/netcdf/test_thread_safety.py b/lib/iris/tests/integration/netcdf/test_thread_safety.py index 5ed32d0671..c5779250a2 100644 --- a/lib/iris/tests/integration/netcdf/test_thread_safety.py +++ b/lib/iris/tests/integration/netcdf/test_thread_safety.py @@ -38,7 +38,7 @@ def tiny_chunks(): def _check_tiny_loaded_chunks(cube: Cube): assert cube.has_lazy_data() cube_lazy_data = cube.core_data() - assert np.product(cube_lazy_data.chunksize) < cube_lazy_data.size + assert np.prod(cube_lazy_data.chunksize) < cube_lazy_data.size with dask.config.set({"array.chunk-size": "1KiB"}): yield _check_tiny_loaded_chunks diff --git a/lib/iris/tests/unit/pandas/test_pandas.py b/lib/iris/tests/unit/pandas/test_pandas.py index fd716bd7c9..d74d7cad9c 100644 --- a/lib/iris/tests/unit/pandas/test_pandas.py +++ b/lib/iris/tests/unit/pandas/test_pandas.py @@ -1075,7 +1075,7 @@ def test_ancillary_variable(self): def test_3d_with_2d_coord(self): df = self._create_pandas(index_levels=3) coord_shape = df.index.levshape[:2] - coord_values = np.arange(np.product(coord_shape)) + coord_values = np.arange(np.prod(coord_shape)) coord_name = "foo" df[coord_name] = coord_values.repeat(df.index.levshape[-1]) result = iris.pandas.as_cubes(df, aux_coord_cols=[coord_name]) @@ -1089,7 +1089,7 @@ def test_3d_with_2d_coord(self): def test_coord_varies_all_indices(self): df = self._create_pandas(index_levels=3) coord_shape = df.index.levshape - coord_values = np.arange(np.product(coord_shape)) + coord_values = np.arange(np.prod(coord_shape)) coord_name = "foo" df[coord_name] = coord_values result = iris.pandas.as_cubes(df, aux_coord_cols=[coord_name]) @@ -1105,7 +1105,7 @@ def test_category_coord(self): # increment. df = self._create_pandas(index_levels=2) coord_shape = df.index.levshape - coord_values = np.arange(np.product(coord_shape)) + coord_values = np.arange(np.prod(coord_shape)) coord_name = "foo" # Create a repeating value along a dimension. From 69a3a22f1256545d5a1edd56dfb381472118c549 Mon Sep 17 00:00:00 2001 From: alex chamberlain-clay Date: Fri, 15 Sep 2023 10:52:36 +0100 Subject: [PATCH 2/7] added whats new --- docs/src/whatsnew/latest.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/src/whatsnew/latest.rst b/docs/src/whatsnew/latest.rst index 2de3dc1ced..f8ca922cce 100644 --- a/docs/src/whatsnew/latest.rst +++ b/docs/src/whatsnew/latest.rst @@ -79,6 +79,9 @@ This document explains the changes made to Iris for this release working properly. (Main pull request: :pull:`5437`, more detail: :pull:`5430`, :pull:`5431`, :pull:`5432`, :pull:`5434`, :pull:`5436`) +#. `@acchamber` removed several depreication warnings from iris related to Numpy 1.25 depreications + :pull:`#5493` + .. comment Whatsnew author names (@github name) in alphabetical order. Note that, From e7e2e558938717a3d7079c4d65ee2092fa88ba96 Mon Sep 17 00:00:00 2001 From: alex chamberlain-clay Date: Fri, 15 Sep 2023 16:00:40 +0100 Subject: [PATCH 3/7] review responses --- docs/src/whatsnew/latest.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/src/whatsnew/latest.rst b/docs/src/whatsnew/latest.rst index f8ca922cce..cf7621b8af 100644 --- a/docs/src/whatsnew/latest.rst +++ b/docs/src/whatsnew/latest.rst @@ -79,8 +79,8 @@ This document explains the changes made to Iris for this release working properly. (Main pull request: :pull:`5437`, more detail: :pull:`5430`, :pull:`5431`, :pull:`5432`, :pull:`5434`, :pull:`5436`) -#. `@acchamber` removed several depreication warnings from iris related to Numpy 1.25 depreications - :pull:`#5493` +#. `@acchamber` removed several warnings from iris related to Numpy 1.25 depreications + (:pull:`#5493`) .. comment From fef7f129cf0d27d15831e653bab3fb9859626650 Mon Sep 17 00:00:00 2001 From: alex chamberlain-clay Date: Fri, 15 Sep 2023 16:03:50 +0100 Subject: [PATCH 4/7] no typos here --- docs/src/whatsnew/latest.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/whatsnew/latest.rst b/docs/src/whatsnew/latest.rst index cf7621b8af..7246256119 100644 --- a/docs/src/whatsnew/latest.rst +++ b/docs/src/whatsnew/latest.rst @@ -79,7 +79,7 @@ This document explains the changes made to Iris for this release working properly. (Main pull request: :pull:`5437`, more detail: :pull:`5430`, :pull:`5431`, :pull:`5432`, :pull:`5434`, :pull:`5436`) -#. `@acchamber` removed several warnings from iris related to Numpy 1.25 depreications +#. `@acchamber` removed several warnings from iris related to Numpy 1.25 deprecations (:pull:`#5493`) From 41b2c27332d9037f615aa50aae8ab65ff1dfae18 Mon Sep 17 00:00:00 2001 From: alex chamberlain-clay Date: Fri, 15 Sep 2023 16:11:23 +0100 Subject: [PATCH 5/7] added link to name --- docs/src/whatsnew/latest.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/src/whatsnew/latest.rst b/docs/src/whatsnew/latest.rst index 7246256119..04f8bb2250 100644 --- a/docs/src/whatsnew/latest.rst +++ b/docs/src/whatsnew/latest.rst @@ -88,6 +88,8 @@ This document explains the changes made to Iris for this release core dev names are automatically included by the common_links.inc: .. _@scottrobinson02: https://github.com/scottrobinson02 +.. _@acchamber: https://github.com/acchamber + .. comment Whatsnew resources in alphabetical order: From 9a3c6758f320bd87d9ed5bbe38607c4145517778 Mon Sep 17 00:00:00 2001 From: Alex Chamberlain-Clay <68277260+acchamber@users.noreply.github.com> Date: Fri, 15 Sep 2023 16:12:31 +0100 Subject: [PATCH 6/7] Update docs/src/whatsnew/latest.rst Co-authored-by: Elias <110238618+ESadek-MO@users.noreply.github.com> --- docs/src/whatsnew/latest.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/whatsnew/latest.rst b/docs/src/whatsnew/latest.rst index 04f8bb2250..8401954910 100644 --- a/docs/src/whatsnew/latest.rst +++ b/docs/src/whatsnew/latest.rst @@ -79,7 +79,7 @@ This document explains the changes made to Iris for this release working properly. (Main pull request: :pull:`5437`, more detail: :pull:`5430`, :pull:`5431`, :pull:`5432`, :pull:`5434`, :pull:`5436`) -#. `@acchamber` removed several warnings from iris related to Numpy 1.25 deprecations +#. `@acchamber`_ removed several warnings from iris related to Numpy 1.25 deprecations (:pull:`#5493`) From c5b02abb64a229097be23e89a88c47fddf5ddb20 Mon Sep 17 00:00:00 2001 From: Alex Chamberlain-Clay <68277260+acchamber@users.noreply.github.com> Date: Fri, 15 Sep 2023 16:15:22 +0100 Subject: [PATCH 7/7] Update docs/src/whatsnew/latest.rst Co-authored-by: Elias <110238618+ESadek-MO@users.noreply.github.com> --- docs/src/whatsnew/latest.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/whatsnew/latest.rst b/docs/src/whatsnew/latest.rst index 8401954910..2a01e2f018 100644 --- a/docs/src/whatsnew/latest.rst +++ b/docs/src/whatsnew/latest.rst @@ -80,7 +80,7 @@ This document explains the changes made to Iris for this release :pull:`5430`, :pull:`5431`, :pull:`5432`, :pull:`5434`, :pull:`5436`) #. `@acchamber`_ removed several warnings from iris related to Numpy 1.25 deprecations - (:pull:`#5493`) + (:pull:`5493`) .. comment