Skip to content

Commit bab0fdd

Browse files
author
cpelley
committed
MAINT: Slight simplification
1 parent 58098b8 commit bab0fdd

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

stratify/_conservative.pyx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ cdef apply_weights(np.ndarray[np.float64_t, ndim=3] src_point,
7474
cdef Py_ssize_t ind
7575
cdef np.ndarray[np.float64_t, ndim=3] results, weighted_contrib
7676
cdef np.ndarray[np.float64_t, ndim=2] weights
77-
cdef np.ndarray[np.int64_t, ndim=2] nan_src_contrib
7877
results = np.zeros(
7978
[src_data.shape[0], tgt_point.shape[0], src_data.shape[2]],
8079
dtype='float64')
@@ -90,8 +89,8 @@ cdef apply_weights(np.ndarray[np.float64_t, ndim=3] src_point,
9089
np.nansum(weighted_contrib, axis=1))
9190
# Return nan values for those target cells, where there is any
9291
# contribution of nan data from the source data.
93-
nan_src_contrib = ((weights > 0) * np.isnan(weighted_contrib)).sum(axis=1)
94-
results[..., ind][nan_src_contrib>0] = np.nan
92+
results[..., ind][
93+
((weights > 0) * np.isnan(weighted_contrib)).any(axis=1)] = np.nan
9594

9695
# Return np.nan for those target cells where no source contributes.
9796
results[:, weights.sum(axis=0) == 0, ind] = np.nan

0 commit comments

Comments
 (0)