Skip to content

Commit

Permalink
Add kwargs to forecast.get_data with tests (#746)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
odow authored and cwhanse committed Jul 10, 2019
1 parent 695ec23 commit aaf33eb
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 2 deletions.
6 changes: 5 additions & 1 deletion docs/sphinx/source/whatsnew/v0.7.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,15 @@ recommend all users of v0.6.3 upgrade to this release after checking API
compatibility notes.

**Python 2.7 support ended on June 1, 2019**. (:issue:`501`)

**Minimum numpy version is now 1.10.4. Minimum pandas version is now 0.18.1.**

Bug fixes
~~~~~~~~~
* Fix handling of keyword arguments in `forecasts.get_processed_data`.
(:issue:`745`)

Contributors
~~~~~~~~~~~~
* Mark Campanellli (:ghuser:`markcampanelli`)
* Will Holmgren (:ghuser:`wholmgren`)
* Oscar Dowson (:ghuser:`odow`)
4 changes: 3 additions & 1 deletion pvlib/forecast.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ def set_location(self, time, latitude, longitude):

def get_data(self, latitude, longitude, start, end,
vert_level=None, query_variables=None,
close_netcdf_data=True):
close_netcdf_data=True, **kwargs):
"""
Submits a query to the UNIDATA servers using Siphon NCSS and
converts the netcdf data to a pandas DataFrame.
Expand All @@ -223,6 +223,8 @@ def get_data(self, latitude, longitude, start, end,
close_netcdf_data: bool, default True
Controls if the temporary netcdf data file should be closed.
Set to False to access the raw data.
**kwargs:
Additional keyword arguments are silently ignored.
Returns
-------
Expand Down
28 changes: 28 additions & 0 deletions pvlib/test/test_forecast.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,34 @@ def test_process_data(model):
.format(model, variable))


@requires_siphon
def test_bad_kwarg_get_data():
# For more information on why you would want to pass an unknown keyword
# argument, see Github issue #745.
amodel = NAM()
data = amodel.get_data(_latitude, _longitude, _start, _end,
bad_kwarg=False)
assert not data.empty


@requires_siphon
def test_bad_kwarg_get_processed_data():
# For more information on why you would want to pass an unknown keyword
# argument, see Github issue #745.
amodel = NAM()
data = amodel.get_processed_data(_latitude, _longitude, _start, _end,
bad_kwarg=False)
assert not data.empty


@requires_siphon
def test_how_kwarg_get_processed_data():
amodel = NAM()
data = amodel.get_processed_data(_latitude, _longitude, _start, _end,
how='clearsky_scaling')
assert not data.empty


@requires_siphon
def test_vert_level():
amodel = NAM()
Expand Down

0 comments on commit aaf33eb

Please sign in to comment.