iris icon indicating copy to clipboard operation
iris copied to clipboard

Resolve numpy deprecation: using large arrays as indexes for slicing

Open ESadek-MO opened this issue 2 years ago • 1 comments

📰 Custom Issue

Written up from #5465.

Currently we use arrays as indexes used in slicing, this behavior is soon to be unsupported. Relevant warning copied below.

lib/iris/tests/experimental/regrid/test_regrid_area_weighted_rectilinear_src_and_grid.py::TestAreaWeightedRegrid::test_lazy_nop
lib/iris/tests/integration/analysis/test_area_weighted.py::AreaWeightedTests::test_regrid_area_w_lazy
lib/iris/tests/integration/analysis/test_area_weighted.py::AreaWeightedTests::test_regrid_area_w_lazy_chunked
lib/iris/tests/unit/analysis/area_weighted/test_AreaWeightedRegridder.py::TestLazy::test_output_lazy
lib/iris/tests/unit/analysis/area_weighted/test_AreaWeightedRegridder.py::TestLazy::test_src_stays_lazy
lib/iris/analysis/_area_weighted.py:606: DeprecationWarning: Out of bound index found. This was previously ignored when the indexing result contained no elements. In the future the index error will be raised. This error occurs either due to an empty slice, or if an array has zero elements even before indexing.
 (Use `warnings.simplefilter('error')` to turn this DeprecationWarning into an error and get more details on the invalid index.)
   src_area_datas_square = src_data[
       ..., square_data_indices_y, square_data_indices_x
   ]

ESadek-MO avatar Oct 05 '23 09:10 ESadek-MO