Skip to content

Commit

Permalink
Fix vstack (#45)
Browse files Browse the repository at this point in the history
* Fix vstack

The numpy API now requires a sequence rather than an iterator so wrap in list before passing to `vstack`

* Update test_api.py

The numpy test utils moved
  • Loading branch information
duncanwp authored Oct 13, 2023
1 parent 2e4f6c6 commit 71a05f0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions cis/collocation/data_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,11 @@ def index_data(self, coords, hyper_points, coord_map):
# Output is a list of coordinates which lists the indexes where the hyper points
# should be located in the grid
indices = np.vstack(
np.where(
ci < max_coordinate_value,
np.searchsorted(bi, ci, side='right') - 1,
-1)
for bi, ci, max_coordinate_value in bounds_coords_max)
[np.where(
ci < max_coordinate_value,
np.searchsorted(bi, ci, side='right') - 1,
-1)
for bi, ci, max_coordinate_value in bounds_coords_max])

# D-tuple giving the shape of the output grid
grid_shape = tuple(len(bi_ci[0]) for bi_ci in bounds_coords_max)
Expand Down
2 changes: 1 addition & 1 deletion cis/test/unit/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from cis.test.util.mock import make_mock_cube, make_regular_2d_ungridded_data
from cis.data_io.gridded_data import make_from_cube
import numpy as np
from numpy.testing.utils import assert_array_almost_equal
from numpy.testing import assert_array_almost_equal


class TestAPI(TestCase):
Expand Down

0 comments on commit 71a05f0

Please sign in to comment.