Behavior of calcparams and singlediode function could be improved #1626
Closed
Description
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:
- When
pvsystem.calcparams_
functions have float inputs, some of the outputs are arrays. - When
pvsystem.calcparams_
functions have Series input, not all output are Series, and some of the output Series inherits a name from the input Series. - When
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. - When
ivcurve_pnts=None
(default)pvsystem.singlediode
returns a DataFrame. Whenivcurve_pnts
is specified,pvsystem.singlediode
returns an OrderedDict. - When multiple IV curves are to be calculated with IV curve points, the IV curves are row-by-row, so must be transposed to be plotted.
To Reproduce
gist here
Expected behavior
- calcparams functions return floats when all inputs are floats
- when Series are returned, don't inherit name from input (e.g. 'temp_cell' for the saturation current)
- IV curve points should be transposed for convenient plotting
- Consider always returning a DataFrame from singlediode.
Versions:
pvlib.__version__
: 0.9.4pandas.__version__
: 1.2.4
Metadata
Assignees
Labels
No labels