Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pvlib/spa.py
Original file line number Diff line number Diff line change
Expand Up @@ -938,7 +938,7 @@ def solar_position_numba(unixtime, lat, lon, elev, pressure, temp, delta_t,

if ulength < numthreads:
warnings.warn('The number of threads is more than the length of '
'the time array. Only using %s threads.'.format(ulength))
f'the time array. Only using {ulength} threads.')
numthreads = ulength

if numthreads <= 1:
Expand Down
6 changes: 6 additions & 0 deletions pvlib/tests/test_spa.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,3 +423,9 @@ def test_solar_position_multithreaded(self):
nresult, self.spa.solar_position(
times, lat, lon, elev, pressure, temp, delta_t,
atmos_refract, numthreads=3, sst=True)[:3], 5)

def test_solar_position_warn_too_many_threads(self):
two_timestamps = np.array([unixtimes[0], unixtimes[0]])
with self.assertWarnsRegex(UserWarning, '.*Only using 2 threads.'):
self.spa.solar_position(two_timestamps, lat, lon, elev, pressure,
temp, delta_t, atmos_refract, numthreads=3)
Loading