From 0cb48265bf9cb45b207863b7c6f9963a918116aa Mon Sep 17 00:00:00 2001 From: "Adam R. Jensen" <39184289+AdamRJensen@users.noreply.github.com> Date: Tue, 12 Mar 2024 09:53:22 +0100 Subject: [PATCH 1/6] Remove read_srml_month_from_solardat --- docs/sphinx/source/reference/iotools.rst | 1 - pvlib/iotools/__init__.py | 1 - pvlib/iotools/srml.py | 58 ------------------------ pvlib/tests/iotools/test_srml.py | 44 ------------------ 4 files changed, 104 deletions(-) diff --git a/docs/sphinx/source/reference/iotools.rst b/docs/sphinx/source/reference/iotools.rst index 5f405d7536..cc9cf5d7f3 100644 --- a/docs/sphinx/source/reference/iotools.rst +++ b/docs/sphinx/source/reference/iotools.rst @@ -19,7 +19,6 @@ of sources and file formats relevant to solar energy modeling. iotools.read_epw iotools.parse_epw iotools.read_srml - iotools.read_srml_month_from_solardat iotools.get_srml iotools.read_surfrad iotools.read_midc diff --git a/pvlib/iotools/__init__.py b/pvlib/iotools/__init__.py index 96259ecc24..ad12ed89c1 100644 --- a/pvlib/iotools/__init__.py +++ b/pvlib/iotools/__init__.py @@ -1,7 +1,6 @@ from pvlib.iotools.tmy import read_tmy2, read_tmy3 # noqa: F401 from pvlib.iotools.epw import read_epw, parse_epw # noqa: F401 from pvlib.iotools.srml import read_srml # noqa: F401 -from pvlib.iotools.srml import read_srml_month_from_solardat # noqa: F401 from pvlib.iotools.srml import get_srml # noqa: F401 from pvlib.iotools.surfrad import read_surfrad # noqa: F401 from pvlib.iotools.midc import read_midc # noqa: F401 diff --git a/pvlib/iotools/srml.py b/pvlib/iotools/srml.py index 83868f637c..ea25d6eca1 100644 --- a/pvlib/iotools/srml.py +++ b/pvlib/iotools/srml.py @@ -172,64 +172,6 @@ def _format_index(df): return df -@deprecated('0.10.0', alternative='pvlib.iotools.get_srml', removal='0.11.0') -def read_srml_month_from_solardat(station, year, month, filetype='PO', - map_variables=True): - """Request a month of SRML data and read it into a Dataframe. - - The SRML is described in [1]_. - - Parameters - ---------- - station: str - The name of the SRML station to request. - year: int - Year to request data for - month: int - Month to request data for. - filetype: string - SRML file type to gather. See notes for explanation. - map_variables: bool, default: True - When true, renames columns of the DataFrame to pvlib variable names - where applicable. See variable :const:`VARIABLE_MAP`. - - Returns - ------- - data: pd.DataFrame - One month of data from SRML. - - Notes - ----- - File types designate the time interval of a file and if it contains - raw or processed data. For instance, `RO` designates raw, one minute - data and `PO` designates processed one minute data. The availability - of file types varies between sites. Below is a table of file types - and their time intervals. See [1] for site information. - - ============= ============ ================== - time interval raw filetype processed filetype - ============= ============ ================== - 1 minute RO PO - 5 minute RF PF - 15 minute RQ PQ - hourly RH PH - ============= ============ ================== - - References - ---------- - .. [1] University of Oregon Solar Radiation Measurement Laboratory - http://solardata.uoregon.edu/ - """ - file_name = "{station}{filetype}{year:02d}{month:02d}.txt".format( - station=station, - filetype=filetype, - year=year % 100, - month=month) - url = "http://solardata.uoregon.edu/download/Archive/" - data = read_srml(url + file_name, map_variables=map_variables) - return data - - def get_srml(station, start, end, filetype='PO', map_variables=True, url="http://solardata.uoregon.edu/download/Archive/"): """Request data from UoO SRML and read it into a Dataframe. diff --git a/pvlib/tests/iotools/test_srml.py b/pvlib/tests/iotools/test_srml.py index 308ea3a3a1..1fc436c4ed 100644 --- a/pvlib/tests/iotools/test_srml.py +++ b/pvlib/tests/iotools/test_srml.py @@ -89,50 +89,6 @@ def test_get_srml(): assert_frame_equal(file_data, requested) -@pytest.mark.skip(reason="SRML server is undergoing maintenance as of 12-2023") -@fail_on_pvlib_version('0.11') -@pytest.mark.remote_data -@pytest.mark.flaky(reruns=RERUNS, reruns_delay=RERUNS_DELAY) -def test_read_srml_month_from_solardat(): - url = 'http://solardat.uoregon.edu/download/Archive/EUPO1801.txt' - file_data = srml.read_srml(url) - with pytest.warns(pvlibDeprecationWarning, match='get_srml instead'): - requested = srml.read_srml_month_from_solardat('EU', 2018, 1) - assert file_data.equals(requested) - - -@pytest.mark.skip(reason="SRML server is undergoing maintenance as of 12-2023") -@fail_on_pvlib_version('0.11') -@pytest.mark.remote_data -@pytest.mark.flaky(reruns=RERUNS, reruns_delay=RERUNS_DELAY) -def test_15_minute_dt_index(): - with pytest.warns(pvlibDeprecationWarning, match='get_srml instead'): - data = srml.read_srml_month_from_solardat('TW', 2019, 4, 'RQ') - start = pd.Timestamp('20190401 00:00') - start = start.tz_localize('Etc/GMT+8') - end = pd.Timestamp('20190430 23:45') - end = end.tz_localize('Etc/GMT+8') - assert data.index[0] == start - assert data.index[-1] == end - assert (data.index[3::4].minute == 45).all() - - -@pytest.mark.skip(reason="SRML server is undergoing maintenance as of 12-2023") -@fail_on_pvlib_version('0.11') -@pytest.mark.remote_data -@pytest.mark.flaky(reruns=RERUNS, reruns_delay=RERUNS_DELAY) -def test_hourly_dt_index(): - with pytest.warns(pvlibDeprecationWarning, match='get_srml instead'): - data = srml.read_srml_month_from_solardat('CD', 1986, 4, 'PH') - start = pd.Timestamp('19860401 00:00') - start = start.tz_localize('Etc/GMT+8') - end = pd.Timestamp('19860430 23:00') - end = end.tz_localize('Etc/GMT+8') - assert data.index[0] == start - assert data.index[-1] == end - assert (data.index.minute == 0).all() - - @pytest.mark.skip(reason="SRML server is undergoing maintenance as of 12-2023") @pytest.mark.remote_data @pytest.mark.flaky(reruns=RERUNS, reruns_delay=RERUNS_DELAY) From 4c35033e634704508dd63633533fc49ed7d27de6 Mon Sep 17 00:00:00 2001 From: "Adam R. Jensen" <39184289+AdamRJensen@users.noreply.github.com> Date: Fri, 24 May 2024 10:42:20 +0200 Subject: [PATCH 2/6] Add whatsnew --- docs/sphinx/source/whatsnew/v0.10.0.rst | 8 ++++---- docs/sphinx/source/whatsnew/v0.10.5.rst | 4 +++- docs/sphinx/source/whatsnew/v0.6.1.rst | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/docs/sphinx/source/whatsnew/v0.10.0.rst b/docs/sphinx/source/whatsnew/v0.10.0.rst index e7816020bd..7f86137407 100644 --- a/docs/sphinx/source/whatsnew/v0.10.0.rst +++ b/docs/sphinx/source/whatsnew/v0.10.0.rst @@ -28,7 +28,7 @@ Breaking changes (:issue:`1718`, :pull:`1719`) * Map wind direction to ``'wind_direction'`` instead of ``'wind_dir'`` in :py:func:`pvlib.iotools.read_srml` and - :py:func:`pvlib.iotools.read_srml_month_from_solardat` (:pull:`1773`) + ``pvlib.iotools.read_srml_month_from_solardat`` (:pull:`1773`) * :func:`~pvlib.iotools.get_pvgis_tmy` and :func:`~pvlib.iotools.read_pvgis_tmy` now rename columns to standard pvlib names by default (``map_variables=True``) (:pull:`1772`) @@ -66,7 +66,7 @@ Deprecations TMY3 column names to nonstandard alternatives, is now deprecated. We encourage using ``map_variables`` (which produces standard pvlib names) instead. (:issue:`1517`, :pull:`1623`) -* :py:func:`pvlib.iotools.read_srml_month_from_solardat` is deprecated and replaced by +* ``pvlib.iotools.read_srml_month_from_solardat`` is deprecated and replaced by :py:func:`pvlib.iotools.get_srml`. (:pull:`1779`) @@ -79,9 +79,9 @@ Enhancements :py:func:`pvlib.pvsystem.calcparams_pvsyst` are all numeric types and have the same Python type as the ``effective_irradiance`` and ``temp_cell`` parameters. (:issue:`1626`, :pull:`1700`) * Added ``map_variables`` parameter to :py:func:`pvlib.iotools.read_tmy3` (:issue:`1517`, :pull:`1623`), - :py:func:`pvlib.iotools.read_srml`, and :py:func:`pvlib.iotools.read_srml_month_from_solardat` (:pull:`1773`). + :py:func:`pvlib.iotools.read_srml`, and ``pvlib.iotools.read_srml_month_from_solardat`` (:pull:`1773`). * Added :func:`pvlib.iotools.get_srml` that is similar to - :func:`pvlib.iotools.read_srml_month_from_solardat` but is able to fetch multiple months + ``pvlib.iotools.read_srml_month_from_solardat`` but is able to fetch multiple months of data using the ``start`` and ``end`` parameters. (:pull:`1779`) * Allow passing keyword arguments to :py:func:`scipy:scipy.optimize.brentq` and diff --git a/docs/sphinx/source/whatsnew/v0.10.5.rst b/docs/sphinx/source/whatsnew/v0.10.5.rst index fe64879c8a..5b732ad2ed 100644 --- a/docs/sphinx/source/whatsnew/v0.10.5.rst +++ b/docs/sphinx/source/whatsnew/v0.10.5.rst @@ -7,7 +7,9 @@ v0.10.5 (Anticipated June 2024) Deprecations ~~~~~~~~~~~~ - +* pvlib.iotools.read_srml_month_from_solardat() was deprecated in v0.10.0 and has + now been completely removed. The function is replaced by :py:func:`~pvlib.iotools.get_srml()`. + (:pull:`1779`, :pull:`1989`) Enhancements ~~~~~~~~~~~~ diff --git a/docs/sphinx/source/whatsnew/v0.6.1.rst b/docs/sphinx/source/whatsnew/v0.6.1.rst index 27d8d9ead6..9c20106c46 100644 --- a/docs/sphinx/source/whatsnew/v0.6.1.rst +++ b/docs/sphinx/source/whatsnew/v0.6.1.rst @@ -46,7 +46,7 @@ Enhancements :func:`~pvlib.solarposition.sun_rise_set_transit_geometric` (:issue:`114`) * Add `Location` class method :py:func:`~pvlib.location.Location.get_sun_rise_set_transit` * Created :py:func:`pvlib.iotools.read_srml` and - :py:func:`pvlib.iotools.read_srml_month_from_solardat` to read University of + ``pvlib.iotools.read_srml_month_from_solardat`` to read University of Oregon Solar Radiation Monitoring Laboratory data. (:issue:`589`) * Created :py:func:`pvlib.iotools.read_surfrad` to read NOAA SURFRAD data. (:issue:`590`) * Created :py:func:`pvlib.iotools.read_midc` and :py:func:`pvlib.iotools.read_midc_raw_data_from_nrel` From 67f9dc86795f265fe11989772ee0d431d2dca4bc Mon Sep 17 00:00:00 2001 From: "Adam R. Jensen" <39184289+AdamRJensen@users.noreply.github.com> Date: Fri, 24 May 2024 10:50:19 +0200 Subject: [PATCH 3/6] Fix whatsnew files --- docs/sphinx/source/whatsnew/v0.10.5.rst | 14 ++------------ docs/sphinx/source/whatsnew/v0.11.0.rst | 3 +++ 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/docs/sphinx/source/whatsnew/v0.10.5.rst b/docs/sphinx/source/whatsnew/v0.10.5.rst index 918c3822f4..00daed3a0f 100644 --- a/docs/sphinx/source/whatsnew/v0.10.5.rst +++ b/docs/sphinx/source/whatsnew/v0.10.5.rst @@ -1,18 +1,8 @@ .. _whatsnew_01050: -v0.10.5 (Anticipated June 2024) -------------------------------- - -Deprecations -~~~~~~~~~~~~ -* pvlib.iotools.read_srml_month_from_solardat() was deprecated in v0.10.0 and has - now been completely removed. The function is replaced by :py:func:`~pvlib.iotools.get_srml()`. - (:pull:`1779`, :pull:`1989`) - - -Enhancements -~~~~~~~~~~~~ +v0.10.5 (May 6, 2024) +--------------------- Bug fixes diff --git a/docs/sphinx/source/whatsnew/v0.11.0.rst b/docs/sphinx/source/whatsnew/v0.11.0.rst index 142974ea78..d7d33f368f 100644 --- a/docs/sphinx/source/whatsnew/v0.11.0.rst +++ b/docs/sphinx/source/whatsnew/v0.11.0.rst @@ -11,6 +11,9 @@ Breaking changes Deprecations ~~~~~~~~~~~~ +* ``pvlib.iotools.read_srml_month_from_solardat()`` was deprecated in v0.10.0 and has + now been completely removed. The function is replaced by :py:func:`~pvlib.iotools.get_srml()`. + (:pull:`1779`, :pull:`1989`) Enhancements From 7f7c10a51aaeff73753f48b50f74a696eed1a07d Mon Sep 17 00:00:00 2001 From: "Adam R. Jensen" <39184289+AdamRJensen@users.noreply.github.com> Date: Sun, 2 Jun 2024 19:48:21 +0200 Subject: [PATCH 4/6] Update v0.11.0.rst --- docs/sphinx/source/whatsnew/v0.11.0.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/sphinx/source/whatsnew/v0.11.0.rst b/docs/sphinx/source/whatsnew/v0.11.0.rst index 5b92cadbfe..8573bee050 100644 --- a/docs/sphinx/source/whatsnew/v0.11.0.rst +++ b/docs/sphinx/source/whatsnew/v0.11.0.rst @@ -9,13 +9,13 @@ Breaking changes ~~~~~~~~~~~~~~~~ * The deprecated ``pvlib.modelchain.basic_chain`` has now been removed. (:pull:`1862`) * Remove the `poa_horizontal_ratio` function and all of its references. (:issue:`1697`, :pull:`2021`) +* ``pvlib.iotools.read_srml_month_from_solardat()`` was deprecated in v0.10.0 and has + now been completely removed. The function is replaced by :py:func:`~pvlib.iotools.get_srml()`. + (:pull:`1779`, :pull:`1989`) Deprecations ~~~~~~~~~~~~ -* ``pvlib.iotools.read_srml_month_from_solardat()`` was deprecated in v0.10.0 and has - now been completely removed. The function is replaced by :py:func:`~pvlib.iotools.get_srml()`. - (:pull:`1779`, :pull:`1989`) Enhancements From b437c820bd3b24b62ee2cd84aab93fb3403885f6 Mon Sep 17 00:00:00 2001 From: "Adam R. Jensen" <39184289+AdamRJensen@users.noreply.github.com> Date: Tue, 4 Jun 2024 13:48:53 +0200 Subject: [PATCH 5/6] Update docs/sphinx/source/whatsnew/v0.11.0.rst Co-authored-by: Echedey Luis <80125792+echedey-ls@users.noreply.github.com> --- docs/sphinx/source/whatsnew/v0.11.0.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sphinx/source/whatsnew/v0.11.0.rst b/docs/sphinx/source/whatsnew/v0.11.0.rst index 4ac75e97ec..403d3bbfe4 100644 --- a/docs/sphinx/source/whatsnew/v0.11.0.rst +++ b/docs/sphinx/source/whatsnew/v0.11.0.rst @@ -9,7 +9,7 @@ Breaking changes ~~~~~~~~~~~~~~~~ * The deprecated ``pvlib.modelchain.basic_chain`` has now been removed. (:pull:`1862`) * Remove the `poa_horizontal_ratio` function and all of its references. (:issue:`1697`, :pull:`2021`) -* ``pvlib.iotools.read_srml_month_from_solardat()`` was deprecated in v0.10.0 and has +* ``pvlib.iotools.read_srml_month_from_solardat`` was deprecated in v0.10.0 and has now been completely removed. The function is replaced by :py:func:`~pvlib.iotools.get_srml()`. (:pull:`1779`, :pull:`1989`) * The `leap_day` parameter in :py:func:`~pvlib.iotools.get_psm3` From 98de650db3010cebc7116b2762fe2c6380d63083 Mon Sep 17 00:00:00 2001 From: "Adam R. Jensen" <39184289+AdamRJensen@users.noreply.github.com> Date: Tue, 4 Jun 2024 13:49:21 +0200 Subject: [PATCH 6/6] Implement code review changes --- pvlib/iotools/srml.py | 2 -- pvlib/tests/iotools/test_srml.py | 3 +-- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/pvlib/iotools/srml.py b/pvlib/iotools/srml.py index 5ab21404d8..728c3a7093 100644 --- a/pvlib/iotools/srml.py +++ b/pvlib/iotools/srml.py @@ -6,8 +6,6 @@ import urllib import warnings -from pvlib._deprecation import deprecated - # VARIABLE_MAP is a dictionary mapping SRML data element numbers to their # pvlib names. For most variables, only the first three digits are used, # the fourth indicating the instrument. Spectral data (7xxx) uses all diff --git a/pvlib/tests/iotools/test_srml.py b/pvlib/tests/iotools/test_srml.py index d1f658228e..80e76d4635 100644 --- a/pvlib/tests/iotools/test_srml.py +++ b/pvlib/tests/iotools/test_srml.py @@ -4,8 +4,7 @@ from pvlib.iotools import srml from ..conftest import (DATA_DIR, RERUNS, RERUNS_DELAY, assert_index_equal, - assert_frame_equal, fail_on_pvlib_version) -from pvlib._deprecation import pvlibDeprecationWarning + assert_frame_equal) srml_testfile = DATA_DIR / 'SRML-day-EUPO1801.txt'