question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

pvlib.solarposition.spa_python has unused and undocumented **kwargs

See original GitHub issue

pvlib.solarposition.spa_python has **kwargs in the signature, but it doesn’t mention it in the docstring, and it doesn’t do anything with it in the function body.

https://github.com/pvlib/pvlib-python/blob/c2431832040f585969bbd1868f6acdd6ddb4e0a5/pvlib/solarposition.py#L276-L278

This is bad because it silently ignores misspelled optional parameters, for example: pvlib.solarposition.spa_python(times, 40, -80, atlitude=100).


We could just deprecate and remove **kwargs like #1053:

https://github.com/pvlib/pvlib-python/blob/a6667a390d048d4301f73acef3267596dc1fafcd/pvlib/location.py#L83-L87

Or we could keep **kwargs and pass them through to spa.solar_position(), thereby exposing the sst and esd parameters. Though if we want to expose those, I’d prefer just exposing them directly instead of hiding them in **kwargs.

This could be a good “easy first issue” once we decide what the fix should be.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
wholmgrencommented, Mar 23, 2022

I’d support removing without deprecation. Only impact on users will be to reveal bugs in their code.

1reaction
cwhansecommented, Mar 30, 2022

I agree, no reason that any solar position function needs turbidity. What do you think about handling the **kwargs in pvlib.solarposition.get_solarposition instead of in the Location methods?

Read more comments on GitHub >

github_iconTop Results From Across the Web

pvlib.solarposition.spa_python
Calculate the solar position using a python implementation of the NREL SPA algorithm described in [1]. If numba is installed, the functions can...
Read more >
pvlib.location — pvlib python 0.9.3 documentation
Location objects have two timezone attributes: * ``tz`` is a IANA timezone ... 12 kwargs passed to :py:func:`pvlib.solarposition.get_solarposition` Returns ...
Read more >
pvlib.solarposition.get_solarposition
A convenience wrapper for the solar position calculators. ... If None, computed from pressure. Assumed to be 0 m if pressure is also...
Read more >
Location. get_solarposition - pvlib python - Read the Docs
Uses the solarposition.get_solarposition() function to calculate the solar zenith, azimuth, etc. at this location. Parameters:.
Read more >
Location. get_solarposition - pvlib python - Read the Docs
solarposition.get_solarposition() function to calculate the solar zenith, azimuth, etc. at this location. Parameters. times (pandas.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found