From 234b89bbc16e10db88e8af38ff25d0c5064fde9d Mon Sep 17 00:00:00 2001 From: Will Holmgren Date: Fri, 23 Aug 2019 15:13:23 -0700 Subject: [PATCH 1/2] remove functions marked for 0.7 removal --- docs/sphinx/source/whatsnew/v0.7.0.rst | 11 ++++ pvlib/__init__.py | 3 -- pvlib/atmosphere.py | 11 ---- pvlib/irradiance.py | 75 -------------------------- pvlib/solarposition.py | 6 --- pvlib/test/test_atmosphere.py | 11 ---- pvlib/test/test_irradiance.py | 15 +----- pvlib/test/test_solarposition.py | 12 +---- pvlib/test/test_tmy.py | 18 +------ pvlib/tmy.py | 13 ----- 10 files changed, 15 insertions(+), 160 deletions(-) delete mode 100644 pvlib/tmy.py diff --git a/docs/sphinx/source/whatsnew/v0.7.0.rst b/docs/sphinx/source/whatsnew/v0.7.0.rst index dd2e580413..0d0b3aad18 100644 --- a/docs/sphinx/source/whatsnew/v0.7.0.rst +++ b/docs/sphinx/source/whatsnew/v0.7.0.rst @@ -10,6 +10,7 @@ compatibility notes. **Python 2.7 support ended on June 1, 2019.** (:issue:`501`) **Minimum numpy version is now 1.10.4. Minimum pandas version is now 0.18.1.** + Enhancements ~~~~~~~~~~~~ * Created two new incidence angle modifier functions: :py:func:`pvlib.pvsystem.iam_martin_ruiz` @@ -30,6 +31,16 @@ Testing * Added 30 minutes to timestamps in `test_psm3.csv` to match change in NSRDB (:issue:`733`) * Added tests for methods in bifacial.py. +Removal of prior version deprecations +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +* Removed `irradiance.extraradiation`. +* Removed `irradiance.grounddiffuse`. +* Removed `irradiance.total_irrad`. +* Removed `irradiance.globalinplane`. +* Removed `atmosphere.relativeairmass`. +* Removed `atmosphere.relativeairmass`. +* Removed `solarposition.get_sun_rise_set_transit`. +* Removed `tmy` module. Contributors ~~~~~~~~~~~~ diff --git a/pvlib/__init__.py b/pvlib/__init__.py index 238d481615..a1fb92eadd 100644 --- a/pvlib/__init__.py +++ b/pvlib/__init__.py @@ -12,6 +12,3 @@ from pvlib import spa from pvlib import modelchain from pvlib import singlediode - -# for backwards compatibility for pvlib.tmy module -from pvlib import tmy diff --git a/pvlib/atmosphere.py b/pvlib/atmosphere.py index 743010e398..6be7a33bc7 100644 --- a/pvlib/atmosphere.py +++ b/pvlib/atmosphere.py @@ -8,7 +8,6 @@ import numpy as np import pandas as pd -from pvlib._deprecation import deprecated APPARENT_ZENITH_MODELS = ('simple', 'kasten1966', 'kastenyoung1989', 'gueymard1993', 'pickering2002') @@ -135,11 +134,6 @@ def get_absolute_airmass(airmass_relative, pressure=101325.): return airmass_absolute -absoluteairmass = deprecated('0.6', alternative='get_absolute_airmass', - name='absoluteairmass', removal='0.7')( - get_absolute_airmass) - - def get_relative_airmass(zenith, model='kastenyoung1989'): ''' Gives the relative (not pressure-corrected) airmass. @@ -246,11 +240,6 @@ def get_relative_airmass(zenith, model='kastenyoung1989'): return am -relativeairmass = deprecated('0.6', alternative='get_relative_airmass', - name='relativeairmass', removal='0.7')( - get_relative_airmass) - - def gueymard94_pw(temp_air, relative_humidity): r""" Calculates precipitable water (cm) from ambient air temperature (C) diff --git a/pvlib/irradiance.py b/pvlib/irradiance.py index 55b45521be..2749ca7512 100644 --- a/pvlib/irradiance.py +++ b/pvlib/irradiance.py @@ -12,7 +12,6 @@ import pandas as pd from pvlib import atmosphere, solarposition, tools -from pvlib._deprecation import deprecated # see References section of grounddiffuse function SURFACE_ALBEDOS = {'urban': 0.18, @@ -114,11 +113,6 @@ def get_extra_radiation(datetime_or_doy, solar_constant=1366.1, return Ea -extraradiation = deprecated('0.6', alternative='get_extra_radiation', - name='extraradiation', removal='0.7')( - get_extra_radiation) - - def _handle_extra_radiation_types(datetime_or_doy, epoch_year): # This block will set the functions that can be used to convert the # inputs to either day of year or pandas DatetimeIndex, and the @@ -372,11 +366,6 @@ def get_total_irradiance(surface_tilt, surface_azimuth, return irrads -total_irrad = deprecated('0.6', alternative='get_total_irradiance', - name='total_irrad', removal='0.7')( - get_total_irradiance) - - def get_sky_diffuse(surface_tilt, surface_azimuth, solar_zenith, solar_azimuth, dni, ghi, dhi, dni_extra=None, airmass=None, @@ -508,65 +497,6 @@ def poa_components(aoi, dni, poa_sky_diffuse, poa_ground_diffuse): return irrads -# globalinplane returns less data than poa_components, so better -# to copy it -@deprecated('0.6', alternative='poa_components', removal='0.7') -def globalinplane(aoi, dni, poa_sky_diffuse, poa_ground_diffuse): - r''' - Determine the three components on in-plane irradiance - - Combines in-plane irradaince compoents from the chosen diffuse - translation, ground reflection and beam irradiance algorithms into - the total in-plane irradiance. - - Parameters - ---------- - aoi : numeric - Angle of incidence of solar rays with respect to the module - surface, from :func:`aoi`. - - dni : numeric - Direct normal irradiance (W/m^2), as measured from a TMY file or - calculated with a clearsky model. - - poa_sky_diffuse : numeric - Diffuse irradiance (W/m^2) in the plane of the modules, as - calculated by a diffuse irradiance translation function - - poa_ground_diffuse : numeric - Ground reflected irradiance (W/m^2) in the plane of the modules, - as calculated by an albedo model (eg. :func:`grounddiffuse`) - - Returns - ------- - irrads : OrderedDict or DataFrame - Contains the following keys: - - * ``poa_global`` : Total in-plane irradiance (W/m^2) - * ``poa_direct`` : Total in-plane beam irradiance (W/m^2) - * ``poa_diffuse`` : Total in-plane diffuse irradiance (W/m^2) - - Notes - ------ - Negative beam irradiation due to aoi :math:`> 90^{\circ}` or AOI - :math:`< 0^{\circ}` is set to zero. - ''' - - poa_direct = np.maximum(dni * np.cos(np.radians(aoi)), 0) - poa_global = poa_direct + poa_sky_diffuse + poa_ground_diffuse - poa_diffuse = poa_sky_diffuse + poa_ground_diffuse - - irrads = OrderedDict() - irrads['poa_global'] = poa_global - irrads['poa_direct'] = poa_direct - irrads['poa_diffuse'] = poa_diffuse - - if isinstance(poa_direct, pd.Series): - irrads = pd.DataFrame(irrads) - - return irrads - - def get_ground_diffuse(surface_tilt, ghi, albedo=.25, surface_type=None): ''' Estimate diffuse irradiance from ground reflections given @@ -632,11 +562,6 @@ def get_ground_diffuse(surface_tilt, ghi, albedo=.25, surface_type=None): return diffuse_irrad -grounddiffuse = deprecated('0.6', alternative='get_ground_diffuse', - name='grounddiffuse', removal='0.7')( - get_ground_diffuse) - - def isotropic(surface_tilt, dhi): r''' Determine diffuse irradiance from the sky on a tilted surface using diff --git a/pvlib/solarposition.py b/pvlib/solarposition.py index be7f33aefa..7a51fc6cc9 100644 --- a/pvlib/solarposition.py +++ b/pvlib/solarposition.py @@ -443,12 +443,6 @@ def sun_rise_set_transit_spa(times, latitude, longitude, how='numpy', 'transit': transit}) -get_sun_rise_set_transit = deprecated('0.6.1', - alternative='sun_rise_set_transit_spa', - name='get_sun_rise_set_transit', - removal='0.7')(sun_rise_set_transit_spa) - - def _ephem_convert_to_seconds_and_microseconds(date): # utility from unreleased PyEphem 3.6.7.1 """Converts a PyEphem date into seconds""" diff --git a/pvlib/test/test_atmosphere.py b/pvlib/test/test_atmosphere.py index db0617c56f..ee4b17ae91 100644 --- a/pvlib/test/test_atmosphere.py +++ b/pvlib/test/test_atmosphere.py @@ -8,9 +8,6 @@ import pytest from pvlib import atmosphere -from pvlib._deprecation import pvlibDeprecationWarning - -from conftest import fail_on_pvlib_version def test_pres2alt(): @@ -74,14 +71,6 @@ def test_get_absolute_airmass(): assert_allclose(out, expected, equal_nan=True, atol=0.001) -@fail_on_pvlib_version('0.7') -def test_deprecated_07(): - with pytest.warns(pvlibDeprecationWarning): - atmosphere.relativeairmass(2) - with pytest.warns(pvlibDeprecationWarning): - atmosphere.absoluteairmass(2) - - def test_gueymard94_pw(): temp_air = np.array([0, 20, 40]) relative_humidity = np.array([0, 30, 100]) diff --git a/pvlib/test/test_irradiance.py b/pvlib/test/test_irradiance.py index 27598e785d..221b99083f 100644 --- a/pvlib/test/test_irradiance.py +++ b/pvlib/test/test_irradiance.py @@ -12,9 +12,8 @@ from pandas.util.testing import assert_frame_equal, assert_series_equal from pvlib import irradiance -from pvlib._deprecation import pvlibDeprecationWarning -from conftest import (fail_on_pvlib_version, needs_numpy_1_10, pandas_0_22, +from conftest import (needs_numpy_1_10, pandas_0_22, requires_ephem, requires_numba) @@ -68,18 +67,6 @@ def relative_airmass(times): return pd.Series([np.nan, 7.58831596, 1.01688136, 3.27930443], times) -@fail_on_pvlib_version('0.7') -def test_deprecated_07(): - with pytest.warns(pvlibDeprecationWarning): - irradiance.extraradiation(300) - with pytest.warns(pvlibDeprecationWarning): - irradiance.grounddiffuse(40, 900) - with pytest.warns(pvlibDeprecationWarning): - irradiance.total_irrad(32, 180, 10, 180, 0, 0, 0, 1400, 1) - with pytest.warns(pvlibDeprecationWarning): - irradiance.globalinplane(0, 1000, 100, 10) - - # setup for et rad test. put it here for readability timestamp = pd.Timestamp('20161026') dt_index = pd.DatetimeIndex([timestamp]) diff --git a/pvlib/test/test_solarposition.py b/pvlib/test/test_solarposition.py index 4a8c142dff..d1f446e818 100644 --- a/pvlib/test/test_solarposition.py +++ b/pvlib/test/test_solarposition.py @@ -9,11 +9,10 @@ from numpy.testing import assert_allclose import pytest -from pvlib._deprecation import pvlibDeprecationWarning from pvlib.location import Location from pvlib import solarposition, spa -from conftest import (fail_on_pvlib_version, requires_ephem, needs_pandas_0_17, +from conftest import (requires_ephem, needs_pandas_0_17, requires_spa_c, requires_numba) @@ -111,15 +110,6 @@ def expected_rise_set_ephem(): index=times) -@fail_on_pvlib_version('0.7') -def test_deprecated_07(): - tt = pd.DatetimeIndex(['2015-01-01 00:00:00']).tz_localize('MST') - with pytest.warns(pvlibDeprecationWarning): - solarposition.get_sun_rise_set_transit(tt, - 39.7, - -105.2) - - # the physical tests are run at the same time as the NREL SPA test. # pyephem reproduces the NREL result to 2 decimal places. # this doesn't mean that one code is better than the other. diff --git a/pvlib/test/test_tmy.py b/pvlib/test/test_tmy.py index 5df92450bf..c910bc9c93 100644 --- a/pvlib/test/test_tmy.py +++ b/pvlib/test/test_tmy.py @@ -2,29 +2,15 @@ import os from pandas.util.testing import network -import pytest -from pvlib._deprecation import pvlibDeprecationWarning from pvlib.iotools import tmy -from conftest import fail_on_pvlib_version - - -test_dir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) +test_dir = os.path.dirname( + os.path.abspath(inspect.getfile(inspect.currentframe()))) tmy3_testfile = os.path.join(test_dir, '../data/703165TY.csv') tmy2_testfile = os.path.join(test_dir, '../data/12839.tm2') -@fail_on_pvlib_version('0.7') -def test_deprecated_07(): - with pytest.warns(pvlibDeprecationWarning): - from pvlib.tmy import readtmy2 - readtmy2(tmy2_testfile) - with pytest.warns(pvlibDeprecationWarning): - from pvlib.tmy import readtmy3 - readtmy3(tmy3_testfile) - - def test_read_tmy3(): tmy.read_tmy3(tmy3_testfile) diff --git a/pvlib/tmy.py b/pvlib/tmy.py deleted file mode 100644 index 6299d52b85..0000000000 --- a/pvlib/tmy.py +++ /dev/null @@ -1,13 +0,0 @@ -""" -Deprecated version of pvlib.iotools.tmy -""" - -from pvlib.iotools import read_tmy2, read_tmy3 - -from pvlib._deprecation import deprecated - -readtmy2 = deprecated('0.6.1', alternative='iotools.read_tmy2', - name='readtmy2', removal='0.7')(read_tmy2) - -readtmy3 = deprecated('0.6.1', alternative='iotools.read_tmy3', - name='readtmy3', removal='0.7')(read_tmy3) From 2fa65cd1b5c0a3b7ecf0186648d100560cadfd12 Mon Sep 17 00:00:00 2001 From: Will Holmgren Date: Fri, 23 Aug 2019 15:14:50 -0700 Subject: [PATCH 2/2] extra line --- docs/sphinx/source/whatsnew/v0.7.0.rst | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/sphinx/source/whatsnew/v0.7.0.rst b/docs/sphinx/source/whatsnew/v0.7.0.rst index 0d0b3aad18..a51e0df165 100644 --- a/docs/sphinx/source/whatsnew/v0.7.0.rst +++ b/docs/sphinx/source/whatsnew/v0.7.0.rst @@ -10,7 +10,6 @@ compatibility notes. **Python 2.7 support ended on June 1, 2019.** (:issue:`501`) **Minimum numpy version is now 1.10.4. Minimum pandas version is now 0.18.1.** - Enhancements ~~~~~~~~~~~~ * Created two new incidence angle modifier functions: :py:func:`pvlib.pvsystem.iam_martin_ruiz`