Skip to content

Commit 1044ec7

Browse files
committed
optimize numba/numpy reloads and warnings
1 parent 56646a6 commit 1044ec7

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

pvlib/tests/test_solarposition.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -478,12 +478,13 @@ def test_get_solarposition_altitude(
478478

479479

480480
@pytest.mark.parametrize("delta_t, method", [
481-
(None, 'nrel_numpy'),
482481
(None, 'nrel_numba'),
483482
(67.0, 'nrel_numba'),
483+
(np.array([67.0, 67.0]), 'nrel_numba'),
484+
# minimize reloads, with numpy being last
485+
(None, 'nrel_numpy'),
484486
(67.0, 'nrel_numpy'),
485487
(np.array([67.0, 67.0]), 'nrel_numpy'),
486-
(np.array([67.0, 67.0]), 'nrel_numba'),
487488
])
488489
def test_get_solarposition_deltat(delta_t, method, expected_solpos_multi,
489490
golden):
@@ -770,14 +771,14 @@ def test__datetime_to_unixtime_units(unit, tz):
770771

771772

772773
@requires_pandas_2_0
774+
@pytest.mark.parametrize('tz', [None, 'utc', 'US/Eastern'])
773775
@pytest.mark.parametrize('method', [
774776
'nrel_numpy',
775777
'ephemeris',
776778
pytest.param('pyephem', marks=requires_ephem),
777779
pytest.param('nrel_numba', marks=requires_numba),
778780
pytest.param('nrel_c', marks=requires_spa_c),
779781
])
780-
@pytest.mark.parametrize('tz', [None, 'utc', 'US/Eastern'])
781782
def test_get_solarposition_microsecond_index(method, tz):
782783
# https://github.com/pvlib/pvlib-python/issues/1932
783784

@@ -786,8 +787,12 @@ def test_get_solarposition_microsecond_index(method, tz):
786787
index_ns = pd.date_range(unit='ns', **kwargs)
787788
index_us = pd.date_range(unit='us', **kwargs)
788789

789-
sp_ns = solarposition.get_solarposition(index_ns, 40, -80, method=method)
790-
sp_us = solarposition.get_solarposition(index_us, 40, -80, method=method)
790+
with warnings.catch_warnings():
791+
# don't warn on method reload
792+
warnings.simplefilter("ignore")
793+
794+
sp_ns = solarposition.get_solarposition(index_ns, 40, -80, method=method)
795+
sp_us = solarposition.get_solarposition(index_us, 40, -80, method=method)
791796

792797
assert_frame_equal(sp_ns, sp_us, check_index_type=False)
793798

0 commit comments

Comments
 (0)