Skip to content

Commit 14041cc

Browse files
authored
Make several undocumented functions private (#1769)
* privatize scaling.latlon_to_xy * privatize iotools.surfrad.format_index * privatize iotools.srml.format_index and map_columns * privatize iotools.midc.format_index and format_index_raw * move calculate_deltat from pvlib.spa to pvlib.solarposition * rename `spa.py` to `_spa.py` * update tests * whatsnew * Revert "rename `spa.py` to `_spa.py`" This reverts commit eb2e23a. * Revert "move calculate_deltat from pvlib.spa to pvlib.solarposition" This reverts commit f02266f. * remove SPA mentions from whatsnew * put back deltaT test * make `scaling.latlon_to_xy` public again, and include in docs
1 parent 948d820 commit 14041cc

File tree

7 files changed

+22
-18
lines changed

7 files changed

+22
-18
lines changed

docs/sphinx/source/reference/scaling.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ Methods for manipulating irradiance for temporal or spatial considerations
99
:toctree: generated/
1010

1111
scaling.wvm
12+
scaling.latlon_to_xy

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ Breaking Changes
1717
(:pull:`1768`)
1818
* For consistency with the rest of pvlib, the ``tilt`` parameter is renamed
1919
to ``surface_tilt`` in :py:func:`pvlib.soiling.hsu`. (:issue:`1717`, :pull:`1738`)
20+
* Several undocumented functions in :py:mod:`pvlib.iotools.midc`,
21+
:py:mod:`pvlib.iotools.srml`, and :py:mod:`pvlib.iotools.surfrad`
22+
are now private. (:issue:`1756`, :pull:`1769`)
2023
* The following, originally deprecated in :ref:`whatsnew_0900`, is now removed: (:pull:`1770`)
2124

2225
- The :py:class:`pvlib.tracking.SingleAxisTracker` class

pvlib/iotools/midc.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@
102102
}
103103

104104

105-
def format_index(data):
105+
def _format_index(data):
106106
"""Create DatetimeIndex for the Dataframe localized to the timezone provided
107107
as the label of the second (time) column.
108108
@@ -126,7 +126,7 @@ def format_index(data):
126126
return data
127127

128128

129-
def format_index_raw(data):
129+
def _format_index_raw(data):
130130
"""Create DatetimeIndex for the Dataframe localized to the timezone provided
131131
as the label of the third column.
132132
@@ -200,9 +200,9 @@ def read_midc(filename, variable_map={}, raw_data=False, **kwargs):
200200
"""
201201
data = pd.read_csv(filename, **kwargs)
202202
if raw_data:
203-
data = format_index_raw(data)
203+
data = _format_index_raw(data)
204204
else:
205-
data = format_index(data)
205+
data = _format_index(data)
206206
data = data.rename(columns=variable_map)
207207
return data
208208

pvlib/iotools/srml.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,12 @@ def read_srml(filename, map_variables=True):
6161
`http://solardat.uoregon.edu/ <http://solardat.uoregon.edu/>`_
6262
"""
6363
tsv_data = pd.read_csv(filename, delimiter='\t')
64-
data = format_index(tsv_data)
64+
data = _format_index(tsv_data)
6565
# Drop day of year and time columns
6666
data = data[data.columns[2:]]
6767

6868
if map_variables:
69-
data = data.rename(columns=map_columns)
69+
data = data.rename(columns=_map_columns)
7070

7171
# Quality flag columns are all labeled 0 in the original data. They
7272
# appear immediately after their associated variable and are suffixed
@@ -92,7 +92,7 @@ def read_srml(filename, map_variables=True):
9292
return data
9393

9494

95-
def map_columns(col):
95+
def _map_columns(col):
9696
"""Map data element numbers to pvlib names.
9797
9898
Parameters
@@ -120,7 +120,7 @@ def map_columns(col):
120120
return col
121121

122122

123-
def format_index(df):
123+
def _format_index(df):
124124
"""Create a datetime index from day of year, and time columns.
125125
126126
Parameters

pvlib/iotools/surfrad.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ def read_surfrad(filename, map_variables=True):
150150
header=None, names=SURFRAD_COLUMNS)
151151
file_buffer.close()
152152

153-
data = format_index(data)
153+
data = _format_index(data)
154154
missing = data == -9999.9
155155
data = data.where(~missing, np.NaN)
156156

@@ -159,7 +159,7 @@ def read_surfrad(filename, map_variables=True):
159159
return data, metadata
160160

161161

162-
def format_index(data):
162+
def _format_index(data):
163163
"""Create UTC localized DatetimeIndex for the dataframe.
164164
165165
Parameters

pvlib/tests/iotools/test_midc.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ def test_mapping():
2727
# '?site=UAT&begin=20181018&end=20181019')
2828

2929

30-
def test_midc_format_index():
30+
def test_midc__format_index():
3131
data = pd.read_csv(MIDC_TESTFILE)
32-
data = midc.format_index(data)
32+
data = midc._format_index(data)
3333
start = pd.Timestamp("20181014 00:00")
3434
start = start.tz_localize("MST")
3535
end = pd.Timestamp("20181014 23:59")
@@ -39,16 +39,16 @@ def test_midc_format_index():
3939
assert data.index[-1] == end
4040

4141

42-
def test_midc_format_index_tz_conversion():
42+
def test_midc__format_index_tz_conversion():
4343
data = pd.read_csv(MIDC_TESTFILE)
4444
data = data.rename(columns={'MST': 'PST'})
45-
data = midc.format_index(data)
45+
data = midc._format_index(data)
4646
assert data.index[0].tz == pytz.timezone('Etc/GMT+8')
4747

4848

49-
def test_midc_format_index_raw():
49+
def test_midc__format_index_raw():
5050
data = pd.read_csv(MIDC_RAW_TESTFILE)
51-
data = midc.format_index_raw(data)
51+
data = midc._format_index_raw(data)
5252
start = pd.Timestamp('20181018 00:00')
5353
start = start.tz_localize('MST')
5454
end = pd.Timestamp('20181018 23:59')

pvlib/tests/iotools/test_srml.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ def test_read_srml_dt_index(url, year, month):
7070
('2001', '2001'),
7171
('2017', 'dni_7')
7272
])
73-
def test_map_columns(column, expected):
74-
assert srml.map_columns(column) == expected
73+
def test__map_columns(column, expected):
74+
assert srml._map_columns(column) == expected
7575

7676

7777
@pytest.mark.remote_data

0 commit comments

Comments
 (0)