Skip to content

Commit 82f9142

Browse files
committed
Use ValueError instead of IndexError in _degrees_to_index
1 parent 770bcd1 commit 82f9142

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pvlib/tools.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -471,14 +471,14 @@ def _degrees_to_index(degrees, coordinate):
471471
inputmax = 180
472472
outputmax = 4320
473473
else:
474-
raise IndexError("coordinate must be 'latitude' or 'longitude'.")
474+
raise ValueError("coordinate must be 'latitude' or 'longitude'.")
475475

476476
inputrange = inputmax - inputmin
477477
scale = outputmax/inputrange # number of indices per degree
478478
center = inputmin + 1 / scale / 2 # shift to center of index
479479
outputmax -= 1 # shift index to zero indexing
480480
index = (degrees - center) * scale
481-
err = IndexError('Input, %g, is out of range (%g, %g).' %
481+
err = ValueError('Input, %g, is out of range (%g, %g).' %
482482
(degrees, inputmin, inputmax))
483483

484484
# If the index is still out of bounds after rounding, raise an error.

0 commit comments

Comments
 (0)