Skip to content

Commit

Permalink
Remove deprecated pvlib.iotools.read_srml_month_from_solardat function (
Browse files Browse the repository at this point in the history
#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 <80125792+echedey-ls@users.noreply.github.com>

* Implement code review changes

---------

Co-authored-by: Echedey Luis <80125792+echedey-ls@users.noreply.github.com>
  • Loading branch information
AdamRJensen and echedey-ls authored Jun 6, 2024
1 parent ddb1c8e commit 77c2051
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 111 deletions.
1 change: 0 additions & 1 deletion docs/sphinx/source/reference/iotools.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions docs/sphinx/source/whatsnew/v0.10.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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`)
Expand Down Expand Up @@ -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`)


Expand All @@ -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
Expand Down
3 changes: 3 additions & 0 deletions docs/sphinx/source/whatsnew/v0.11.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ 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`)
* The `leap_day` parameter in :py:func:`~pvlib.iotools.get_psm3`
now defaults to True instead of False. (:issue:`1481`, :pull:`1991`)

Expand Down
2 changes: 1 addition & 1 deletion docs/sphinx/source/whatsnew/v0.6.1.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
1 change: 0 additions & 1 deletion pvlib/iotools/__init__.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
61 changes: 0 additions & 61 deletions pvlib/iotools/srml.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -172,65 +170,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.
Expand Down
44 changes: 1 addition & 43 deletions pvlib/tests/iotools/test_srml.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down Expand Up @@ -88,47 +87,6 @@ def test_get_srml():
assert_frame_equal(file_data, requested)


@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://solardata.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)


@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()


@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.remote_data
@pytest.mark.flaky(reruns=RERUNS, reruns_delay=RERUNS_DELAY)
def test_get_srml_hourly():
Expand Down

0 comments on commit 77c2051

Please sign in to comment.