Skip to content

Commit 403f65e

Browse files
authored
Replace tables/pytables with h5py (#1299)
* Revert "Make tables a required dependency (#1287)" This reverts commit 65782fd. * replace tables with h5py * fix pr number * fiddle with 3.6-min yml * fix clearsky.rst * fiddle with whatsnew
1 parent c1bbf71 commit 403f65e

13 files changed

+18
-61
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

benchmarks/asv.conf.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@
119119
"pandas": "0.22.0",
120120
"scipy": "1.2.0",
121121
// Note: these don't have a minimum in setup.py
122-
"pytables": "3.6.1",
122+
"h5py": "2.10.0",
123123
"ephem": "3.7.6.0",
124124
"numba": "0.36.1",
125125
},
@@ -129,7 +129,7 @@
129129
"numpy": "",
130130
"pandas": "",
131131
"scipy": "",
132-
"pytables": "",
132+
"h5py": "",
133133
"ephem": "",
134134
"numba": ""
135135
},

ci/azure/posix_no_39.yml

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

ci/requirements-py36-min.yml

Lines changed: 1 addition & 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
@@ -15,10 +14,10 @@ dependencies:
1514
- requests
1615
- pip:
1716
- dataclasses
17+
- h5py==3.1.0
1818
- numpy==1.12.0
1919
- pandas==0.22.0
2020
- scipy==1.2.0
2121
- pytest-rerunfailures # conda version is >3.6
2222
- pytest-remotedata # conda package is 0.3.0, needs > 0.3.1
2323
- 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: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,16 @@ 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
9+
- h5py
1010
- netcdf4
1111
- nose
1212
- numba
1313
- numpy >= 1.12.0
1414
- pandas >= 0.22.0
1515
- pip
16-
- pytables # tables when using pip+PyPI
1716
- pytest
1817
- pytest-cov
1918
- pytest-mock

ci/requirements-py37.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,16 @@ 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
9+
- h5py
1010
- netcdf4
1111
- nose
1212
- numba
1313
- numpy >= 1.12.0
1414
- pandas >= 0.22.0
1515
- pip
16-
- pytables # tables when using pip+PyPI
1716
- pytest
1817
- pytest-cov
1918
- pytest-mock

ci/requirements-py38.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ dependencies:
66
- coveralls
77
- cython
88
- ephem
9+
- h5py
910
- netcdf4
1011
- nose
1112
- numba
1213
- numpy >= 1.12.0
1314
- pandas >= 0.22.0
1415
- pip
15-
- pytables # tables when using pip+PyPI
1616
- pytest
1717
- pytest-cov
1818
- pytest-mock

ci/requirements-py39.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ dependencies:
66
- coveralls
77
- cython
88
- ephem
9+
- h5py
910
# - netcdf4 # pulls in a different version of numpy with ImportError
1011
- nose
1112
# - numba # python 3.9 compat in early 2021
1213
- numpy >= 1.12.0
1314
- pandas >= 0.22.0
1415
- pip
15-
- pytables # tables when using pip+PyPI
1616
- pytest
1717
- pytest-cov
1818
- pytest-mock

docs/sphinx/source/clearsky.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,16 +132,16 @@ the year. You could run it in a loop to create plots for all months.
132132

133133
In [1]: import os
134134

135-
In [1]: import tables
135+
In [1]: import h5py
136136

137137
In [1]: pvlib_path = os.path.dirname(os.path.abspath(pvlib.clearsky.__file__))
138138

139139
In [1]: filepath = os.path.join(pvlib_path, 'data', 'LinkeTurbidities.h5')
140140

141141
In [1]: def plot_turbidity_map(month, vmin=1, vmax=100):
142142
...: plt.figure();
143-
...: with tables.open_file(filepath) as lt_h5_file:
144-
...: ltdata = lt_h5_file.root.LinkeTurbidity[:, :, month-1]
143+
...: with h5py.File(filepath, 'r') as lt_h5_file:
144+
...: ltdata = lt_h5_file['LinkeTurbidity'][:, :, month-1]
145145
...: plt.imshow(ltdata, vmin=vmin, vmax=vmax);
146146
...: # data is in units of 20 x turbidity
147147
...: plt.title('Linke turbidity x 20, ' + calendar.month_name[month]);

docs/sphinx/source/installation.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,6 @@ A handful of pvlib-python features require additional packages that must
235235
be installed separately using pip or conda. These packages/features
236236
include:
237237

238-
* pytables (tables on PyPI): Linke turbidity look up for clear sky models
239238
* statsmodels: parameter fitting
240239
* numba: fastest solar position calculations
241240
* pyephem: solar positions calculations using an astronomical library

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,8 @@ Documentation
233233
Requirements
234234
~~~~~~~~~~~~
235235
* ``dataclasses`` is required for python 3.6 (:pull:`1076`)
236-
* ``tables`` is now required instead of optional (:issue:`1286`, :pull:`1287`)
236+
* ``h5py`` is now a required dependency. This replaces ``tables``, which was formerly
237+
an optional dependency. (:pull:`1299`, :issue:`1252`, :issue:`1286`)
237238

238239
Contributors
239240
~~~~~~~~~~~~

pvlib/clearsky.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import pandas as pd
1212
from scipy.optimize import minimize_scalar
1313
from scipy.linalg import hankel
14-
import tables
14+
import h5py
1515

1616
from pvlib import atmosphere, tools
1717

@@ -194,9 +194,8 @@ def lookup_linke_turbidity(time, latitude, longitude, filepath=None,
194194
latitude_index = _degrees_to_index(latitude, coordinate='latitude')
195195
longitude_index = _degrees_to_index(longitude, coordinate='longitude')
196196

197-
with tables.open_file(filepath) as lt_h5_file:
198-
lts = lt_h5_file.root.LinkeTurbidity[latitude_index,
199-
longitude_index, :]
197+
with h5py.File(filepath, 'r') as lt_h5_file:
198+
lts = lt_h5_file['LinkeTurbidity'][latitude_index, longitude_index]
200199

201200
if interp_turbidity:
202201
linke_turbidity = _interpolate_turbidity(lts, time)

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
'pytz',
4444
'requests',
4545
'scipy >= 1.2.0',
46-
'tables']
46+
'h5py']
4747

4848
# include dataclasses as a dependency only on python 3.6
4949
if sys.version_info.major == 3 and sys.version_info.minor == 6:
@@ -58,7 +58,7 @@
5858
'cftime >= 1.1.1'],
5959
'doc': ['ipython', 'matplotlib', 'sphinx == 3.1.2',
6060
'sphinx_rtd_theme==0.5.0', 'sphinx-gallery', 'docutils == 0.15.2',
61-
'pillow', 'netcdf4', 'siphon', 'tables',
61+
'pillow', 'netcdf4', 'siphon',
6262
'sphinx-toggleprompt >= 0.0.5'],
6363
'test': TESTS_REQUIRE
6464
}

0 commit comments

Comments
 (0)