Skip to content

Commit f8e6268

Browse files
committed
Raise error if no res above min_threshold can be found in get_resolution_1d
1 parent 9ce4106 commit f8e6268

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

climada/util/coordinates.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2186,6 +2186,10 @@ def get_resolution_1d(coords, min_resol=1.0e-8):
21862186
res = np.diff(np.unique(coords)) # always positive because unique is sorted
21872187
diff = np.abs(np.diff(coords))
21882188
mask = (res > min_resol) & np.isin(res, diff)
2189+
if not len(mask):
2190+
raise ValueError(
2191+
"Cannot find a resolution higher than `min_resol` for the given coordinates"
2192+
)
21892193
return diff[diff == res[mask].min()][0]
21902194

21912195

0 commit comments

Comments
 (0)