Skip to content

Replace tables/pytables with h5py #1299

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Aug 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
vmImage: ubuntu-16.04


- template: ci/azure/posix_no_39.yml
- template: ci/azure/posix.yml
parameters:
name: Test_bare_macOS
vmImage: macOS-10.14
Expand Down
4 changes: 2 additions & 2 deletions benchmarks/asv.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
"pandas": "0.22.0",
"scipy": "1.2.0",
// Note: these don't have a minimum in setup.py
"pytables": "3.6.1",
"h5py": "2.10.0",
"ephem": "3.7.6.0",
"numba": "0.36.1",
},
Expand All @@ -129,7 +129,7 @@
"numpy": "",
"pandas": "",
"scipy": "",
"pytables": "",
"h5py": "",
"ephem": "",
"numba": ""
},
Expand Down
39 changes: 0 additions & 39 deletions ci/azure/posix_no_39.yml

This file was deleted.

3 changes: 1 addition & 2 deletions ci/requirements-py36-min.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ dependencies:
- coveralls
- nose
- pip
- pytables # tables when using pip+PyPI
- pytest
- pytest-cov
- pytest-mock
Expand All @@ -15,10 +14,10 @@ dependencies:
- requests
- pip:
- dataclasses
- h5py==3.1.0
- numpy==1.12.0
- pandas==0.22.0
- scipy==1.2.0
- pytest-rerunfailures # conda version is >3.6
- pytest-remotedata # conda package is 0.3.0, needs > 0.3.1
- requests-mock
- numexpr==2.6.2 # needed for tables, but newest version is not compatible with numpy 1.12
3 changes: 1 addition & 2 deletions ci/requirements-py36.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,16 @@ channels:
- defaults
- conda-forge
dependencies:
- blosc=1.14.3 # newest version breaks tables (pytables) on windows
- coveralls
- cython
- ephem
- h5py
- netcdf4
- nose
- numba
- numpy >= 1.12.0
- pandas >= 0.22.0
- pip
- pytables # tables when using pip+PyPI
- pytest
- pytest-cov
- pytest-mock
Expand Down
3 changes: 1 addition & 2 deletions ci/requirements-py37.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,16 @@ channels:
- defaults
- conda-forge
dependencies:
- blosc=1.14.3 # newest version breaks tables (pytables) on windows
- coveralls
- cython
- ephem
- h5py
- netcdf4
- nose
- numba
- numpy >= 1.12.0
- pandas >= 0.22.0
- pip
- pytables # tables when using pip+PyPI
- pytest
- pytest-cov
- pytest-mock
Expand Down
2 changes: 1 addition & 1 deletion ci/requirements-py38.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ dependencies:
- coveralls
- cython
- ephem
- h5py
- netcdf4
- nose
- numba
- numpy >= 1.12.0
- pandas >= 0.22.0
- pip
- pytables # tables when using pip+PyPI
- pytest
- pytest-cov
- pytest-mock
Expand Down
2 changes: 1 addition & 1 deletion ci/requirements-py39.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ dependencies:
- coveralls
- cython
- ephem
- h5py
# - netcdf4 # pulls in a different version of numpy with ImportError
- nose
# - numba # python 3.9 compat in early 2021
- numpy >= 1.12.0
- pandas >= 0.22.0
- pip
- pytables # tables when using pip+PyPI
- pytest
- pytest-cov
- pytest-mock
Expand Down
6 changes: 3 additions & 3 deletions docs/sphinx/source/clearsky.rst
Original file line number Diff line number Diff line change
Expand Up @@ -132,16 +132,16 @@ the year. You could run it in a loop to create plots for all months.

In [1]: import os

In [1]: import tables
In [1]: import h5py

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

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

In [1]: def plot_turbidity_map(month, vmin=1, vmax=100):
...: plt.figure();
...: with tables.open_file(filepath) as lt_h5_file:
...: ltdata = lt_h5_file.root.LinkeTurbidity[:, :, month-1]
...: with h5py.File(filepath, 'r') as lt_h5_file:
...: ltdata = lt_h5_file['LinkeTurbidity'][:, :, month-1]
...: plt.imshow(ltdata, vmin=vmin, vmax=vmax);
...: # data is in units of 20 x turbidity
...: plt.title('Linke turbidity x 20, ' + calendar.month_name[month]);
Expand Down
1 change: 0 additions & 1 deletion docs/sphinx/source/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,6 @@ A handful of pvlib-python features require additional packages that must
be installed separately using pip or conda. These packages/features
include:

* pytables (tables on PyPI): Linke turbidity look up for clear sky models
* statsmodels: parameter fitting
* numba: fastest solar position calculations
* pyephem: solar positions calculations using an astronomical library
Expand Down
3 changes: 2 additions & 1 deletion docs/sphinx/source/whatsnew/v0.9.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,8 @@ Documentation
Requirements
~~~~~~~~~~~~
* ``dataclasses`` is required for python 3.6 (:pull:`1076`)
* ``tables`` is now required instead of optional (:issue:`1286`, :pull:`1287`)
* ``h5py`` is now a required dependency. This replaces ``tables``, which was formerly
an optional dependency. (:pull:`1299`, :issue:`1252`, :issue:`1286`)

Contributors
~~~~~~~~~~~~
Expand Down
7 changes: 3 additions & 4 deletions pvlib/clearsky.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import pandas as pd
from scipy.optimize import minimize_scalar
from scipy.linalg import hankel
import tables
import h5py

from pvlib import atmosphere, tools

Expand Down Expand Up @@ -194,9 +194,8 @@ def lookup_linke_turbidity(time, latitude, longitude, filepath=None,
latitude_index = _degrees_to_index(latitude, coordinate='latitude')
longitude_index = _degrees_to_index(longitude, coordinate='longitude')

with tables.open_file(filepath) as lt_h5_file:
lts = lt_h5_file.root.LinkeTurbidity[latitude_index,
longitude_index, :]
with h5py.File(filepath, 'r') as lt_h5_file:
lts = lt_h5_file['LinkeTurbidity'][latitude_index, longitude_index]

if interp_turbidity:
linke_turbidity = _interpolate_turbidity(lts, time)
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
'pytz',
'requests',
'scipy >= 1.2.0',
'tables']
'h5py']

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