Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

scalar inputs yield ndim=0 array outputs #646

Copy link
Copy link
Open
@wholmgren

Description

@wholmgren
Issue body actions

Describe the bug
pvlib has a policy that the output type should be as similar as possible to the input type. So, for all scalar input, most functions should return a scalar output. However, some functions return ndim=0 array outputs instead of true scalars. I know this happens with irradiance.perez, but I think it happens with a handful of functions.

To Reproduce

    out = irradiance.perez(40, 180, 118.45831879, 939.95469881,
                           1321.1655834833093, 10.56413562, 144.76567754,
                           1.01688136)
    assert np.isscalar(out)

Expected behavior
The function should return a scalar, not an ndim=0 array.

Versions:

  • pvlib.__version__: 0.6.0
  • pandas.__version__: many
  • numpy.__version__: many
  • python: many

Additional context
We've previously discussed creating utility functions and decorators to handle type issues like this one. See #635 for example.

The first thing we need to do is catalog which functions exhibit this behavior.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.