-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Behavior of calcparams and singlediode function could be improved #1626
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
Comments
Nice gist.
Do you propose casting
This problem is not unique to these functions. A couple of functions have code like this, but I would hate to see this in every function: pvlib-python/pvlib/irradiance.py Lines 225 to 228 in 57625c3
A wrapper function for input/output types could solve this among other problems. Also item 1.
Related discussion in #418. I still think |
My primary aims would be to 1) have these functions return consistent output for single vs. array-like input, and 2) avoid .T when making plots. Yes, I think I'd be OK if I'm willing to agree to removing |
Here's another corner case that we missed with tests. The vectorized newton solver doesn't work if parameters are Series of length one.
|
Good ideas and initiatives. Regarding the transposition for convenient graphing, I have the impression I have to do this from time to time with results from numpy or scipy too. Most important thing is that the output shapes broadcast appropriately to downstream vectorized calculations. |
Those two pull requests completed the checkmarks in the opening comment of this issue, so I think it can be closed. |
Agree, we can close. I made #1787 for #1626 (comment) |
The type and shape of output from calcparams and singlediode functions have some oddities that make the output somewhat annoying and may pose a risk of code breaking if pandas/numpy broadcasting and/or typecasting change.
Observations:
pvsystem.calcparams_
functions have float inputs, some of the outputs are arrays.pvsystem.calcparams_
functions have Series input, not all output are Series, and some of the output Series inherits a name from the input Series.pvsystem.singlediode
has length 1 irradiance and temperature, andivcurve_pnts=N
is specified, the returned arrays are shape (1, N), and so must be transposed to plot the I-V curve.ivcurve_pnts=None
(default)pvsystem.singlediode
returns a DataFrame. Whenivcurve_pnts
is specified,pvsystem.singlediode
returns an OrderedDict.To Reproduce
gist here
Expected behavior
Versions:
pvlib.__version__
: 0.9.4pandas.__version__
: 1.2.4The text was updated successfully, but these errors were encountered: