Skip to content

Commit e80355e

Browse files
authored
Remove warning message for num_threads in pvlib.spa (#2170)
* fix spa numthreads warning interpolation * add test * get rid of the warning altogether * whatsnew
1 parent d8ea82b commit e80355e

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

docs/sphinx/source/whatsnew/v0.11.1.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ Enhancements
3030
* Added function for calculating wind speed at different heights,
3131
:py:func:`pvlib.atmosphere.windspeed_powerlaw`.
3232
(:issue:`2118`, :pull:`2124`)
33+
* The multithreaded SPA functions no longer emit a warning when calculating
34+
solar positions for short time series. (:pull:`2170`)
3335
* Implemented closed-form solution for alpha in :py:func:`pvlib.clearsky.detect_clearsky`,
3436
obviating the call to scipy.optimize that was prone to runtime errors and minimizing
3537
computation. (:issue:`2171`, :issue:`2216`, :pull:`2217`).

pvlib/spa.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -937,8 +937,6 @@ def solar_position_numba(unixtime, lat, lon, elev, pressure, temp, delta_t,
937937
unixtime = unixtime.astype(np.float64)
938938

939939
if ulength < numthreads:
940-
warnings.warn('The number of threads is more than the length of '
941-
'the time array. Only using %s threads.'.format(ulength))
942940
numthreads = ulength
943941

944942
if numthreads <= 1:

pvlib/tests/test_irradiance.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ def test_get_extra_radiation_epoch_year():
106106
@requires_numba
107107
def test_get_extra_radiation_nrel_numba(times):
108108
with warnings.catch_warnings():
109-
# don't warn on method reload or num threads
109+
# don't warn on method reload
110110
warnings.simplefilter("ignore")
111111
result = irradiance.get_extra_radiation(
112112
times, method='nrel', how='numba', numthreads=4)

pvlib/tests/test_solarposition.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ def test_get_solarposition_deltat(delta_t, method, expected_solpos_multi,
490490
times = pd.date_range(datetime.datetime(2003, 10, 17, 13, 30, 30),
491491
periods=2, freq='D', tz=golden.tz)
492492
with warnings.catch_warnings():
493-
# don't warn on method reload or num threads
493+
# don't warn on method reload
494494
warnings.simplefilter("ignore")
495495
ephem_data = solarposition.get_solarposition(times, golden.latitude,
496496
golden.longitude,
@@ -838,7 +838,7 @@ def test_spa_python_numba_physical(expected_solpos, golden_mst):
838838
times = pd.date_range(datetime.datetime(2003, 10, 17, 12, 30, 30),
839839
periods=1, freq='D', tz=golden_mst.tz)
840840
with warnings.catch_warnings():
841-
# don't warn on method reload or num threads
841+
# don't warn on method reload
842842
# ensure that numpy is the most recently used method so that
843843
# we can use the warns filter below
844844
warnings.simplefilter("ignore")
@@ -865,7 +865,7 @@ def test_spa_python_numba_physical_dst(expected_solpos, golden):
865865
periods=1, freq='D', tz=golden.tz)
866866

867867
with warnings.catch_warnings():
868-
# don't warn on method reload or num threads
868+
# don't warn on method reload
869869
warnings.simplefilter("ignore")
870870
ephem_data = solarposition.spa_python(times, golden.latitude,
871871
golden.longitude, pressure=82000,

pvlib/tests/test_spa.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ def test_topocentric_azimuth_angle(self):
234234

235235
def test_solar_position(self):
236236
with warnings.catch_warnings():
237-
# don't warn on method reload or num threads
237+
# don't warn on method reload
238238
warnings.simplefilter("ignore")
239239
spa_out_0 = self.spa.solar_position(
240240
unixtimes, lat, lon, elev, pressure, temp, delta_t,

0 commit comments

Comments
 (0)