8000 Remove deprecated pvlib.iotools.read_srml_month_from_solardat function by AdamRJensen · Pull Request #1989 · pvlib/pvlib-python · GitHub
[go: up one dir, main page]

Skip to content

Remove deprecated pvlib.iotools.read_srml_month_from_solardat function #1989

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Next Next commit
Remove read_srml_month_from_solardat
  • Loading branch information
AdamRJensen committed Mar 12, 2024
commit 0cb48265bf9cb45b207863b7c6f9963a918116aa
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
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
58 changes: 0 additions & 58 deletions pvlib/iotools/srml.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
44 changes: 0 additions & 44 deletions pvlib/tests/iotools/test_srml.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
0