From 9c14ee85250a7427aeefca43dcc13a71c3c12925 Mon Sep 17 00:00:00 2001 From: Marcus Herrmann Date: Wed, 5 Feb 2025 15:21:12 +0100 Subject: [PATCH] Drop redundant `array`-creation when calling `bin1d_vec` in `.get_index_of` (`bin1d_vec` already does that with `.asarray`) --- csep/core/regions.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/csep/core/regions.py b/csep/core/regions.py index 04795c01..88b37aeb 100644 --- a/csep/core/regions.py +++ b/csep/core/regions.py @@ -625,8 +625,8 @@ def get_index_of(self, lons, lats): Returns: idx: ndarray-like """ - idx = bin1d_vec(numpy.array(lons), self.xs) - idy = bin1d_vec(numpy.array(lats), self.ys) + idx = bin1d_vec(lons, self.xs) + idy = bin1d_vec(lats, self.ys) if numpy.any(idx == -1) or numpy.any(idy == -1): raise ValueError("at least one lon and lat pair contain values that are outside of the valid region.") if numpy.any(self.bbox_mask[idy, idx] == 1): @@ -1061,7 +1061,7 @@ def get_cell_area(self): self.cell_area = cell_area return self.cell_area - def get_index_of(self, lons, lats): + def get_index_of(self, lons, lats): """ Returns the index of lons, lats in self.polygons Args: