iam.schlick_diffuse returns inf and nan at surface_tilt=180
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
Research direction
Start by reading pvlib.iam.schlick_diffuse and its tests for the existing surface_tilt=0 ground-term special case. Reproduce the reported result at surface_tilt=180, then check both diffuse components at the endpoints and nearby tilts. Done when the function returns the expected sky and ground values without a divide-by-zero warning, with regression tests covering the behavior.
Written by the indexing model from the issue text.
Description
Describe the bug
pvlib.iam.schlick_diffuse(180) returns {'sky': inf, 'ground': nan} with a RuntimeWarning: divide by zero. Eq 4 for the sky term divides by 1 + cos(surface_tilt), which is 0/0 at 180. The ground term is already special-cased at tilt 0 (surface_tilt < 1e-6); the sky term has no equivalent at 180.
To Reproduce
import pvlib
pvlib.iam.schlick_diffuse(180)
# {'sky': inf, 'ground': nan}
Expected behavior
sky is 0 (a surface facing straight down sees no sky; the value tends to 0 as the tilt approaches 180) and ground is 20/21 = 0.9524, the same as sky at tilt 0. marion_diffuse('schlick', surface_tilt=180) gives 0 and 0.95236.
Versions:
pvlib.__version__: 0.16.2.dev19+gc5de586d7pandas.__version__: 3.1.1- python: 3.12.12
Additional context
Found while reading the code. PVSystem.get_iam_diffuse(180, iam_model='schlick_diffuse') returns the same. I can open a PR that applies the same 1e-6 clamp to the sky term.
- Dominant language
- Python
- Stars
- 1.7k
- Forks
- 1.2k
- Avg merge
- 3d 4h
- Merged PRs (30d)
- 8
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from pvlib/pvlib-python
-
detect_clearsky and prilliman fail on DST days, kimber fails on tz-naive data (since #2924)Possibly taken @pranaysb claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
pvlib/pvlib-python#2935 ·
Maintainers usually reply within 1 day
-
documentation
Difficulty 1/5 Under an hour Newbie friendliness 72/100
pvlib/pvlib-python#2921 · 4 comments · 3 reactions ·
Maintainers usually reply within 1 day
-
Possibility of beam irradiance from behind plane of arrayMay be free again A pull request for this issue was closed without being merged. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
pvlib/pvlib-python#2903 · 5 comments · 2 reactions ·
Maintainers usually reply within 1 day
-
use offset parameter instead of calculating bday in cdromPossibly taken @chenyi6758-source claimed this 20 days ago. Open
Difficulty 1/5 Under an hour Newbie friendliness 92/100
pvlib/pvlib-python#2902 ·
Maintainers usually reply within 1 day
-
Add an example or documentation on using 'bhi' from ERA5May be free again @anshurajbisoyi98-ctrl claimed this 35 days ago, and no pull request is open. Open
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
pvlib/pvlib-python#2880 · 2 comments ·
Maintainers usually reply within 1 day
All issues in pvlib/pvlib-python
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
adafruit/Fruit-Jam-OS#98 ·
-
python triage
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
microsoft/semantic-kernel#14753 ·
Maintainers usually reply within 5 days
-
area:cli area:configuration documentation priority:low size:small
Difficulty 1/5 1-3 hours Newbie friendliness 80/100
RonaldHensbergen/composable-data-stack#1222 ·
Maintainers usually reply within 1 day
-
bug python
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
Maintainers usually reply within 1 day
-
area: i18n bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 3 days