diff --git a/azure-pipelines.yml b/azure-pipelines.yml index ec594f152b..005f3fa3c6 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -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 diff --git a/benchmarks/asv.conf.json b/benchmarks/asv.conf.json index 211d5f7609..d82365b2c7 100644 --- a/benchmarks/asv.conf.json +++ b/benchmarks/asv.conf.json @@ -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", }, @@ -129,7 +129,7 @@ "numpy": "", "pandas": "", "scipy": "", - "pytables": "", + "h5py": "", "ephem": "", "numba": "" }, diff --git a/ci/azure/posix_no_39.yml b/ci/azure/posix_no_39.yml deleted file mode 100644 index 16966cebef..0000000000 --- a/ci/azure/posix_no_39.yml +++ /dev/null @@ -1,39 +0,0 @@ -parameters: - name: '' - vmImage: '' - -jobs: -- job: ${{ parameters.name }} - pool: - vmImage: ${{ parameters.vmImage }} - strategy: - matrix: - Python36: - python.version: '3.6' - Python37: - python.version: '3.7' - Python38: - python.version: '3.8' - - steps: - - task: UsePythonVersion@0 - inputs: - versionSpec: '$(python.version)' - - - script: | - pip install pytest pytest-cov pytest-mock requests-mock pytest-timeout pytest-azurepipelines pytest-rerunfailures pytest-remotedata - pip install -e . - pytest pvlib --junitxml=junit/test-results.xml --cov=com --cov-report=xml --cov-report=html - displayName: 'Test with pytest' - - - task: PublishTestResults@2 - condition: succeededOrFailed() - inputs: - testResultsFiles: '**/test-*.xml' - testRunTitle: 'Publish test results for Python $(python.version)' - - - task: PublishCodeCoverageResults@1 - inputs: - codeCoverageTool: Cobertura - summaryFileLocation: '$(System.DefaultWorkingDirectory)/**/coverage.xml' - reportDirectory: '$(System.DefaultWorkingDirectory)/**/htmlcov' diff --git a/ci/requirements-py36-min.yml b/ci/requirements-py36-min.yml index efcb166e68..e605e53584 100644 --- a/ci/requirements-py36-min.yml +++ b/ci/requirements-py36-min.yml @@ -5,7 +5,6 @@ dependencies: - coveralls - nose - pip - - pytables # tables when using pip+PyPI - pytest - pytest-cov - pytest-mock @@ -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 \ No newline at end of file diff --git a/ci/requirements-py36.yml b/ci/requirements-py36.yml index 9cef821b3b..222ea92d99 100644 --- a/ci/requirements-py36.yml +++ b/ci/requirements-py36.yml @@ -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 diff --git a/ci/requirements-py37.yml b/ci/requirements-py37.yml index 598f2dcdf7..83db4b7f49 100644 --- a/ci/requirements-py37.yml +++ b/ci/requirements-py37.yml @@ -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 diff --git a/ci/requirements-py38.yml b/ci/requirements-py38.yml index ca3a968335..8fecb52197 100644 --- a/ci/requirements-py38.yml +++ b/ci/requirements-py38.yml @@ -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 diff --git a/ci/requirements-py39.yml b/ci/requirements-py39.yml index 16c6449158..d1283b489e 100644 --- a/ci/requirements-py39.yml +++ b/ci/requirements-py39.yml @@ -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 diff --git a/docs/sphinx/source/clearsky.rst b/docs/sphinx/source/clearsky.rst index 669ca07ca0..6e51981e95 100644 --- a/docs/sphinx/source/clearsky.rst +++ b/docs/sphinx/source/clearsky.rst @@ -132,7 +132,7 @@ 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__)) @@ -140,8 +140,8 @@ the year. You could run it in a loop to create plots for all months. 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]); diff --git a/docs/sphinx/source/installation.rst b/docs/sphinx/source/installation.rst index 39b7bfc974..2724a4adcf 100644 --- a/docs/sphinx/source/installation.rst +++ b/docs/sphinx/source/installation.rst @@ -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 diff --git a/docs/sphinx/source/whatsnew/v0.9.0.rst b/docs/sphinx/source/whatsnew/v0.9.0.rst index 0ae268d416..53403a6650 100644 --- a/docs/sphinx/source/whatsnew/v0.9.0.rst +++ b/docs/sphinx/source/whatsnew/v0.9.0.rst @@ -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 ~~~~~~~~~~~~ diff --git a/pvlib/clearsky.py b/pvlib/clearsky.py index 0368912c81..d29601038a 100644 --- a/pvlib/clearsky.py +++ b/pvlib/clearsky.py @@ -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 @@ -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) diff --git a/setup.py b/setup.py index 6dd1242744..0717a9d839 100755 --- a/setup.py +++ b/setup.py @@ -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: @@ -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 }