Skip to content

Set all diffuse IAM outputs to dict - #2842

Open
cbcrespo wants to merge 3 commits into
pvlib:mainfrom
cbcrespo:iam-dict-output
Open

Set all diffuse IAM outputs to dict#2842
cbcrespo wants to merge 3 commits into
pvlib:mainfrom
cbcrespo:iam-dict-output

Conversation

@cbcrespo

@cbcrespo cbcrespo commented Aug 11, 2026

Copy link
Copy Markdown
Contributor
  • Closes Inconsistent output types between diffuse IAM functions #2837
  • I am familiar with the contributing guidelines
  • I attest that all AI-generated material has been vetted for accuracy and is in compliance with the pvlib license
  • Tests added
  • Updates entries in docs/sphinx/source/reference for API changes.
  • Adds description and name entries in the appropriate "what's new" file in docs/sphinx/source/whatsnew for all changes. Includes link to the GitHub Issue with :issue:`num` or this Pull Request with :pull:`num`. Includes contributor name and/or GitHub username (link with :ghuser:`user`).
  • New code is fully documented. Includes numpydoc compliant docstrings, examples, and comments where necessary.
  • Pull request is nearly complete and ready for detailed review.
  • Maintainer: Appropriate GitHub Labels (including remote-data) and Milestone are assigned to the Pull Request and linked Issue.

This PR sets all diffuse IAM outputs to dict to avoid inconsistencies between functions. Previously, the output of marion_diffuse was a dict, but schlick_diffuse and martin_ruiz_diffuse returned tuples.

Comment thread pvlib/iam.py Outdated
Comment thread pvlib/iam.py
iam_sky : numeric
The incident angle modifier for sky diffuse
iam : dict
IAM values for each type of diffuse irradiance (assuming isotropy):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
IAM values for each type of diffuse irradiance (assuming isotropy):
IAM values for each type of diffuse irradiance:

This remark belongs in the docstring's summary section. It's about the model's assumption, rather than describing the values returned by the model. Placing it on the parameter description suggests that there's an option to consider non-isotropic irradiance.

    Determine the incidence angle modifiers (IAMs) for sky diffuse and
    ground-reflected irradiance using the Martin and Ruiz incident angle model.

    As described in [1]_, the IAMs result from integrals that assume the incoming
    sky diffuse and ground-reflected irradiance are isotropic.

Comment thread pvlib/iam.py
Comment on lines 588 to 589
Determine diffuse irradiance incidence angle modifiers using Marion's
method of integrating over solid angle.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Determine diffuse irradiance incidence angle modifiers (IAMs) using Marion's
method of integrating over solid angle.
The integration assumes the incoming diffuse irradiance is isotropic.

Comment thread pvlib/iam.py
-------
iam : dict
IAM values for each type of diffuse irradiance:
IAM values for each type of diffuse irradiance (assuming isotropy):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
IAM values for each type of diffuse irradiance (assuming isotropy):
IAM values for each type of diffuse irradiance:

Comment thread pvlib/iam.py
iam_sky : numeric
The incident angle modifier for sky diffuse.
iam : dict
IAM values for each type of diffuse irradiance (assuming isotropy):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
IAM values for each type of diffuse irradiance (assuming isotropy):
IAM values for each type of diffuse irradiance:

Comment thread pvlib/iam.py
Unlike the Fresnel reflection factor itself, Schlick's approximation can
be integrated analytically to derive a closed-form equation for diffuse
IAM factors for the portions of the sky and ground visible
from a tilted surface if isotropic distributions are assumed.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isotropy stated here.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Inconsistent output types between diffuse IAM functions

3 participants