From 1afd3cbd410d64dc5a0f171f63e7ebeedd131f2d Mon Sep 17 00:00:00 2001 From: Cameron Stark Date: Sun, 29 Mar 2020 19:10:25 -0600 Subject: [PATCH 01/21] limit cftime to <=1.1.0 for all but Python3.5 --- ci/requirements-py36.yml | 1 + ci/requirements-py37.yml | 1 + ci/requirements-py38.yml | 1 + setup.py | 2 +- 4 files changed, 4 insertions(+), 1 deletion(-) diff --git a/ci/requirements-py36.yml b/ci/requirements-py36.yml index f579886be1..600337abad 100644 --- a/ci/requirements-py36.yml +++ b/ci/requirements-py36.yml @@ -3,6 +3,7 @@ channels: - defaults - conda-forge dependencies: + - cftime<=1.1.0 - coveralls - cython - ephem diff --git a/ci/requirements-py37.yml b/ci/requirements-py37.yml index 518e0dc23c..e7437ba37b 100644 --- a/ci/requirements-py37.yml +++ b/ci/requirements-py37.yml @@ -3,6 +3,7 @@ channels: - defaults - conda-forge dependencies: + - cftime<=1.1.0 - coveralls - cython - ephem diff --git a/ci/requirements-py38.yml b/ci/requirements-py38.yml index 0ac444dc3c..86eec176cb 100644 --- a/ci/requirements-py38.yml +++ b/ci/requirements-py38.yml @@ -3,6 +3,7 @@ channels: - defaults - conda-forge dependencies: + - cftime<=1.1.0 - coveralls - cython - ephem diff --git a/setup.py b/setup.py index 338196f544..934545ba5b 100755 --- a/setup.py +++ b/setup.py @@ -45,7 +45,7 @@ 'pytest-timeout', 'pytest-rerunfailures', 'pytest-remotedata'] EXTRAS_REQUIRE = { 'optional': ['ephem', 'cython', 'netcdf4', 'nrel-pysam', 'numba', - 'pvfactors', 'scipy', 'siphon', 'tables'], + 'pvfactors', 'scipy', 'siphon', 'tables', "cftime <= 1.1.0"], 'doc': ['ipython', 'matplotlib', 'sphinx == 1.8.5', 'sphinx_rtd_theme', 'sphinx-gallery', 'docutils == 0.15.2'], 'test': TESTS_REQUIRE From 197dbe8332ae89d9c43128b5e2b80e61c2bcef43 Mon Sep 17 00:00:00 2001 From: Cameron Stark Date: Sun, 29 Mar 2020 19:55:07 -0600 Subject: [PATCH 02/21] add what's new --- docs/sphinx/source/whatsnew/v0.7.2.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/sphinx/source/whatsnew/v0.7.2.rst b/docs/sphinx/source/whatsnew/v0.7.2.rst index 5d1bb1774c..d3dbd3ebba 100644 --- a/docs/sphinx/source/whatsnew/v0.7.2.rst +++ b/docs/sphinx/source/whatsnew/v0.7.2.rst @@ -48,6 +48,8 @@ Bug fixes and various test functions. * Fix :py:func:`~pvlib.iotools.read_tmy3` so that when coerced to a single year the TMY3 index will be monotonically increasing. (:pull:`910`) +* Limit cftime<=1.1.0 to alleviate errors from netcdf4 time handling in + forecast.py (:pull:`947`) Testing ~~~~~~~ @@ -87,3 +89,4 @@ Contributors * Siyan (Veronica) Guo (:ghuser:`veronicaguo`) * Eric Fitch (:ghuser:`ericf900`) * Joseph Palakapilly (:ghuser:`JPalakapilly`) +* Auguste Colle(:ghuser:`augustecolle`) From 667ffb248c70e8745420379aac83af5fb1527be4 Mon Sep 17 00:00:00 2001 From: Cameron Stark Date: Mon, 30 Mar 2020 18:10:15 -0600 Subject: [PATCH 03/21] Revert "limit cftime to <=1.1.0 for all but Python3.5" This reverts commit 1afd3cbd410d64dc5a0f171f63e7ebeedd131f2d. --- ci/requirements-py36.yml | 1 - ci/requirements-py37.yml | 1 - ci/requirements-py38.yml | 1 - setup.py | 2 +- 4 files changed, 1 insertion(+), 4 deletions(-) diff --git a/ci/requirements-py36.yml b/ci/requirements-py36.yml index 600337abad..f579886be1 100644 --- a/ci/requirements-py36.yml +++ b/ci/requirements-py36.yml @@ -3,7 +3,6 @@ channels: - defaults - conda-forge dependencies: - - cftime<=1.1.0 - coveralls - cython - ephem diff --git a/ci/requirements-py37.yml b/ci/requirements-py37.yml index e7437ba37b..518e0dc23c 100644 --- a/ci/requirements-py37.yml +++ b/ci/requirements-py37.yml @@ -3,7 +3,6 @@ channels: - defaults - conda-forge dependencies: - - cftime<=1.1.0 - coveralls - cython - ephem diff --git a/ci/requirements-py38.yml b/ci/requirements-py38.yml index 86eec176cb..0ac444dc3c 100644 --- a/ci/requirements-py38.yml +++ b/ci/requirements-py38.yml @@ -3,7 +3,6 @@ channels: - defaults - conda-forge dependencies: - - cftime<=1.1.0 - coveralls - cython - ephem diff --git a/setup.py b/setup.py index 934545ba5b..338196f544 100755 --- a/setup.py +++ b/setup.py @@ -45,7 +45,7 @@ 'pytest-timeout', 'pytest-rerunfailures', 'pytest-remotedata'] EXTRAS_REQUIRE = { 'optional': ['ephem', 'cython', 'netcdf4', 'nrel-pysam', 'numba', - 'pvfactors', 'scipy', 'siphon', 'tables', "cftime <= 1.1.0"], + 'pvfactors', 'scipy', 'siphon', 'tables'], 'doc': ['ipython', 'matplotlib', 'sphinx == 1.8.5', 'sphinx_rtd_theme', 'sphinx-gallery', 'docutils == 0.15.2'], 'test': TESTS_REQUIRE From 50ad8a69b517106ea678a9de843a44515bea1930 Mon Sep 17 00:00:00 2001 From: Cameron Stark Date: Mon, 30 Mar 2020 20:14:31 -0600 Subject: [PATCH 04/21] add only_use_python_datetimes, switch off only_use_cftime_datetimes --- pvlib/forecast.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pvlib/forecast.py b/pvlib/forecast.py index e760b18c10..e29f64bc4a 100644 --- a/pvlib/forecast.py +++ b/pvlib/forecast.py @@ -406,7 +406,8 @@ def set_time(self, time): pandas.DatetimeIndex ''' times = num2date(time[:].squeeze(), time.units, - only_use_cftime_datetimes=False) + only_use_cftime_datetimes=False, + only_use_python_datetimes=True) self.time = pd.DatetimeIndex(pd.Series(times), tz=self.location.tz) def cloud_cover_to_ghi_linear(self, cloud_cover, ghi_clear, offset=35, From b319af30082d726a08bc2742d014e709daff710c Mon Sep 17 00:00:00 2001 From: Cameron Stark Date: Tue, 31 Mar 2020 22:27:57 -0600 Subject: [PATCH 05/21] limit cftime>=1.1.1 --- ci/requirements-py35.yml | 1 + ci/requirements-py36.yml | 1 + ci/requirements-py37.yml | 1 + ci/requirements-py38.yml | 1 + setup.py | 2 +- 5 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ci/requirements-py35.yml b/ci/requirements-py35.yml index 8fe88c839b..4739e2e99d 100644 --- a/ci/requirements-py35.yml +++ b/ci/requirements-py35.yml @@ -3,6 +3,7 @@ channels: - defaults - conda-forge dependencies: + - cftime>=1.1.1 - coveralls - cython - ephem diff --git a/ci/requirements-py36.yml b/ci/requirements-py36.yml index f579886be1..e3464c3234 100644 --- a/ci/requirements-py36.yml +++ b/ci/requirements-py36.yml @@ -3,6 +3,7 @@ channels: - defaults - conda-forge dependencies: + - cftime>=1.1.1 - coveralls - cython - ephem diff --git a/ci/requirements-py37.yml b/ci/requirements-py37.yml index 518e0dc23c..01e17a97fb 100644 --- a/ci/requirements-py37.yml +++ b/ci/requirements-py37.yml @@ -3,6 +3,7 @@ channels: - defaults - conda-forge dependencies: + - cftime>=1.1.1 - coveralls - cython - ephem diff --git a/ci/requirements-py38.yml b/ci/requirements-py38.yml index 0ac444dc3c..c07dedd9ab 100644 --- a/ci/requirements-py38.yml +++ b/ci/requirements-py38.yml @@ -3,6 +3,7 @@ channels: - defaults - conda-forge dependencies: + - cftime>=1.1.1 - coveralls - cython - ephem diff --git a/setup.py b/setup.py index 338196f544..6e5f6ad372 100755 --- a/setup.py +++ b/setup.py @@ -45,7 +45,7 @@ 'pytest-timeout', 'pytest-rerunfailures', 'pytest-remotedata'] EXTRAS_REQUIRE = { 'optional': ['ephem', 'cython', 'netcdf4', 'nrel-pysam', 'numba', - 'pvfactors', 'scipy', 'siphon', 'tables'], + 'pvfactors', 'scipy', 'siphon', 'tables', 'cftime >= 1.1.1'], 'doc': ['ipython', 'matplotlib', 'sphinx == 1.8.5', 'sphinx_rtd_theme', 'sphinx-gallery', 'docutils == 0.15.2'], 'test': TESTS_REQUIRE From 7b9ab4a64db2bcf233247b7fd622a92f07709760 Mon Sep 17 00:00:00 2001 From: Cameron Stark Date: Wed, 1 Apr 2020 09:11:11 -0600 Subject: [PATCH 06/21] update what's new --- docs/sphinx/source/whatsnew/v0.7.2.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/sphinx/source/whatsnew/v0.7.2.rst b/docs/sphinx/source/whatsnew/v0.7.2.rst index eb242d002a..2d3aff3940 100644 --- a/docs/sphinx/source/whatsnew/v0.7.2.rst +++ b/docs/sphinx/source/whatsnew/v0.7.2.rst @@ -50,8 +50,6 @@ Bug fixes the TMY3 index will be monotonically increasing. (:pull:`910`) * Fix :py:func:`pvlib.spa.julian_day_dt` so that microseconds are scaled correctly (:issue:`940`) (:pull:`942`) -* Limit cftime<=1.1.0 to alleviate errors from netcdf4 time handling in - forecast.py (:pull:`947`) Testing ~~~~~~~ @@ -79,6 +77,8 @@ Documentation Requirements ~~~~~~~~~~~~ * nrel-pysam (optional) minimum set to v1.0.0 (:issue:`874`) +* cftime (optional) minimum set to >=1.1.1 enables `only_use_python_datetimes` + kwarg in `netCDF4.num2date` in forecast.py (:pull:`947`) Contributors ~~~~~~~~~~~~ From 251b221bdd87fb104fea3f55690d7dc69ff38196 Mon Sep 17 00:00:00 2001 From: Cameron Stark Date: Wed, 1 Apr 2020 09:21:17 -0600 Subject: [PATCH 07/21] install cftime from pip instead --- ci/requirements-py35.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/requirements-py35.yml b/ci/requirements-py35.yml index 4739e2e99d..f157d89ec6 100644 --- a/ci/requirements-py35.yml +++ b/ci/requirements-py35.yml @@ -3,7 +3,6 @@ channels: - defaults - conda-forge dependencies: - - cftime>=1.1.1 - coveralls - cython - ephem @@ -25,6 +24,7 @@ dependencies: - shapely # pvfactors dependency - siphon # conda-forge - pip: + - cftime>=1.1.1 - nrel-pysam>=2.0 - pvfactors==1.0.1 - pytest-rerunfailures # conda version is >3.6 From 3054f9f0bd51608854e0c2622771ece931d494f2 Mon Sep 17 00:00:00 2001 From: Cameron Stark Date: Tue, 31 Mar 2020 21:06:53 -0600 Subject: [PATCH 08/21] selectively fail tests --- pvlib/tests/conftest.py | 10 ++++++++++ pvlib/tests/test_forecast.py | 14 +++++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/pvlib/tests/conftest.py b/pvlib/tests/conftest.py index e9c33d5916..a45763b276 100644 --- a/pvlib/tests/conftest.py +++ b/pvlib/tests/conftest.py @@ -156,6 +156,16 @@ def has_numba(): requires_pysam = pytest.mark.skipif(not has_pysam, reason="requires PySAM") +try: + import cftime # noqa: F401 + from packaging.version import parse as parse_version + has_recent_cftime = parse_version(cftime.__version__) > parse_version("1.1.0") +except ImportError: + has_recent_cftime = False + +requires_recent_cftime = pytest.mark.skipif(not has_recent_cftime, reason="requires cftime > 1.1.0") + + @pytest.fixture(scope="session") def sam_data(): data = {} diff --git a/pvlib/tests/test_forecast.py b/pvlib/tests/test_forecast.py index cfd104a63b..498de0440d 100644 --- a/pvlib/tests/test_forecast.py +++ b/pvlib/tests/test_forecast.py @@ -6,7 +6,13 @@ import pytest from numpy.testing import assert_allclose -from conftest import requires_siphon, has_siphon, skip_windows +from conftest import ( + requires_siphon, + has_siphon, + skip_windows, + requires_recent_cftime +) + from conftest import RERUNS, RERUNS_DELAY pytestmark = pytest.mark.skipif(not has_siphon, reason='requires siphon') @@ -78,6 +84,7 @@ def test_process_data(model): @requires_siphon +@requires_recent_cftime @pytest.mark.remote_data @pytest.mark.flaky(reruns=RERUNS, reruns_delay=RERUNS_DELAY) def test_bad_kwarg_get_data(): @@ -90,6 +97,7 @@ def test_bad_kwarg_get_data(): @requires_siphon +@requires_recent_cftime @pytest.mark.remote_data @pytest.mark.flaky(reruns=RERUNS, reruns_delay=RERUNS_DELAY) def test_bad_kwarg_get_processed_data(): @@ -102,6 +110,7 @@ def test_bad_kwarg_get_processed_data(): @requires_siphon +@requires_recent_cftime @pytest.mark.remote_data @pytest.mark.flaky(reruns=RERUNS, reruns_delay=RERUNS_DELAY) def test_how_kwarg_get_processed_data(): @@ -112,6 +121,7 @@ def test_how_kwarg_get_processed_data(): @requires_siphon +@requires_recent_cftime @pytest.mark.remote_data @pytest.mark.flaky(reruns=RERUNS, reruns_delay=RERUNS_DELAY) def test_vert_level(): @@ -122,6 +132,7 @@ def test_vert_level(): @requires_siphon +@requires_recent_cftime @pytest.mark.remote_data @pytest.mark.flaky(reruns=RERUNS, reruns_delay=RERUNS_DELAY) def test_datetime(): @@ -132,6 +143,7 @@ def test_datetime(): @requires_siphon +@requires_recent_cftime @pytest.mark.remote_data @pytest.mark.flaky(reruns=RERUNS, reruns_delay=RERUNS_DELAY) def test_queryvariables(): From b2156bd6b648b2ddb62c6ed1066235d6be81e4e5 Mon Sep 17 00:00:00 2001 From: Cameron Stark Date: Tue, 31 Mar 2020 22:12:43 -0600 Subject: [PATCH 09/21] raise Exception for old cftime --- pvlib/forecast.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/pvlib/forecast.py b/pvlib/forecast.py index e29f64bc4a..0b230bd2fc 100644 --- a/pvlib/forecast.py +++ b/pvlib/forecast.py @@ -405,6 +405,21 @@ def set_time(self, time): ------- pandas.DatetimeIndex ''' + # check if cftime version >1.1.0 + import cftime + from packaging.version import parse as parse_version + has_old_cftime = ( + parse_version(cftime.__version__) <= parse_version("1.1.0") + ) + if has_old_cftime: + raise Exception( + "The cftime version ({}) is below the required <= 1.1.0. " + "This version does not have the required kwarg " + "`only_use_python_datetimes` in the function num2date. " + "Please install a more recent version of " + "cftime.".format(cftime.__version__) + ) + times = num2date(time[:].squeeze(), time.units, only_use_cftime_datetimes=False, only_use_python_datetimes=True) From 1cb6011e8f2077e2fc3e88fba7c3950e11e8e4c8 Mon Sep 17 00:00:00 2001 From: Cameron Stark Date: Wed, 1 Apr 2020 09:45:29 -0600 Subject: [PATCH 10/21] Revert "install cftime from pip instead" This reverts commit 251b221bdd87fb104fea3f55690d7dc69ff38196. --- ci/requirements-py35.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/requirements-py35.yml b/ci/requirements-py35.yml index f157d89ec6..4739e2e99d 100644 --- a/ci/requirements-py35.yml +++ b/ci/requirements-py35.yml @@ -3,6 +3,7 @@ channels: - defaults - conda-forge dependencies: + - cftime>=1.1.1 - coveralls - cython - ephem @@ -24,7 +25,6 @@ dependencies: - shapely # pvfactors dependency - siphon # conda-forge - pip: - - cftime>=1.1.1 - nrel-pysam>=2.0 - pvfactors==1.0.1 - pytest-rerunfailures # conda version is >3.6 From 4a441c41b5789110ec5cf5a52eff21a1d1238ccc Mon Sep 17 00:00:00 2001 From: Cameron Stark Date: Wed, 1 Apr 2020 23:00:18 -0600 Subject: [PATCH 11/21] limit cftime, skip1.1.0 - import cftime - from packaging.version import parse as parse_version - has_old_cftime = ( - parse_version(cftime.__version__) <= parse_version("1.1.0") - ) - if has_old_cftime: - raise Exception( - "The cftime version ({}) is below the required <= 1.1.0. " - "This version does not have the required kwarg " - "`only_use_python_datetimes` in the function num2date. " - "Please install a more recent version of " - "cftime.".format(cftime.__version__) - ) - times = num2date(time[:].squeeze(), time.units, - only_use_cftime_datetimes=False, - only_use_python_datetimes=True) + only_use_cftime_datetimes=False) self.time = pd.DatetimeIndex(pd.Series(times), tz=self.location.tz) def cloud_cover_to_ghi_linear(self, cloud_cover, ghi_clear, offset=35, diff --git a/pvlib/tests/conftest.py b/pvlib/tests/conftest.py index a45763b276..0b3336c7dc 100644 --- a/pvlib/tests/conftest.py +++ b/pvlib/tests/conftest.py @@ -156,14 +156,7 @@ def has_numba(): requires_pysam = pytest.mark.skipif(not has_pysam, reason="requires PySAM") -try: - import cftime # noqa: F401 - from packaging.version import parse as parse_version - has_recent_cftime = parse_version(cftime.__version__) > parse_version("1.1.0") -except ImportError: - has_recent_cftime = False - -requires_recent_cftime = pytest.mark.skipif(not has_recent_cftime, reason="requires cftime > 1.1.0") +requires_three_six = pytest.mark.skipif(sys.version_info < (3, 6), reason="requires python3.6 or higher") @pytest.fixture(scope="session") diff --git a/pvlib/tests/test_forecast.py b/pvlib/tests/test_forecast.py index 498de0440d..9be24bdb7d 100644 --- a/pvlib/tests/test_forecast.py +++ b/pvlib/tests/test_forecast.py @@ -10,7 +10,7 @@ requires_siphon, has_siphon, skip_windows, - requires_recent_cftime + requires_three_six ) from conftest import RERUNS, RERUNS_DELAY @@ -84,7 +84,7 @@ def test_process_data(model): @requires_siphon -@requires_recent_cftime +@requires_three_six @pytest.mark.remote_data @pytest.mark.flaky(reruns=RERUNS, reruns_delay=RERUNS_DELAY) def test_bad_kwarg_get_data(): @@ -97,7 +97,7 @@ def test_bad_kwarg_get_data(): @requires_siphon -@requires_recent_cftime +@requires_three_six @pytest.mark.remote_data @pytest.mark.flaky(reruns=RERUNS, reruns_delay=RERUNS_DELAY) def test_bad_kwarg_get_processed_data(): @@ -110,7 +110,7 @@ def test_bad_kwarg_get_processed_data(): @requires_siphon -@requires_recent_cftime +@requires_three_six @pytest.mark.remote_data @pytest.mark.flaky(reruns=RERUNS, reruns_delay=RERUNS_DELAY) def test_how_kwarg_get_processed_data(): @@ -121,7 +121,7 @@ def test_how_kwarg_get_processed_data(): @requires_siphon -@requires_recent_cftime +@requires_three_six @pytest.mark.remote_data @pytest.mark.flaky(reruns=RERUNS, reruns_delay=RERUNS_DELAY) def test_vert_level(): @@ -132,7 +132,7 @@ def test_vert_level(): @requires_siphon -@requires_recent_cftime +@requires_three_six @pytest.mark.remote_data @pytest.mark.flaky(reruns=RERUNS, reruns_delay=RERUNS_DELAY) def test_datetime(): @@ -143,7 +143,7 @@ def test_datetime(): @requires_siphon -@requires_recent_cftime +@requires_three_six @pytest.mark.remote_data @pytest.mark.flaky(reruns=RERUNS, reruns_delay=RERUNS_DELAY) def test_queryvariables(): diff --git a/setup.py b/setup.py index 6e5f6ad372..934545ba5b 100755 --- a/setup.py +++ b/setup.py @@ -45,7 +45,7 @@ 'pytest-timeout', 'pytest-rerunfailures', 'pytest-remotedata'] EXTRAS_REQUIRE = { 'optional': ['ephem', 'cython', 'netcdf4', 'nrel-pysam', 'numba', - 'pvfactors', 'scipy', 'siphon', 'tables', 'cftime >= 1.1.1'], + 'pvfactors', 'scipy', 'siphon', 'tables', "cftime <= 1.1.0"], 'doc': ['ipython', 'matplotlib', 'sphinx == 1.8.5', 'sphinx_rtd_theme', 'sphinx-gallery', 'docutils == 0.15.2'], 'test': TESTS_REQUIRE From 2607e39befd669036ebc94c7b3be847621b96611 Mon Sep 17 00:00:00 2001 From: Cameron Stark Date: Wed, 1 Apr 2020 23:03:31 -0600 Subject: [PATCH 12/21] fix lint, import sys --- pvlib/tests/conftest.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pvlib/tests/conftest.py b/pvlib/tests/conftest.py index 0b3336c7dc..9fbb2d905c 100644 --- a/pvlib/tests/conftest.py +++ b/pvlib/tests/conftest.py @@ -1,6 +1,7 @@ from pathlib import Path import platform import warnings +import sys import numpy as np import pandas as pd @@ -156,7 +157,9 @@ def has_numba(): requires_pysam = pytest.mark.skipif(not has_pysam, reason="requires PySAM") -requires_three_six = pytest.mark.skipif(sys.version_info < (3, 6), reason="requires python3.6 or higher") +requires_three_six = pytest.mark.skipif( + sys.version_info < (3, 6), reason="requires python3.6 or higher" +) @pytest.fixture(scope="session") From 53329d191741261510e655dffa1a2753413d87e1 Mon Sep 17 00:00:00 2001 From: Cameron Stark Date: Thu, 2 Apr 2020 08:42:39 -0600 Subject: [PATCH 13/21] set cftime<=1.1.0 --- ci/requirements-py35.yml | 2 +- ci/requirements-py36.yml | 2 +- ci/requirements-py37.yml | 2 +- ci/requirements-py38.yml | 2 +- docs/sphinx/source/whatsnew/v0.7.2.rst | 5 +++-- pvlib/tests/conftest.py | 5 ----- 6 files changed, 7 insertions(+), 11 deletions(-) diff --git a/ci/requirements-py35.yml b/ci/requirements-py35.yml index 4739e2e99d..cf3ed517f5 100644 --- a/ci/requirements-py35.yml +++ b/ci/requirements-py35.yml @@ -3,7 +3,7 @@ channels: - defaults - conda-forge dependencies: - - cftime>=1.1.1 + - cftime<=1.1.0 - coveralls - cython - ephem diff --git a/ci/requirements-py36.yml b/ci/requirements-py36.yml index e3464c3234..600337abad 100644 --- a/ci/requirements-py36.yml +++ b/ci/requirements-py36.yml @@ -3,7 +3,7 @@ channels: - defaults - conda-forge dependencies: - - cftime>=1.1.1 + - cftime<=1.1.0 - coveralls - cython - ephem diff --git a/ci/requirements-py37.yml b/ci/requirements-py37.yml index 01e17a97fb..e7437ba37b 100644 --- a/ci/requirements-py37.yml +++ b/ci/requirements-py37.yml @@ -3,7 +3,7 @@ channels: - defaults - conda-forge dependencies: - - cftime>=1.1.1 + - cftime<=1.1.0 - coveralls - cython - ephem diff --git a/ci/requirements-py38.yml b/ci/requirements-py38.yml index c07dedd9ab..86eec176cb 100644 --- a/ci/requirements-py38.yml +++ b/ci/requirements-py38.yml @@ -3,7 +3,7 @@ channels: - defaults - conda-forge dependencies: - - cftime>=1.1.1 + - cftime<=1.1.0 - coveralls - cython - ephem diff --git a/docs/sphinx/source/whatsnew/v0.7.2.rst b/docs/sphinx/source/whatsnew/v0.7.2.rst index 2d3aff3940..dd5fc937ac 100644 --- a/docs/sphinx/source/whatsnew/v0.7.2.rst +++ b/docs/sphinx/source/whatsnew/v0.7.2.rst @@ -77,8 +77,9 @@ Documentation Requirements ~~~~~~~~~~~~ * nrel-pysam (optional) minimum set to v1.0.0 (:issue:`874`) -* cftime (optional) minimum set to >=1.1.1 enables `only_use_python_datetimes` - kwarg in `netCDF4.num2date` in forecast.py (:pull:`947`) +* cftime (optional) maximum set to <=1.1.0 . Future use of + `only_use_python_datetimes` kwarg in `netCDF4.num2date` in forecast.py + requires >=1.1.1 (:pull:`947`) Contributors ~~~~~~~~~~~~ diff --git a/pvlib/tests/conftest.py b/pvlib/tests/conftest.py index 9fbb2d905c..3a665834df 100644 --- a/pvlib/tests/conftest.py +++ b/pvlib/tests/conftest.py @@ -157,11 +157,6 @@ def has_numba(): requires_pysam = pytest.mark.skipif(not has_pysam, reason="requires PySAM") -requires_three_six = pytest.mark.skipif( - sys.version_info < (3, 6), reason="requires python3.6 or higher" -) - - @pytest.fixture(scope="session") def sam_data(): data = {} From 71acc29254cace1a0cd0915fd3c5aae188aacd31 Mon Sep 17 00:00:00 2001 From: Cameron Stark Date: Thu, 2 Apr 2020 08:50:16 -0600 Subject: [PATCH 14/21] fix test_forecast --- pvlib/tests/test_forecast.py | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/pvlib/tests/test_forecast.py b/pvlib/tests/test_forecast.py index 9be24bdb7d..cfd104a63b 100644 --- a/pvlib/tests/test_forecast.py +++ b/pvlib/tests/test_forecast.py @@ -6,13 +6,7 @@ import pytest from numpy.testing import assert_allclose -from conftest import ( - requires_siphon, - has_siphon, - skip_windows, - requires_three_six -) - +from conftest import requires_siphon, has_siphon, skip_windows from conftest import RERUNS, RERUNS_DELAY pytestmark = pytest.mark.skipif(not has_siphon, reason='requires siphon') @@ -84,7 +78,6 @@ def test_process_data(model): @requires_siphon -@requires_three_six @pytest.mark.remote_data @pytest.mark.flaky(reruns=RERUNS, reruns_delay=RERUNS_DELAY) def test_bad_kwarg_get_data(): @@ -97,7 +90,6 @@ def test_bad_kwarg_get_data(): @requires_siphon -@requires_three_six @pytest.mark.remote_data @pytest.mark.flaky(reruns=RERUNS, reruns_delay=RERUNS_DELAY) def test_bad_kwarg_get_processed_data(): @@ -110,7 +102,6 @@ def test_bad_kwarg_get_processed_data(): @requires_siphon -@requires_three_six @pytest.mark.remote_data @pytest.mark.flaky(reruns=RERUNS, reruns_delay=RERUNS_DELAY) def test_how_kwarg_get_processed_data(): @@ -121,7 +112,6 @@ def test_how_kwarg_get_processed_data(): @requires_siphon -@requires_three_six @pytest.mark.remote_data @pytest.mark.flaky(reruns=RERUNS, reruns_delay=RERUNS_DELAY) def test_vert_level(): @@ -132,7 +122,6 @@ def test_vert_level(): @requires_siphon -@requires_three_six @pytest.mark.remote_data @pytest.mark.flaky(reruns=RERUNS, reruns_delay=RERUNS_DELAY) def test_datetime(): @@ -143,7 +132,6 @@ def test_datetime(): @requires_siphon -@requires_three_six @pytest.mark.remote_data @pytest.mark.flaky(reruns=RERUNS, reruns_delay=RERUNS_DELAY) def test_queryvariables(): From 5ec6f3589b66c7d9c4a62e41143166f9c4201db1 Mon Sep 17 00:00:00 2001 From: Cameron Stark Date: Thu, 2 Apr 2020 17:59:46 -0600 Subject: [PATCH 15/21] add new cftime kwargs, xfail for cftime>1.1.0 --- pvlib/forecast.py | 3 ++- pvlib/tests/conftest.py | 14 ++++++++++++++ pvlib/tests/test_forecast.py | 14 +++++++++++++- setup.py | 2 +- 4 files changed, 30 insertions(+), 3 deletions(-) diff --git a/pvlib/forecast.py b/pvlib/forecast.py index e760b18c10..e29f64bc4a 100644 --- a/pvlib/forecast.py +++ b/pvlib/forecast.py @@ -406,7 +406,8 @@ def set_time(self, time): pandas.DatetimeIndex ''' times = num2date(time[:].squeeze(), time.units, - only_use_cftime_datetimes=False) + only_use_cftime_datetimes=False, + only_use_python_datetimes=True) self.time = pd.DatetimeIndex(pd.Series(times), tz=self.location.tz) def cloud_cover_to_ghi_linear(self, cloud_cover, ghi_clear, offset=35, diff --git a/pvlib/tests/conftest.py b/pvlib/tests/conftest.py index 3a665834df..807d157c15 100644 --- a/pvlib/tests/conftest.py +++ b/pvlib/tests/conftest.py @@ -157,6 +157,20 @@ def has_numba(): requires_pysam = pytest.mark.skipif(not has_pysam, reason="requires PySAM") +try: + import cftime # noqa: F401 + + has_recent_cftime = parse_version(cftime.__version__) > parse_version( + "1.1.0" + ) +except ImportError: + has_recent_cftime = False + +requires_recent_cftime = pytest.mark.skipif( + not has_recent_cftime, reason="requires cftime > 1.1.0" +) + + @pytest.fixture(scope="session") def sam_data(): data = {} diff --git a/pvlib/tests/test_forecast.py b/pvlib/tests/test_forecast.py index cfd104a63b..75b3badb74 100644 --- a/pvlib/tests/test_forecast.py +++ b/pvlib/tests/test_forecast.py @@ -6,7 +6,12 @@ import pytest from numpy.testing import assert_allclose -from conftest import requires_siphon, has_siphon, skip_windows +from conftest import ( + requires_siphon, + has_siphon, + skip_windows, + requires_recent_cftime, +) from conftest import RERUNS, RERUNS_DELAY pytestmark = pytest.mark.skipif(not has_siphon, reason='requires siphon') @@ -60,6 +65,7 @@ def model(request): @requires_siphon +@requires_recent_cftime @pytest.mark.remote_data @pytest.mark.flaky(reruns=RERUNS, reruns_delay=RERUNS_DELAY) def test_process_data(model): @@ -78,6 +84,7 @@ def test_process_data(model): @requires_siphon +@requires_recent_cftime @pytest.mark.remote_data @pytest.mark.flaky(reruns=RERUNS, reruns_delay=RERUNS_DELAY) def test_bad_kwarg_get_data(): @@ -90,6 +97,7 @@ def test_bad_kwarg_get_data(): @requires_siphon +@requires_recent_cftime @pytest.mark.remote_data @pytest.mark.flaky(reruns=RERUNS, reruns_delay=RERUNS_DELAY) def test_bad_kwarg_get_processed_data(): @@ -102,6 +110,7 @@ def test_bad_kwarg_get_processed_data(): @requires_siphon +@requires_recent_cftime @pytest.mark.remote_data @pytest.mark.flaky(reruns=RERUNS, reruns_delay=RERUNS_DELAY) def test_how_kwarg_get_processed_data(): @@ -112,6 +121,7 @@ def test_how_kwarg_get_processed_data(): @requires_siphon +@requires_recent_cftime @pytest.mark.remote_data @pytest.mark.flaky(reruns=RERUNS, reruns_delay=RERUNS_DELAY) def test_vert_level(): @@ -122,6 +132,7 @@ def test_vert_level(): @requires_siphon +@requires_recent_cftime @pytest.mark.remote_data @pytest.mark.flaky(reruns=RERUNS, reruns_delay=RERUNS_DELAY) def test_datetime(): @@ -132,6 +143,7 @@ def test_datetime(): @requires_siphon +@requires_recent_cftime @pytest.mark.remote_data @pytest.mark.flaky(reruns=RERUNS, reruns_delay=RERUNS_DELAY) def test_queryvariables(): diff --git a/setup.py b/setup.py index 934545ba5b..7487c95d70 100755 --- a/setup.py +++ b/setup.py @@ -45,7 +45,7 @@ 'pytest-timeout', 'pytest-rerunfailures', 'pytest-remotedata'] EXTRAS_REQUIRE = { 'optional': ['ephem', 'cython', 'netcdf4', 'nrel-pysam', 'numba', - 'pvfactors', 'scipy', 'siphon', 'tables', "cftime <= 1.1.0"], + 'pvfactors', 'scipy', 'siphon', 'tables', 'cftime>=1.1.0'], 'doc': ['ipython', 'matplotlib', 'sphinx == 1.8.5', 'sphinx_rtd_theme', 'sphinx-gallery', 'docutils == 0.15.2'], 'test': TESTS_REQUIRE From 3300e9d0e9eb7301601fc0d49782f01a189c9803 Mon Sep 17 00:00:00 2001 From: Cameron Stark Date: Thu, 2 Apr 2020 22:42:15 -0600 Subject: [PATCH 16/21] pin to 1.1.1 and above --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 7487c95d70..6e5f6ad372 100755 --- a/setup.py +++ b/setup.py @@ -45,7 +45,7 @@ 'pytest-timeout', 'pytest-rerunfailures', 'pytest-remotedata'] EXTRAS_REQUIRE = { 'optional': ['ephem', 'cython', 'netcdf4', 'nrel-pysam', 'numba', - 'pvfactors', 'scipy', 'siphon', 'tables', 'cftime>=1.1.0'], + 'pvfactors', 'scipy', 'siphon', 'tables', 'cftime >= 1.1.1'], 'doc': ['ipython', 'matplotlib', 'sphinx == 1.8.5', 'sphinx_rtd_theme', 'sphinx-gallery', 'docutils == 0.15.2'], 'test': TESTS_REQUIRE From 7bbc33660ddc3ae1fb21c0bcaf71057e7f584681 Mon Sep 17 00:00:00 2001 From: Cameron Stark Date: Fri, 3 Apr 2020 08:17:34 -0600 Subject: [PATCH 17/21] remove unnecessary conda pinning --- ci/requirements-py35.yml | 1 - ci/requirements-py36.yml | 1 - ci/requirements-py37.yml | 1 - ci/requirements-py38.yml | 1 - 4 files changed, 4 deletions(-) diff --git a/ci/requirements-py35.yml b/ci/requirements-py35.yml index cf3ed517f5..8fe88c839b 100644 --- a/ci/requirements-py35.yml +++ b/ci/requirements-py35.yml @@ -3,7 +3,6 @@ channels: - defaults - conda-forge dependencies: - - cftime<=1.1.0 - coveralls - cython - ephem diff --git a/ci/requirements-py36.yml b/ci/requirements-py36.yml index 600337abad..f579886be1 100644 --- a/ci/requirements-py36.yml +++ b/ci/requirements-py36.yml @@ -3,7 +3,6 @@ channels: - defaults - conda-forge dependencies: - - cftime<=1.1.0 - coveralls - cython - ephem diff --git a/ci/requirements-py37.yml b/ci/requirements-py37.yml index e7437ba37b..518e0dc23c 100644 --- a/ci/requirements-py37.yml +++ b/ci/requirements-py37.yml @@ -3,7 +3,6 @@ channels: - defaults - conda-forge dependencies: - - cftime<=1.1.0 - coveralls - cython - ephem diff --git a/ci/requirements-py38.yml b/ci/requirements-py38.yml index 86eec176cb..0ac444dc3c 100644 --- a/ci/requirements-py38.yml +++ b/ci/requirements-py38.yml @@ -3,7 +3,6 @@ channels: - defaults - conda-forge dependencies: - - cftime<=1.1.0 - coveralls - cython - ephem From 2e5d0bbc2aa9b4e4a6841b04060b1e336adaf6d1 Mon Sep 17 00:00:00 2001 From: Cameron Stark Date: Fri, 3 Apr 2020 08:12:37 -0600 Subject: [PATCH 18/21] improve what's new --- docs/sphinx/source/whatsnew/v0.7.2.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/sphinx/source/whatsnew/v0.7.2.rst b/docs/sphinx/source/whatsnew/v0.7.2.rst index dd5fc937ac..9994a14f40 100644 --- a/docs/sphinx/source/whatsnew/v0.7.2.rst +++ b/docs/sphinx/source/whatsnew/v0.7.2.rst @@ -77,9 +77,9 @@ Documentation Requirements ~~~~~~~~~~~~ * nrel-pysam (optional) minimum set to v1.0.0 (:issue:`874`) -* cftime (optional) maximum set to <=1.1.0 . Future use of +* cftime (optional) minimum set to >=1.1.1. Use of `only_use_python_datetimes` kwarg in `netCDF4.num2date` in forecast.py - requires >=1.1.1 (:pull:`947`) + requires >=1.1.1 which is >=Python3.6. (:pull:`947`) Contributors ~~~~~~~~~~~~ From 6f1c62d239b11549b32c65cad9443878fb2c744c Mon Sep 17 00:00:00 2001 From: Cameron Stark Date: Fri, 3 Apr 2020 08:31:01 -0600 Subject: [PATCH 19/21] remove sys --- pvlib/tests/conftest.py | 1 - 1 file changed, 1 deletion(-) diff --git a/pvlib/tests/conftest.py b/pvlib/tests/conftest.py index 807d157c15..dedb0ce836 100644 --- a/pvlib/tests/conftest.py +++ b/pvlib/tests/conftest.py @@ -1,7 +1,6 @@ from pathlib import Path import platform import warnings -import sys import numpy as np import pandas as pd From f210b11512e5ecb2a1b82317fb6f813c5d1476e8 Mon Sep 17 00:00:00 2001 From: Cameron Stark Date: Fri, 3 Apr 2020 08:41:34 -0600 Subject: [PATCH 20/21] test not limiting cftime --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 6e5f6ad372..338196f544 100755 --- a/setup.py +++ b/setup.py @@ -45,7 +45,7 @@ 'pytest-timeout', 'pytest-rerunfailures', 'pytest-remotedata'] EXTRAS_REQUIRE = { 'optional': ['ephem', 'cython', 'netcdf4', 'nrel-pysam', 'numba', - 'pvfactors', 'scipy', 'siphon', 'tables', 'cftime >= 1.1.1'], + 'pvfactors', 'scipy', 'siphon', 'tables'], 'doc': ['ipython', 'matplotlib', 'sphinx == 1.8.5', 'sphinx_rtd_theme', 'sphinx-gallery', 'docutils == 0.15.2'], 'test': TESTS_REQUIRE From 6673da20e72dba8f063fa8950e6a8a9187631a63 Mon Sep 17 00:00:00 2001 From: Cameron Stark Date: Fri, 3 Apr 2020 08:51:44 -0600 Subject: [PATCH 21/21] Revert "test not limiting cftime" This reverts commit f210b11512e5ecb2a1b82317fb6f813c5d1476e8. --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 338196f544..6e5f6ad372 100755 --- a/setup.py +++ b/setup.py @@ -45,7 +45,7 @@ 'pytest-timeout', 'pytest-rerunfailures', 'pytest-remotedata'] EXTRAS_REQUIRE = { 'optional': ['ephem', 'cython', 'netcdf4', 'nrel-pysam', 'numba', - 'pvfactors', 'scipy', 'siphon', 'tables'], + 'pvfactors', 'scipy', 'siphon', 'tables', 'cftime >= 1.1.1'], 'doc': ['ipython', 'matplotlib', 'sphinx == 1.8.5', 'sphinx_rtd_theme', 'sphinx-gallery', 'docutils == 0.15.2'], 'test': TESTS_REQUIRE