Skip to content

Commit 84f12c9

Browse files
committed
fix numpy related issues
1 parent c01bfbf commit 84f12c9

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/pykrige/core.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -700,7 +700,7 @@ def _krige(
700700
# measurement points (X) and the kriging point (coords)
701701
if coordinates_type == "euclidean":
702702
d = squareform(pdist(X, metric="euclidean"))
703-
bd = np.squeeze(cdist(X, coords[None, :], metric="euclidean"))
703+
bd = np.asarray(cdist(X, coords[None, :], metric="euclidean")).ravel()
704704

705705
# geographic coordinate distances still calculated in the old way...
706706
# assume X[:, 0] ('x') => lon, X[:, 1] ('y') => lat
@@ -709,12 +709,14 @@ def _krige(
709709
x1, x2 = np.meshgrid(X[:, 0], X[:, 0], sparse=True)
710710
y1, y2 = np.meshgrid(X[:, 1], X[:, 1], sparse=True)
711711
d = great_circle_distance(x1, y1, x2, y2)
712-
bd = great_circle_distance(
712+
bd = np.asarray(
713+
great_circle_distance(
713714
X[:, 0],
714715
X[:, 1],
715716
coords[0] * np.ones(X.shape[0]),
716717
coords[1] * np.ones(X.shape[0]),
717718
)
719+
).ravel()
718720

719721
# this check is done when initializing variogram, but kept here anyways...
720722
else:
@@ -725,7 +727,7 @@ def _krige(
725727
# check if kriging point overlaps with measurement point
726728
if np.any(np.absolute(bd) <= 1e-10):
727729
zero_value = True
728-
zero_index = np.where(bd <= 1e-10)[0][0]
730+
zero_index = int(np.flatnonzero(bd <= 1e-10)[0])
729731

730732
# set up kriging matrix
731733
n = X.shape[0]

0 commit comments

Comments
 (0)