Skip to content

Commit

Permalink
Make mypy happy
Browse files Browse the repository at this point in the history
  • Loading branch information
sverhoeven committed Jun 20, 2022
1 parent 8013b68 commit b9b3fae
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/ewatercycle/models/hype.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ def _coords_to_indices(
for plon, plat in zip(lon, lat):
dist = geographical_distances(plon, plat, x, y)
index = dist.argmin()
indices.append(index)
indices.append(int(index))

return indices

Expand Down
8 changes: 4 additions & 4 deletions src/ewatercycle/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,16 @@ def find_closest_point(
if distance > max(dx, dy) * 2:
raise ValueError(f"Point {point_longitude, point_latitude} outside model grid.")

return idx_lon, idx_lat
return int(idx_lon), int(idx_lat)


def geographical_distances(
point_longitude: float,
point_latitude: float,
lon_vectors: np.array,
lat_vectors: np.array,
lon_vectors: np.ndarray,
lat_vectors: np.ndarray,
radius=6373.0,
) -> np.array:
) -> np.ndarray:
"""It uses Spherical Earth projected to a plane formula:
https://en.wikipedia.org/wiki/Geographical_distance
Expand Down

0 comments on commit b9b3fae

Please sign in to comment.