Skip to content

Commit 9c14ee8

Browse files
committed
Drop redundant array-creation when calling bin1d_vec in .get_index_of
(`bin1d_vec` already does that with `.asarray`)
1 parent 1fac3bf commit 9c14ee8

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

csep/core/regions.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -625,8 +625,8 @@ def get_index_of(self, lons, lats):
625625
Returns:
626626
idx: ndarray-like
627627
"""
628-
idx = bin1d_vec(numpy.array(lons), self.xs)
629-
idy = bin1d_vec(numpy.array(lats), self.ys)
628+
idx = bin1d_vec(lons, self.xs)
629+
idy = bin1d_vec(lats, self.ys)
630630
if numpy.any(idx == -1) or numpy.any(idy == -1):
631631
raise ValueError("at least one lon and lat pair contain values that are outside of the valid region.")
632632
if numpy.any(self.bbox_mask[idy, idx] == 1):
@@ -1061,7 +1061,7 @@ def get_cell_area(self):
10611061
self.cell_area = cell_area
10621062
return self.cell_area
10631063

1064-
def get_index_of(self, lons, lats):
1064+
def get_index_of(self, lons, lats):
10651065
""" Returns the index of lons, lats in self.polygons
10661066
10671067
Args:

0 commit comments

Comments
 (0)