question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

pvsystem.Array.get_irradiance raises an error if solar_zenith is passed as a float

See original GitHub issue

Bug Description pvsystem.get_irradiance documentation says solar_zenith can be passed as a float or a Series. However, if dni_extra is not defined and solar_zenith is passed as float, then solar_zenith.index is not defined and the call to irradiance.get_extra_irradiance with solar_zenith.index as an argument fails.

To Reproduce Steps to reproduce the behavior: test_sys = pvsystem.PVSystem() test_sys.get_irradiance(0.0, 0.0, 0.0, 0.0, 0.0)

Error message AttributeError: 'float' object has no attribute 'index'

Expected behavior Return a DataFrame containing the irradiance components, as specified in the documentation.

Possible solutions

  1. Ask for datetime if dni_extra is not passed as argument
  2. Remove float from supported types for solar_zenith

Versions:

  • pvlib.__version__: 0.9.0
  • pandas.__version__: 1.3.3
  • python: 3.9

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:15 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
wholmgrencommented, Nov 19, 2021

*must be a Series with a DatetimeIndex.

I also like @kanderso-nrel’s suggestion in https://github.com/pvlib/pvlib-python/issues/1338#issuecomment-967232590

2reactions
adriessecommented, Nov 17, 2021

Most or all of the bottom layer functions work with scalars and I think that’s important. May be less so for the classes, but still desirable.

Read more comments on GitHub >

github_iconTop Results From Across the Web

PVSystem. - get_irradiance - pvlib python
solar_zenith (float or Series) – Solar zenith angle. ... If passed as a tuple the length must be the same as the number...
Read more >
pvlib_python Documentation - Read the Docs
A system with multiple arrays is specified by passing a list of Array to the PVSystem constructor. For a PV system.
Read more >
pvlib-python/pvsystem.py at main - GitHub
Decorator to warn or error when getting and setting the "pass-through". PVSystem ... PVSystems with only one Array and raises an error for...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found