Skip to content
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

Add kwargs to forecast.get_data with tests #746

Merged
merged 6 commits into from
Jul 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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()
odow marked this conversation as resolved.
Show resolved Hide resolved
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