Skip to content

Commit aaf33eb

Browse files
odowcwhanse
authored andcommitted
Add kwargs to forecast.get_data with tests (#746)
* Add kwargs to forecast.get_data with tests * Update whatsnew * Fix a mis-placed merge in whatsnew/v0.7.0.rst * Simplify the tests in test_forecast.py and add descriptive comment
1 parent 695ec23 commit aaf33eb

File tree

3 files changed

+36
-2
lines changed

3 files changed

+36
-2
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,15 @@ recommend all users of v0.6.3 upgrade to this release after checking API
88
compatibility notes.
99

1010
**Python 2.7 support ended on June 1, 2019**. (:issue:`501`)
11-
1211
**Minimum numpy version is now 1.10.4. Minimum pandas version is now 0.18.1.**
1312

13+
Bug fixes
14+
~~~~~~~~~
15+
* Fix handling of keyword arguments in `forecasts.get_processed_data`.
16+
(:issue:`745`)
1417

1518
Contributors
1619
~~~~~~~~~~~~
1720
* Mark Campanellli (:ghuser:`markcampanelli`)
1821
* Will Holmgren (:ghuser:`wholmgren`)
22+
* Oscar Dowson (:ghuser:`odow`)

pvlib/forecast.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ def set_location(self, time, latitude, longitude):
201201

202202
def get_data(self, latitude, longitude, start, end,
203203
vert_level=None, query_variables=None,
204-
close_netcdf_data=True):
204+
close_netcdf_data=True, **kwargs):
205205
"""
206206
Submits a query to the UNIDATA servers using Siphon NCSS and
207207
converts the netcdf data to a pandas DataFrame.
@@ -223,6 +223,8 @@ def get_data(self, latitude, longitude, start, end,
223223
close_netcdf_data: bool, default True
224224
Controls if the temporary netcdf data file should be closed.
225225
Set to False to access the raw data.
226+
**kwargs:
227+
Additional keyword arguments are silently ignored.
226228
227229
Returns
228230
-------

pvlib/test/test_forecast.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,34 @@ def test_process_data(model):
7575
.format(model, variable))
7676

7777

78+
@requires_siphon
79+
def test_bad_kwarg_get_data():
80+
# For more information on why you would want to pass an unknown keyword
81+
# argument, see Github issue #745.
82+
amodel = NAM()
83+
data = amodel.get_data(_latitude, _longitude, _start, _end,
84+
bad_kwarg=False)
85+
assert not data.empty
86+
87+
88+
@requires_siphon
89+
def test_bad_kwarg_get_processed_data():
90+
# For more information on why you would want to pass an unknown keyword
91+
# argument, see Github issue #745.
92+
amodel = NAM()
93+
data = amodel.get_processed_data(_latitude, _longitude, _start, _end,
94+
bad_kwarg=False)
95+
assert not data.empty
96+
97+
98+
@requires_siphon
99+
def test_how_kwarg_get_processed_data():
100+
amodel = NAM()
101+
data = amodel.get_processed_data(_latitude, _longitude, _start, _end,
102+
how='clearsky_scaling')
103+
assert not data.empty
104+
105+
78106
@requires_siphon
79107
def test_vert_level():
80108
amodel = NAM()

0 commit comments

Comments
 (0)