Skip to content

Commit 62535f8

Browse files
authored
Change freq M to MS (#2473)
* Change freq M to MS * Use MS for test_clearsky * Change to start.date().replace(day=1) * Fix linter
1 parent 4ef2813 commit 62535f8

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

pvlib/iotools/bsrn.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,7 @@ def get_bsrn(station, start, end, username, password,
162162
end = pd.to_datetime(end)
163163

164164
# Generate list files to download based on start/end (SSSMMYY.dat.gz)
165-
filenames = pd.date_range(
166-
start, end.replace(day=1) + pd.DateOffset(months=1), freq='1M')\
165+
filenames = pd.date_range(start.date().replace(day=1), end, freq='1MS')\
167166
.strftime(f"{station}%m%y.dat.gz").tolist()
168167

169168
# Create FTP connection

pvlib/iotools/srml.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,8 +236,7 @@ def get_srml(station, start, end, filetype='PO', map_variables=True,
236236
end = pd.to_datetime(end)
237237

238238
# Generate list of months
239-
months = pd.date_range(
240-
start, end.replace(day=1) + pd.DateOffset(months=1), freq='1M')
239+
months = pd.date_range(start.date().replace(day=1), end, freq='1MS')
241240
months_str = months.strftime('%y%m')
242241

243242
# Generate list of filenames

tests/test_clearsky.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -224,8 +224,9 @@ def test_lookup_linke_turbidity_nointerp():
224224

225225

226226
def test_lookup_linke_turbidity_months():
227-
times = pd.date_range(start='2014-04-01', end='2014-07-01',
228-
freq='1M', tz='America/Phoenix')
227+
times = pd.date_range(start='2014-05-01', end='2014-07-01',
228+
freq='1MS', tz='America/Phoenix',
229+
) - pd.Timedelta(days=1)
229230
expected = pd.Series(
230231
np.array([2.89918032787, 2.97540983607, 3.19672131148]), index=times
231232
)
@@ -234,8 +235,9 @@ def test_lookup_linke_turbidity_months():
234235

235236

236237
def test_lookup_linke_turbidity_months_leapyear():
237-
times = pd.date_range(start='2016-04-01', end='2016-07-01',
238-
freq='1M', tz='America/Phoenix')
238+
times = pd.date_range(start='2016-05-01', end='2016-07-01',
239+
freq='1MS', tz='America/Phoenix',
240+
) - pd.Timedelta(days=1)
239241
expected = pd.Series(
240242
np.array([2.89918032787, 2.97540983607, 3.19672131148]), index=times
241243
)
@@ -245,14 +247,16 @@ def test_lookup_linke_turbidity_months_leapyear():
245247

246248
def test_lookup_linke_turbidity_nointerp_months():
247249
times = pd.date_range(start='2014-04-10', end='2014-07-10',
248-
freq='1M', tz='America/Phoenix')
250+
freq='1MS', tz='America/Phoenix',
251+
) - pd.Timedelta(days=1)
249252
expected = pd.Series(np.array([2.85, 2.95, 3.]), index=times)
250253
out = clearsky.lookup_linke_turbidity(times, 32.125, -110.875,
251254
interp_turbidity=False)
252255
assert_series_equal(expected, out)
253256
# changing the dates shouldn't matter if interp=False
254257
times = pd.date_range(start='2014-04-05', end='2014-07-05',
255-
freq='1M', tz='America/Phoenix')
258+
freq='1MS', tz='America/Phoenix',
259+
) - pd.Timedelta(days=1)
256260
out = clearsky.lookup_linke_turbidity(times, 32.125, -110.875,
257261
interp_turbidity=False)
258262
assert_series_equal(expected, out)

0 commit comments

Comments
 (0)