Skip to content

Behavior of calcparams and singlediode function could be improved #1626

Description

@cwhanse

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, and ivcurve_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. When ivcurve_pnts is specified, pvsystem.singlediodereturns 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.4
  • pandas.__version__: 1.2.4

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions