Skip to content

Commit 673ab97

Browse files
authored
Warning message when reloading spa (#618)
* warning message when reloading spa * update whatsnew
1 parent 1ac14bc commit 673ab97

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ Enhancements
4040
* Created :py:func:`pvlib.iotools.read_midc` and :py:func:`pvlib.iotools.read_midc_raw_data_from_nrel`
4141
to read NREL MIDC data. (:issue:`601`)
4242
* Change :py:func:`pvlib.pvsystem.sapm_spectral_loss` to avoid numpy warning.
43+
* Add warning message when :py:func:`pvlib.spa` is reloaded.
4344

4445

4546
Bug fixes

pvlib/solarposition.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
import numpy as np
2323
import pandas as pd
24+
import warnings
2425

2526
from pvlib import atmosphere
2627
from pvlib.tools import datetime_to_djd, djd_to_datetime
@@ -242,12 +243,14 @@ def _spa_python_import(how):
242243
# reload the module without compiling
243244
# the PVLIB_USE_NUMBA env variable is used to tell the module
244245
# to not compile with numba
246+
warnings.warn('Reloading spa to use numpy')
245247
os.environ['PVLIB_USE_NUMBA'] = '0'
246248
spa = reload(spa)
247249
del os.environ['PVLIB_USE_NUMBA']
248250
elif how == 'numba' and not using_numba:
249251
# The spa module was not compiled to numba code, so set
250252
# PVLIB_USE_NUMBA so it does compile to numba on reload.
253+
warnings.warn('Reloading spa to use numba')
251254
os.environ['PVLIB_USE_NUMBA'] = '1'
252255
spa = reload(spa)
253256
del os.environ['PVLIB_USE_NUMBA']

0 commit comments

Comments
 (0)