You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
pvlib.solarposition.spa_python has unused and undocumented **kwargs #1430
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.
'Arbitrary Location kwargs are deprecated and will be '
'removed in v0.9', pvlibDeprecationWarning
)
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.
@kanderso-nrel it looks like the **kwargs are used to pass linke_turbidity through to spa_python from get_solarposition see the test failures for #1437
Looks like Location.get_clearsky() should be more careful about what it passes through to the solar position functions; there's no reason to pass turbidity, airmass etc through to any solar position model right? Maybe _build_kwargs is the solution here, or just using kwargs.pop() like Location.get_clearsky() does for the clearsky portion.
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?
What do you think about handling the **kwargs in pvlib.solarposition.get_solarposition instead of in the Location methods?
If the handling raises a TypeError when something like linke_turbidity is passed in, I don't think it avoids the problem of needing to change how Location.get_clearsky() passes kwargs around. And if it doesn't raise an error for inappropriate inputs, I think it's just shifting the problem of "silently ignoring misspelled optional parameters" to a different, and probably more commonly used, function.
On the other hand, I don't like trying to subset **kwargs in Location.get_clearsky() either since having location.py keep track of the many and various solar position parameters is not DRY.
Noting that it currently doesn't work to specify solar position kwargs in Location.get_clearsky() anyway (TypeError: ineichen() got an unexpected keyword argument 'temperature'), maybe the easiest way forward here is to just stop using **kwargs for the solar position part of Location.get_clearsky(). No functionality is lost, and people that want to customize it can still pass in their own solar position.
Semi-related: pvlib.irradiance.get_total_irradiance also has unused **kwargs; might as well fix that along with spa_python.
Activity
wholmgren commentedon Mar 23, 2022
I'd support removing without deprecation. Only impact on users will be to reveal bugs in their code.
Naman-Priyadarshi commentedon Mar 28, 2022
I'll work on the issue
cwhanse commentedon Mar 30, 2022
@kanderso-nrel it looks like the
**kwargsare used to passlinke_turbiditythrough tospa_pythonfromget_solarpositionsee the test failures for #1437kandersolar commentedon Mar 30, 2022
Looks like
Location.get_clearsky()should be more careful about what it passes through to the solar position functions; there's no reason to pass turbidity, airmass etc through to any solar position model right? Maybe_build_kwargsis the solution here, or just usingkwargs.pop()likeLocation.get_clearsky()does for the clearsky portion.cwhanse commentedon Mar 30, 2022
I agree, no reason that any solar position function needs turbidity. What do you think about handling the
**kwargsinpvlib.solarposition.get_solarpositioninstead of in theLocationmethods?kandersolar commentedon Apr 4, 2022
If the handling raises a TypeError when something like
linke_turbidityis passed in, I don't think it avoids the problem of needing to change howLocation.get_clearsky()passeskwargsaround. And if it doesn't raise an error for inappropriate inputs, I think it's just shifting the problem of "silently ignoring misspelled optional parameters" to a different, and probably more commonly used, function.On the other hand, I don't like trying to subset
**kwargsinLocation.get_clearsky()either since havinglocation.pykeep track of the many and various solar position parameters is not DRY.Noting that it currently doesn't work to specify solar position kwargs in
Location.get_clearsky()anyway (TypeError: ineichen() got an unexpected keyword argument 'temperature'), maybe the easiest way forward here is to just stop using**kwargsfor the solar position part ofLocation.get_clearsky(). No functionality is lost, and people that want to customize it can still pass in their own solar position.Semi-related:
pvlib.irradiance.get_total_irradiancealso has unused**kwargs; might as well fix that along withspa_python.cwhanse commentedon Apr 5, 2022
I concur.