Skip to content

Commit 77c2051

Browse files
Remove deprecated pvlib.iotools.read_srml_month_from_solardat function (#1989)
* Remove read_srml_month_from_solardat * Add whatsnew * Fix whatsnew files * Update v0.11.0.rst * Update docs/sphinx/source/whatsnew/v0.11.0.rst Co-authored-by: Echedey Luis <[email protected]> * Implement code review changes --------- Co-authored-by: Echedey Luis <[email protected]>
1 parent ddb1c8e commit 77c2051

File tree

7 files changed

+9
-111
lines changed

7 files changed

+9
-111
lines changed

docs/sphinx/source/reference/iotools.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ of sources and file formats relevant to solar energy modeling.
1919
iotools.read_epw
2020
iotools.parse_epw
2121
iotools.read_srml
22-
iotools.read_srml_month_from_solardat
2322
iotools.get_srml
2423
iotools.read_surfrad
2524
iotools.read_midc

docs/sphinx/source/whatsnew/v0.10.0.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Breaking changes
2828
(:issue:`1718`, :pull:`1719`)
2929
* Map wind direction to ``'wind_direction'`` instead of ``'wind_dir'`` in
3030
:py:func:`pvlib.iotools.read_srml` and
31-
:py:func:`pvlib.iotools.read_srml_month_from_solardat` (:pull:`1773`)
31+
``pvlib.iotools.read_srml_month_from_solardat`` (:pull:`1773`)
3232
* :func:`~pvlib.iotools.get_pvgis_tmy` and :func:`~pvlib.iotools.read_pvgis_tmy`
3333
now rename columns to standard pvlib names by default (``map_variables=True``)
3434
(:pull:`1772`)
@@ -66,7 +66,7 @@ Deprecations
6666
TMY3 column names to nonstandard alternatives, is now deprecated.
6767
We encourage using ``map_variables`` (which produces standard pvlib names) instead.
6868
(:issue:`1517`, :pull:`1623`)
69-
* :py:func:`pvlib.iotools.read_srml_month_from_solardat` is deprecated and replaced by
69+
* ``pvlib.iotools.read_srml_month_from_solardat`` is deprecated and replaced by
7070
:py:func:`pvlib.iotools.get_srml`. (:pull:`1779`)
7171

7272

@@ -79,9 +79,9 @@ Enhancements
7979
:py:func:`pvlib.pvsystem.calcparams_pvsyst` are all numeric types and have
8080
the same Python type as the ``effective_irradiance`` and ``temp_cell`` parameters. (:issue:`1626`, :pull:`1700`)
8181
* Added ``map_variables`` parameter to :py:func:`pvlib.iotools.read_tmy3` (:issue:`1517`, :pull:`1623`),
82-
:py:func:`pvlib.iotools.read_srml`, and :py:func:`pvlib.iotools.read_srml_month_from_solardat` (:pull:`1773`).
82+
:py:func:`pvlib.iotools.read_srml`, and ``pvlib.iotools.read_srml_month_from_solardat`` (:pull:`1773`).
8383
* Added :func:`pvlib.iotools.get_srml` that is similar to
84-
:func:`pvlib.iotools.read_srml_month_from_solardat` but is able to fetch multiple months
84+
``pvlib.iotools.read_srml_month_from_solardat`` but is able to fetch multiple months
8585
of data using the ``start`` and ``end`` parameters.
8686
(:pull:`1779`)
8787
* Allow passing keyword arguments to :py:func:`scipy:scipy.optimize.brentq` and

docs/sphinx/source/whatsnew/v0.11.0.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ Breaking changes
99
~~~~~~~~~~~~~~~~
1010
* The deprecated ``pvlib.modelchain.basic_chain`` has now been removed. (:pull:`1862`)
1111
* Remove the `poa_horizontal_ratio` function and all of its references. (:issue:`1697`, :pull:`2021`)
12+
* ``pvlib.iotools.read_srml_month_from_solardat`` was deprecated in v0.10.0 and has
13+
now been completely removed. The function is replaced by :py:func:`~pvlib.iotools.get_srml()`.
14+
(:pull:`1779`, :pull:`1989`)
1215
* The `leap_day` parameter in :py:func:`~pvlib.iotools.get_psm3`
1316
now defaults to True instead of False. (:issue:`1481`, :pull:`1991`)
1417

docs/sphinx/source/whatsnew/v0.6.1.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ Enhancements
4646
:func:`~pvlib.solarposition.sun_rise_set_transit_geometric` (:issue:`114`)
4747
* Add `Location` class method :py:func:`~pvlib.location.Location.get_sun_rise_set_transit`
4848
* Created :py:func:`pvlib.iotools.read_srml` and
49-
:py:func:`pvlib.iotools.read_srml_month_from_solardat` to read University of
49+
``pvlib.iotools.read_srml_month_from_solardat`` to read University of
5050
Oregon Solar Radiation Monitoring Laboratory data. (:issue:`589`)
5151
* Created :py:func:`pvlib.iotools.read_surfrad` to read NOAA SURFRAD data. (:issue:`590`)
5252
* Created :py:func:`pvlib.iotools.read_midc` and :py:func:`pvlib.iotools.read_midc_raw_data_from_nrel`

pvlib/iotools/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
from pvlib.iotools.tmy import read_tmy2, read_tmy3 # noqa: F401
22
from pvlib.iotools.epw import read_epw, parse_epw # noqa: F401
33
from pvlib.iotools.srml import read_srml # noqa: F401
4-
from pvlib.iotools.srml import read_srml_month_from_solardat # noqa: F401
54
from pvlib.iotools.srml import get_srml # noqa: F401
65
from pvlib.iotools.surfrad import read_surfrad # noqa: F401
76
from pvlib.iotools.midc import read_midc # noqa: F401

pvlib/iotools/srml.py

Lines changed: 0 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
import urllib
77
import warnings
88

9-
from pvlib._deprecation import deprecated
10-
119
# VARIABLE_MAP is a dictionary mapping SRML data element numbers to their
1210
# pvlib names. For most variables, only the first three digits are used,
1311
# the fourth indicating the instrument. Spectral data (7xxx) uses all
@@ -172,65 +170,6 @@ def _format_index(df):
172170
return df
173171

174172

175-
@deprecated('0.10.0', alternative='pvlib.iotools.get_srml', removal='0.11.0')
176-
def read_srml_month_from_solardat(station, year, month, filetype='PO',
177-
map_variables=True):
178-
"""
179-
Request a month of SRML data and read it into a Dataframe.
180-
181-
The SRML is described in [1]_.
182-
183-
Parameters
184-
----------
185-
station: str
186-
The name of the SRML station to request.
187-
year: int
188-
Year to request data for
189-
month: int
190-
Month to request data for.
191-
filetype: string
192-
SRML file type to gather. See notes for explanation.
193-
map_variables: bool, default: True
194-
When true, renames columns of the DataFrame to pvlib variable names
195-
where applicable. See variable :const:`VARIABLE_MAP`.
196-
197-
Returns
198-
-------
199-
data: pd.DataFrame
200-
One month of data from SRML.
201-
202-
Notes
203-
-----
204-
File types designate the time interval of a file and if it contains
205-
raw or processed data. For instance, `RO` designates raw, one minute
206-
data and `PO` designates processed one minute data. The availability
207-
of file types varies between sites. Below is a table of file types
208-
and their time intervals. See [1] for site information.
209-
210-
============= ============ ==================
211-
time interval raw filetype processed filetype
212-
============= ============ ==================
213-
1 minute RO PO
214-
5 minute RF PF
215-
15 minute RQ PQ
216-
hourly RH PH
217-
============= ============ ==================
218-
219-
References
220-
----------
221-
.. [1] University of Oregon Solar Radiation Measurement Laboratory
222-
http://solardata.uoregon.edu/
223-
"""
224-
file_name = "{station}{filetype}{year:02d}{month:02d}.txt".format(
225-
station=station,
226-
filetype=filetype,
227-
year=year % 100,
228-
month=month)
229-
url = "http://solardata.uoregon.edu/download/Archive/"
230-
data = read_srml(url + file_name, map_variables=map_variables)
231-
return data
232-
233-
234173
def get_srml(station, start, end, filetype='PO', map_variables=True,
235174
url="http://solardata.uoregon.edu/download/Archive/"):
236175
"""Request data from UoO SRML and read it into a Dataframe.

pvlib/tests/iotools/test_srml.py

Lines changed: 1 addition & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44

55
from pvlib.iotools import srml
66
from ..conftest import (DATA_DIR, RERUNS, RERUNS_DELAY, assert_index_equal,
7-
assert_frame_equal, fail_on_pvlib_version)
8-
from pvlib._deprecation import pvlibDeprecationWarning
7+
assert_frame_equal)
98

109
srml_testfile = DATA_DIR / 'SRML-day-EUPO1801.txt'
1110

@@ -88,47 +87,6 @@ def test_get_srml():
8887
assert_frame_equal(file_data, requested)
8988

9089

91-
@fail_on_pvlib_version('0.11')
92-
@pytest.mark.remote_data
93-
@pytest.mark.flaky(reruns=RERUNS, reruns_delay=RERUNS_DELAY)
94-
def test_read_srml_month_from_solardat():
95-
url = 'http://solardata.uoregon.edu/download/Archive/EUPO1801.txt'
96-
file_data = srml.read_srml(url)
97-
with pytest.warns(pvlibDeprecationWarning, match='get_srml instead'):
98-
requested = srml.read_srml_month_from_solardat('EU', 2018, 1)
99-
assert file_data.equals(requested)
100-
101-
102-
@fail_on_pvlib_version('0.11')
103-
@pytest.mark.remote_data
104-
@pytest.mark.flaky(reruns=RERUNS, reruns_delay=RERUNS_DELAY)
105-
def test_15_minute_dt_index():
106-
with pytest.warns(pvlibDeprecationWarning, match='get_srml instead'):
107-
data = srml.read_srml_month_from_solardat('TW', 2019, 4, 'RQ')
108-
start = pd.Timestamp('20190401 00:00')
109-
start = start.tz_localize('Etc/GMT+8')
110-
end = pd.Timestamp('20190430 23:45')
111-
end = end.tz_localize('Etc/GMT+8')
112-
assert data.index[0] == start
113-
assert data.index[-1] == end
114-
assert (data.index[3::4].minute == 45).all()
115-
116-
117-
@fail_on_pvlib_version('0.11')
118-
@pytest.mark.remote_data
119-
@pytest.mark.flaky(reruns=RERUNS, reruns_delay=RERUNS_DELAY)
120-
def test_hourly_dt_index():
121-
with pytest.warns(pvlibDeprecationWarning, match='get_srml instead'):
122-
data = srml.read_srml_month_from_solardat('CD', 1986, 4, 'PH')
123-
start = pd.Timestamp('19860401 00:00')
124-
start = start.tz_localize('Etc/GMT+8')
125-
end = pd.Timestamp('19860430 23:00')
126-
end = end.tz_localize('Etc/GMT+8')
127-
assert data.index[0] == start
128-
assert data.index[-1] == end
129-
assert (data.index.minute == 0).all()
130-
131-
13290
@pytest.mark.remote_data
13391
@pytest.mark.flaky(reruns=RERUNS, reruns_delay=RERUNS_DELAY)
13492
def test_get_srml_hourly():

0 commit comments

Comments
 (0)