From 28104d3770f9004e732d15063f78b0f243a0f72e Mon Sep 17 00:00:00 2001 From: Panos Mavrogiorgos Date: Thu, 12 Oct 2023 13:05:41 +0300 Subject: [PATCH] utils: Force return of `integers` from `get_index_of_nearest_node()` Printing the index node was kind of problematic. --- thalassa/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/thalassa/utils.py b/thalassa/utils.py index 65667df..7a0817e 100644 --- a/thalassa/utils.py +++ b/thalassa/utils.py @@ -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