Skip to content

Commit

Permalink
utils: Force return of integers from get_index_of_nearest_node()
Browse files Browse the repository at this point in the history
Printing the index node was kind of problematic.
  • Loading branch information
pmav99 committed Oct 12, 2023
1 parent e2f667f commit 28104d3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion thalassa/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def get_index_of_nearest_node(ds: xr.Dataset, lon: float, lat: float) -> int:
# https://www.unidata.ucar.edu/blogs/developer/en/entry/accessing_netcdf_data_by_coordinates
# https://github.com/Unidata/python-workshop/blob/fall-2016/notebooks/netcdf-by-coordinates.ipynb
dist = abs(ds.lon - lon) ** 2 + abs(ds.lat - lat) ** 2
index_of_nearest_node = T.cast(int, dist.argmin())
index_of_nearest_node = int(dist.argmin())
return index_of_nearest_node


Expand Down

0 comments on commit 28104d3

Please sign in to comment.