Skip to content

Commit c0bd414

Browse files
committed
Revert "Make tables a required dependency (pvlib#1287)"
This reverts commit 65782fd.
1 parent c1bbf71 commit c0bd414

File tree

12 files changed

+35
-53
lines changed

12 files changed

+35
-53
lines changed

azure-pipelines.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
vmImage: ubuntu-16.04
1313

1414

15-
- template: ci/azure/posix_no_39.yml
15+
- template: ci/azure/posix.yml
1616
parameters:
1717
name: Test_bare_macOS
1818
vmImage: macOS-10.14

ci/azure/posix_no_39.yml

Lines changed: 0 additions & 39 deletions
This file was deleted.

ci/requirements-py36-min.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ dependencies:
55
- coveralls
66
- nose
77
- pip
8-
- pytables # tables when using pip+PyPI
98
- pytest
109
- pytest-cov
1110
- pytest-mock
@@ -21,4 +20,3 @@ dependencies:
2120
- pytest-rerunfailures # conda version is >3.6
2221
- pytest-remotedata # conda package is 0.3.0, needs > 0.3.1
2322
- requests-mock
24-
- numexpr==2.6.2 # needed for tables, but newest version is not compatible with numpy 1.12

ci/requirements-py36.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ channels:
33
- defaults
44
- conda-forge
55
dependencies:
6-
- blosc=1.14.3 # newest version breaks tables (pytables) on windows
76
- coveralls
87
- cython
98
- ephem

ci/requirements-py37.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ channels:
33
- defaults
44
- conda-forge
55
dependencies:
6-
- blosc=1.14.3 # newest version breaks tables (pytables) on windows
76
- coveralls
87
- cython
98
- ephem

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,8 +232,7 @@ Documentation
232232

233233
Requirements
234234
~~~~~~~~~~~~
235-
* ``dataclasses`` is required for python 3.6 (:pull:`1076`)
236-
* ``tables`` is now required instead of optional (:issue:`1286`, :pull:`1287`)
235+
* ``dataclasses`` is required for python 3.6
237236

238237
Contributors
239238
~~~~~~~~~~~~

pvlib/clearsky.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import pandas as pd
1212
from scipy.optimize import minimize_scalar
1313
from scipy.linalg import hankel
14-
import tables
1514

1615
from pvlib import atmosphere, tools
1716

@@ -187,6 +186,13 @@ def lookup_linke_turbidity(time, latitude, longitude, filepath=None,
187186
# 1st row: 89.9583 S, 2nd row: 89.875 S
188187
# 1st column: 179.9583 W, 2nd column: 179.875 W
189188

189+
try:
190+
import tables
191+
except ImportError:
192+
raise ImportError('The Linke turbidity lookup table requires tables. '
193+
'You can still use clearsky.ineichen if you '
194+
'supply your own turbidities.')
195+
190196
if filepath is None:
191197
pvlib_path = os.path.dirname(os.path.abspath(__file__))
192198
filepath = os.path.join(pvlib_path, 'data', 'LinkeTurbidities.h5')

pvlib/tests/conftest.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,15 @@ def assert_frame_equal(left, right, **kwargs):
105105
not has_statsmodels, reason='requires statsmodels')
106106

107107

108+
try:
109+
import tables
110+
has_tables = True
111+
except ImportError:
112+
has_tables = False
113+
114+
requires_tables = pytest.mark.skipif(not has_tables, reason='requires tables')
115+
116+
108117
try:
109118
import ephem
110119
has_ephem = True

pvlib/tests/test_clearsky.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
from pvlib import atmosphere
1717
from pvlib import irradiance
1818

19-
from .conftest import DATA_DIR
19+
from .conftest import requires_tables, DATA_DIR
2020

2121

2222
def test_ineichen_series():
@@ -189,6 +189,7 @@ def test_ineichen_altitude():
189189
assert_frame_equal(expected, out)
190190

191191

192+
@requires_tables
192193
def test_lookup_linke_turbidity():
193194
times = pd.date_range(start='2014-06-24', end='2014-06-25',
194195
freq='12h', tz='America/Phoenix')
@@ -201,6 +202,7 @@ def test_lookup_linke_turbidity():
201202
assert_series_equal(expected, out)
202203

203204

205+
@requires_tables
204206
def test_lookup_linke_turbidity_leapyear():
205207
times = pd.date_range(start='2016-06-24', end='2016-06-25',
206208
freq='12h', tz='America/Phoenix')
@@ -213,6 +215,7 @@ def test_lookup_linke_turbidity_leapyear():
213215
assert_series_equal(expected, out)
214216

215217

218+
@requires_tables
216219
def test_lookup_linke_turbidity_nointerp():
217220
times = pd.date_range(start='2014-06-24', end='2014-06-25',
218221
freq='12h', tz='America/Phoenix')
@@ -223,6 +226,7 @@ def test_lookup_linke_turbidity_nointerp():
223226
assert_series_equal(expected, out)
224227

225228

229+
@requires_tables
226230
def test_lookup_linke_turbidity_months():
227231
times = pd.date_range(start='2014-04-01', end='2014-07-01',
228232
freq='1M', tz='America/Phoenix')
@@ -233,6 +237,7 @@ def test_lookup_linke_turbidity_months():
233237
assert_series_equal(expected, out)
234238

235239

240+
@requires_tables
236241
def test_lookup_linke_turbidity_months_leapyear():
237242
times = pd.date_range(start='2016-04-01', end='2016-07-01',
238243
freq='1M', tz='America/Phoenix')
@@ -243,6 +248,7 @@ def test_lookup_linke_turbidity_months_leapyear():
243248
assert_series_equal(expected, out)
244249

245250

251+
@requires_tables
246252
def test_lookup_linke_turbidity_nointerp_months():
247253
times = pd.date_range(start='2014-04-10', end='2014-07-10',
248254
freq='1M', tz='America/Phoenix')
@@ -474,6 +480,7 @@ def test_simplified_solis_nans_series():
474480
assert_frame_equal(expected, out)
475481

476482

483+
@requires_tables
477484
def test_linke_turbidity_corners():
478485
"""Test Linke turbidity corners out of bounds."""
479486
months = pd.DatetimeIndex('%d/1/2016' % (m + 1) for m in range(12))

pvlib/tests/test_location.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
from pvlib.location import Location
1616
from pvlib.solarposition import declination_spencer71
1717
from pvlib.solarposition import equation_of_time_spencer71
18-
from .conftest import requires_ephem
18+
from .conftest import requires_ephem, requires_tables
1919

2020

2121
def test_location_required():
@@ -77,6 +77,7 @@ def times():
7777
freq='3H')
7878

7979

80+
@requires_tables
8081
def test_get_clearsky(mocker, times):
8182
tus = Location(32.2, -111, 'US/Arizona', 700, 'Tucson')
8283
m = mocker.spy(pvlib.clearsky, 'ineichen')

0 commit comments

Comments
 (0)