From c0bd41441134bf4130ae291e5256e5d84a04e14d Mon Sep 17 00:00:00 2001 From: Kevin Anderson Date: Sun, 29 Aug 2021 09:23:05 -0600 Subject: [PATCH 1/6] Revert "Make tables a required dependency (#1287)" This reverts commit 65782fdf24c96cc092329942e29904e78b0b3cce. --- azure-pipelines.yml | 2 +- ci/azure/posix_no_39.yml | 39 -------------------------- ci/requirements-py36-min.yml | 2 -- ci/requirements-py36.yml | 1 - ci/requirements-py37.yml | 1 - docs/sphinx/source/whatsnew/v0.9.0.rst | 3 +- pvlib/clearsky.py | 8 +++++- pvlib/tests/conftest.py | 9 ++++++ pvlib/tests/test_clearsky.py | 9 +++++- pvlib/tests/test_location.py | 3 +- pvlib/tests/test_modelchain.py | 6 +++- setup.py | 5 ++-- 12 files changed, 35 insertions(+), 53 deletions(-) delete mode 100644 ci/azure/posix_no_39.yml 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/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..84adcb360d 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 @@ -21,4 +20,3 @@ dependencies: - 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..c49455119f 100644 --- a/ci/requirements-py36.yml +++ b/ci/requirements-py36.yml @@ -3,7 +3,6 @@ channels: - defaults - conda-forge dependencies: - - blosc=1.14.3 # newest version breaks tables (pytables) on windows - coveralls - cython - ephem diff --git a/ci/requirements-py37.yml b/ci/requirements-py37.yml index 598f2dcdf7..3203b004d1 100644 --- a/ci/requirements-py37.yml +++ b/ci/requirements-py37.yml @@ -3,7 +3,6 @@ channels: - defaults - conda-forge dependencies: - - blosc=1.14.3 # newest version breaks tables (pytables) on windows - coveralls - cython - ephem diff --git a/docs/sphinx/source/whatsnew/v0.9.0.rst b/docs/sphinx/source/whatsnew/v0.9.0.rst index 0ae268d416..0fb7b9242f 100644 --- a/docs/sphinx/source/whatsnew/v0.9.0.rst +++ b/docs/sphinx/source/whatsnew/v0.9.0.rst @@ -232,8 +232,7 @@ Documentation Requirements ~~~~~~~~~~~~ -* ``dataclasses`` is required for python 3.6 (:pull:`1076`) -* ``tables`` is now required instead of optional (:issue:`1286`, :pull:`1287`) +* ``dataclasses`` is required for python 3.6 Contributors ~~~~~~~~~~~~ diff --git a/pvlib/clearsky.py b/pvlib/clearsky.py index 0368912c81..9d635d0bf8 100644 --- a/pvlib/clearsky.py +++ b/pvlib/clearsky.py @@ -11,7 +11,6 @@ import pandas as pd from scipy.optimize import minimize_scalar from scipy.linalg import hankel -import tables from pvlib import atmosphere, tools @@ -187,6 +186,13 @@ def lookup_linke_turbidity(time, latitude, longitude, filepath=None, # 1st row: 89.9583 S, 2nd row: 89.875 S # 1st column: 179.9583 W, 2nd column: 179.875 W + try: + import tables + except ImportError: + raise ImportError('The Linke turbidity lookup table requires tables. ' + 'You can still use clearsky.ineichen if you ' + 'supply your own turbidities.') + if filepath is None: pvlib_path = os.path.dirname(os.path.abspath(__file__)) filepath = os.path.join(pvlib_path, 'data', 'LinkeTurbidities.h5') diff --git a/pvlib/tests/conftest.py b/pvlib/tests/conftest.py index b3e9fcd5a1..a3cba1e7b8 100644 --- a/pvlib/tests/conftest.py +++ b/pvlib/tests/conftest.py @@ -105,6 +105,15 @@ def assert_frame_equal(left, right, **kwargs): not has_statsmodels, reason='requires statsmodels') +try: + import tables + has_tables = True +except ImportError: + has_tables = False + +requires_tables = pytest.mark.skipif(not has_tables, reason='requires tables') + + try: import ephem has_ephem = True diff --git a/pvlib/tests/test_clearsky.py b/pvlib/tests/test_clearsky.py index 15fc74e383..1e7d89d82d 100644 --- a/pvlib/tests/test_clearsky.py +++ b/pvlib/tests/test_clearsky.py @@ -16,7 +16,7 @@ from pvlib import atmosphere from pvlib import irradiance -from .conftest import DATA_DIR +from .conftest import requires_tables, DATA_DIR def test_ineichen_series(): @@ -189,6 +189,7 @@ def test_ineichen_altitude(): assert_frame_equal(expected, out) +@requires_tables def test_lookup_linke_turbidity(): times = pd.date_range(start='2014-06-24', end='2014-06-25', freq='12h', tz='America/Phoenix') @@ -201,6 +202,7 @@ def test_lookup_linke_turbidity(): assert_series_equal(expected, out) +@requires_tables def test_lookup_linke_turbidity_leapyear(): times = pd.date_range(start='2016-06-24', end='2016-06-25', freq='12h', tz='America/Phoenix') @@ -213,6 +215,7 @@ def test_lookup_linke_turbidity_leapyear(): assert_series_equal(expected, out) +@requires_tables def test_lookup_linke_turbidity_nointerp(): times = pd.date_range(start='2014-06-24', end='2014-06-25', freq='12h', tz='America/Phoenix') @@ -223,6 +226,7 @@ def test_lookup_linke_turbidity_nointerp(): assert_series_equal(expected, out) +@requires_tables def test_lookup_linke_turbidity_months(): times = pd.date_range(start='2014-04-01', end='2014-07-01', freq='1M', tz='America/Phoenix') @@ -233,6 +237,7 @@ def test_lookup_linke_turbidity_months(): assert_series_equal(expected, out) +@requires_tables def test_lookup_linke_turbidity_months_leapyear(): times = pd.date_range(start='2016-04-01', end='2016-07-01', freq='1M', tz='America/Phoenix') @@ -243,6 +248,7 @@ def test_lookup_linke_turbidity_months_leapyear(): assert_series_equal(expected, out) +@requires_tables def test_lookup_linke_turbidity_nointerp_months(): times = pd.date_range(start='2014-04-10', end='2014-07-10', freq='1M', tz='America/Phoenix') @@ -474,6 +480,7 @@ def test_simplified_solis_nans_series(): assert_frame_equal(expected, out) +@requires_tables def test_linke_turbidity_corners(): """Test Linke turbidity corners out of bounds.""" months = pd.DatetimeIndex('%d/1/2016' % (m + 1) for m in range(12)) diff --git a/pvlib/tests/test_location.py b/pvlib/tests/test_location.py index a4b69e5cb2..20a849a667 100644 --- a/pvlib/tests/test_location.py +++ b/pvlib/tests/test_location.py @@ -15,7 +15,7 @@ from pvlib.location import Location from pvlib.solarposition import declination_spencer71 from pvlib.solarposition import equation_of_time_spencer71 -from .conftest import requires_ephem +from .conftest import requires_ephem, requires_tables def test_location_required(): @@ -77,6 +77,7 @@ def times(): freq='3H') +@requires_tables def test_get_clearsky(mocker, times): tus = Location(32.2, -111, 'US/Arizona', 700, 'Tucson') m = mocker.spy(pvlib.clearsky, 'ineichen') diff --git a/pvlib/tests/test_modelchain.py b/pvlib/tests/test_modelchain.py index b42acfa54e..86b7411d0f 100644 --- a/pvlib/tests/test_modelchain.py +++ b/pvlib/tests/test_modelchain.py @@ -13,7 +13,7 @@ from .conftest import assert_series_equal, assert_frame_equal import pytest -from .conftest import fail_on_pvlib_version +from .conftest import fail_on_pvlib_version, requires_tables @pytest.fixture(scope='function') @@ -1788,6 +1788,7 @@ def test_ModelChain_attributes_deprecated_10(sapm_dc_snl_ac_system, location): mc.aoi = 5 +@requires_tables def test_basic_chain_alt_az(sam_data, cec_inverter_parameters, sapm_temperature_cs5p_220m): times = pd.date_range(start='20160101 1200-0700', @@ -1809,6 +1810,7 @@ def test_basic_chain_alt_az(sam_data, cec_inverter_parameters, assert_series_equal(ac, expected) +@requires_tables def test_basic_chain_altitude_pressure(sam_data, cec_inverter_parameters, sapm_temperature_cs5p_220m): times = pd.date_range(start='20160101 1200-0700', @@ -1859,6 +1861,7 @@ def test_complete_irradiance_clean_run(sapm_dc_snl_ac_system, location): pd.Series([9, 5], index=times, name='ghi')) +@requires_tables def test_complete_irradiance(sapm_dc_snl_ac_system, location): """Check calculations""" mc = ModelChain(sapm_dc_snl_ac_system, location) @@ -1887,6 +1890,7 @@ def test_complete_irradiance(sapm_dc_snl_ac_system, location): @pytest.mark.filterwarnings("ignore:This function is not safe at the moment") @pytest.mark.parametrize("input_type", [tuple, list]) +@requires_tables def test_complete_irradiance_arrays( sapm_dc_snl_ac_system_same_arrays, location, input_type): """ModelChain.complete_irradiance can accept a tuple of weather diff --git a/setup.py b/setup.py index 6dd1242744..216dc34a28 100755 --- a/setup.py +++ b/setup.py @@ -42,8 +42,7 @@ 'pandas >= 0.22.0', 'pytz', 'requests', - 'scipy >= 1.2.0', - 'tables'] + 'scipy >= 1.2.0'] # include dataclasses as a dependency only on python 3.6 if sys.version_info.major == 3 and sys.version_info.minor == 6: @@ -54,7 +53,7 @@ 'pytest-remotedata'] EXTRAS_REQUIRE = { 'optional': ['cython', 'ephem', 'netcdf4', 'nrel-pysam', 'numba', - 'pvfactors', 'siphon', 'statsmodels', + 'pvfactors', 'siphon', 'statsmodels', 'tables', 'cftime >= 1.1.1'], 'doc': ['ipython', 'matplotlib', 'sphinx == 3.1.2', 'sphinx_rtd_theme==0.5.0', 'sphinx-gallery', 'docutils == 0.15.2', From 1f7109d9061f3ddcf9b3578378fade49c2fb8921 Mon Sep 17 00:00:00 2001 From: Kevin Anderson Date: Sun, 29 Aug 2021 09:44:30 -0600 Subject: [PATCH 2/6] replace tables with h5py --- benchmarks/asv.conf.json | 4 ++-- ci/requirements-py36-min.yml | 1 + ci/requirements-py36.yml | 2 +- ci/requirements-py37.yml | 2 +- ci/requirements-py38.yml | 2 +- ci/requirements-py39.yml | 2 +- docs/sphinx/source/clearsky.rst | 6 +++--- docs/sphinx/source/installation.rst | 1 - docs/sphinx/source/whatsnew/v0.9.0.rst | 4 +++- pvlib/clearsky.py | 13 +++---------- pvlib/tests/conftest.py | 9 --------- pvlib/tests/test_clearsky.py | 9 +-------- pvlib/tests/test_location.py | 3 +-- pvlib/tests/test_modelchain.py | 6 +----- setup.py | 7 ++++--- 15 files changed, 23 insertions(+), 48 deletions(-) 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/requirements-py36-min.yml b/ci/requirements-py36-min.yml index 84adcb360d..031b2e8f60 100644 --- a/ci/requirements-py36-min.yml +++ b/ci/requirements-py36-min.yml @@ -3,6 +3,7 @@ channels: - defaults dependencies: - coveralls + - h5py - nose - pip - pytest diff --git a/ci/requirements-py36.yml b/ci/requirements-py36.yml index c49455119f..222ea92d99 100644 --- a/ci/requirements-py36.yml +++ b/ci/requirements-py36.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-py37.yml b/ci/requirements-py37.yml index 3203b004d1..83db4b7f49 100644 --- a/ci/requirements-py37.yml +++ b/ci/requirements-py37.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-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..67d3e50833 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 0fb7b9242f..ecf8e537ec 100644 --- a/docs/sphinx/source/whatsnew/v0.9.0.rst +++ b/docs/sphinx/source/whatsnew/v0.9.0.rst @@ -232,7 +232,9 @@ Documentation Requirements ~~~~~~~~~~~~ -* ``dataclasses`` is required for python 3.6 +* ``dataclasses`` is required for python 3.6 (:pull:`1076`) +* ``h5py`` is now a required dependency. This replaces ``tables``, which was formerly + an optional dependency. (:pull:`1297`) Contributors ~~~~~~~~~~~~ diff --git a/pvlib/clearsky.py b/pvlib/clearsky.py index 9d635d0bf8..d29601038a 100644 --- a/pvlib/clearsky.py +++ b/pvlib/clearsky.py @@ -11,6 +11,7 @@ import pandas as pd from scipy.optimize import minimize_scalar from scipy.linalg import hankel +import h5py from pvlib import atmosphere, tools @@ -186,13 +187,6 @@ def lookup_linke_turbidity(time, latitude, longitude, filepath=None, # 1st row: 89.9583 S, 2nd row: 89.875 S # 1st column: 179.9583 W, 2nd column: 179.875 W - try: - import tables - except ImportError: - raise ImportError('The Linke turbidity lookup table requires tables. ' - 'You can still use clearsky.ineichen if you ' - 'supply your own turbidities.') - if filepath is None: pvlib_path = os.path.dirname(os.path.abspath(__file__)) filepath = os.path.join(pvlib_path, 'data', 'LinkeTurbidities.h5') @@ -200,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/pvlib/tests/conftest.py b/pvlib/tests/conftest.py index a3cba1e7b8..b3e9fcd5a1 100644 --- a/pvlib/tests/conftest.py +++ b/pvlib/tests/conftest.py @@ -105,15 +105,6 @@ def assert_frame_equal(left, right, **kwargs): not has_statsmodels, reason='requires statsmodels') -try: - import tables - has_tables = True -except ImportError: - has_tables = False - -requires_tables = pytest.mark.skipif(not has_tables, reason='requires tables') - - try: import ephem has_ephem = True diff --git a/pvlib/tests/test_clearsky.py b/pvlib/tests/test_clearsky.py index 1e7d89d82d..15fc74e383 100644 --- a/pvlib/tests/test_clearsky.py +++ b/pvlib/tests/test_clearsky.py @@ -16,7 +16,7 @@ from pvlib import atmosphere from pvlib import irradiance -from .conftest import requires_tables, DATA_DIR +from .conftest import DATA_DIR def test_ineichen_series(): @@ -189,7 +189,6 @@ def test_ineichen_altitude(): assert_frame_equal(expected, out) -@requires_tables def test_lookup_linke_turbidity(): times = pd.date_range(start='2014-06-24', end='2014-06-25', freq='12h', tz='America/Phoenix') @@ -202,7 +201,6 @@ def test_lookup_linke_turbidity(): assert_series_equal(expected, out) -@requires_tables def test_lookup_linke_turbidity_leapyear(): times = pd.date_range(start='2016-06-24', end='2016-06-25', freq='12h', tz='America/Phoenix') @@ -215,7 +213,6 @@ def test_lookup_linke_turbidity_leapyear(): assert_series_equal(expected, out) -@requires_tables def test_lookup_linke_turbidity_nointerp(): times = pd.date_range(start='2014-06-24', end='2014-06-25', freq='12h', tz='America/Phoenix') @@ -226,7 +223,6 @@ def test_lookup_linke_turbidity_nointerp(): assert_series_equal(expected, out) -@requires_tables def test_lookup_linke_turbidity_months(): times = pd.date_range(start='2014-04-01', end='2014-07-01', freq='1M', tz='America/Phoenix') @@ -237,7 +233,6 @@ def test_lookup_linke_turbidity_months(): assert_series_equal(expected, out) -@requires_tables def test_lookup_linke_turbidity_months_leapyear(): times = pd.date_range(start='2016-04-01', end='2016-07-01', freq='1M', tz='America/Phoenix') @@ -248,7 +243,6 @@ def test_lookup_linke_turbidity_months_leapyear(): assert_series_equal(expected, out) -@requires_tables def test_lookup_linke_turbidity_nointerp_months(): times = pd.date_range(start='2014-04-10', end='2014-07-10', freq='1M', tz='America/Phoenix') @@ -480,7 +474,6 @@ def test_simplified_solis_nans_series(): assert_frame_equal(expected, out) -@requires_tables def test_linke_turbidity_corners(): """Test Linke turbidity corners out of bounds.""" months = pd.DatetimeIndex('%d/1/2016' % (m + 1) for m in range(12)) diff --git a/pvlib/tests/test_location.py b/pvlib/tests/test_location.py index 20a849a667..a4b69e5cb2 100644 --- a/pvlib/tests/test_location.py +++ b/pvlib/tests/test_location.py @@ -15,7 +15,7 @@ from pvlib.location import Location from pvlib.solarposition import declination_spencer71 from pvlib.solarposition import equation_of_time_spencer71 -from .conftest import requires_ephem, requires_tables +from .conftest import requires_ephem def test_location_required(): @@ -77,7 +77,6 @@ def times(): freq='3H') -@requires_tables def test_get_clearsky(mocker, times): tus = Location(32.2, -111, 'US/Arizona', 700, 'Tucson') m = mocker.spy(pvlib.clearsky, 'ineichen') diff --git a/pvlib/tests/test_modelchain.py b/pvlib/tests/test_modelchain.py index 86b7411d0f..b42acfa54e 100644 --- a/pvlib/tests/test_modelchain.py +++ b/pvlib/tests/test_modelchain.py @@ -13,7 +13,7 @@ from .conftest import assert_series_equal, assert_frame_equal import pytest -from .conftest import fail_on_pvlib_version, requires_tables +from .conftest import fail_on_pvlib_version @pytest.fixture(scope='function') @@ -1788,7 +1788,6 @@ def test_ModelChain_attributes_deprecated_10(sapm_dc_snl_ac_system, location): mc.aoi = 5 -@requires_tables def test_basic_chain_alt_az(sam_data, cec_inverter_parameters, sapm_temperature_cs5p_220m): times = pd.date_range(start='20160101 1200-0700', @@ -1810,7 +1809,6 @@ def test_basic_chain_alt_az(sam_data, cec_inverter_parameters, assert_series_equal(ac, expected) -@requires_tables def test_basic_chain_altitude_pressure(sam_data, cec_inverter_parameters, sapm_temperature_cs5p_220m): times = pd.date_range(start='20160101 1200-0700', @@ -1861,7 +1859,6 @@ def test_complete_irradiance_clean_run(sapm_dc_snl_ac_system, location): pd.Series([9, 5], index=times, name='ghi')) -@requires_tables def test_complete_irradiance(sapm_dc_snl_ac_system, location): """Check calculations""" mc = ModelChain(sapm_dc_snl_ac_system, location) @@ -1890,7 +1887,6 @@ def test_complete_irradiance(sapm_dc_snl_ac_system, location): @pytest.mark.filterwarnings("ignore:This function is not safe at the moment") @pytest.mark.parametrize("input_type", [tuple, list]) -@requires_tables def test_complete_irradiance_arrays( sapm_dc_snl_ac_system_same_arrays, location, input_type): """ModelChain.complete_irradiance can accept a tuple of weather diff --git a/setup.py b/setup.py index 216dc34a28..0717a9d839 100755 --- a/setup.py +++ b/setup.py @@ -42,7 +42,8 @@ 'pandas >= 0.22.0', 'pytz', 'requests', - 'scipy >= 1.2.0'] + 'scipy >= 1.2.0', + 'h5py'] # include dataclasses as a dependency only on python 3.6 if sys.version_info.major == 3 and sys.version_info.minor == 6: @@ -53,11 +54,11 @@ 'pytest-remotedata'] EXTRAS_REQUIRE = { 'optional': ['cython', 'ephem', 'netcdf4', 'nrel-pysam', 'numba', - 'pvfactors', 'siphon', 'statsmodels', 'tables', + 'pvfactors', 'siphon', 'statsmodels', '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 } From cc8635adb6caf7e9abdb03cbd6fd36e030c733c5 Mon Sep 17 00:00:00 2001 From: Kevin Anderson Date: Sun, 29 Aug 2021 09:48:10 -0600 Subject: [PATCH 3/6] fix pr number --- docs/sphinx/source/whatsnew/v0.9.0.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sphinx/source/whatsnew/v0.9.0.rst b/docs/sphinx/source/whatsnew/v0.9.0.rst index ecf8e537ec..0e05d23cd4 100644 --- a/docs/sphinx/source/whatsnew/v0.9.0.rst +++ b/docs/sphinx/source/whatsnew/v0.9.0.rst @@ -234,7 +234,7 @@ Requirements ~~~~~~~~~~~~ * ``dataclasses`` is required for python 3.6 (:pull:`1076`) * ``h5py`` is now a required dependency. This replaces ``tables``, which was formerly - an optional dependency. (:pull:`1297`) + an optional dependency. (:pull:`1299`) Contributors ~~~~~~~~~~~~ From cdc7b829a0d781b0fa23cdfafc0427bfc982ab09 Mon Sep 17 00:00:00 2001 From: Kevin Anderson Date: Sun, 29 Aug 2021 10:04:04 -0600 Subject: [PATCH 4/6] fiddle with 3.6-min yml --- ci/requirements-py36-min.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/requirements-py36-min.yml b/ci/requirements-py36-min.yml index 031b2e8f60..e605e53584 100644 --- a/ci/requirements-py36-min.yml +++ b/ci/requirements-py36-min.yml @@ -3,7 +3,6 @@ channels: - defaults dependencies: - coveralls - - h5py - nose - pip - pytest @@ -15,6 +14,7 @@ dependencies: - requests - pip: - dataclasses + - h5py==3.1.0 - numpy==1.12.0 - pandas==0.22.0 - scipy==1.2.0 From bb6912ad535c0a814c4aa5cb1c92d5d7206e8b0c Mon Sep 17 00:00:00 2001 From: Kevin Anderson Date: Sun, 29 Aug 2021 10:07:14 -0600 Subject: [PATCH 5/6] fix clearsky.rst --- docs/sphinx/source/clearsky.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sphinx/source/clearsky.rst b/docs/sphinx/source/clearsky.rst index 67d3e50833..6e51981e95 100644 --- a/docs/sphinx/source/clearsky.rst +++ b/docs/sphinx/source/clearsky.rst @@ -141,7 +141,7 @@ 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 h5py.File(filepath, 'r') as lt_h5_file: - ltdata = lt_h5_file['LinkeTurbidity'][:, :, month-1] + ...: 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]); From 3dc9d7ba9fddd11265f0aa58920807d7e8ebd169 Mon Sep 17 00:00:00 2001 From: Kevin Anderson Date: Sun, 29 Aug 2021 10:23:52 -0600 Subject: [PATCH 6/6] fiddle with whatsnew --- docs/sphinx/source/whatsnew/v0.9.0.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sphinx/source/whatsnew/v0.9.0.rst b/docs/sphinx/source/whatsnew/v0.9.0.rst index 0e05d23cd4..53403a6650 100644 --- a/docs/sphinx/source/whatsnew/v0.9.0.rst +++ b/docs/sphinx/source/whatsnew/v0.9.0.rst @@ -234,7 +234,7 @@ Requirements ~~~~~~~~~~~~ * ``dataclasses`` is required for python 3.6 (:pull:`1076`) * ``h5py`` is now a required dependency. This replaces ``tables``, which was formerly - an optional dependency. (:pull:`1299`) + an optional dependency. (:pull:`1299`, :issue:`1252`, :issue:`1286`) Contributors ~~~~~~~~~~~~