-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[DRAFT] Allow arbitrary IAM function in pvlib.iam.marion_diffuse #2050
base: main
Are you sure you want to change the base?
Conversation
Before I work through the full checklist, I'm hoping a maintainer can do an early review of this to ensure it will be accepted. I have added tests that also show how everything works, including how this adds support for using the existing If this work should proceed, then I would be happy to add usage examples in separate scripts. |
@markcampanelli code structure looks fine to me. I am not sure why adding |
@cwhanse Thanks much for taking an early look for purposes of direction and scope. In #2049, @adriesse suggesting mking In any event, I will keep the |
@cwhanse @adriesse I decided simply to not add the PCHIP interpolator to the codebase, but it does appear as the main test case in One issue I hit trying to integrate I think my only remaining technical question is do I have to support the full |
@@ -92,7 +145,7 @@ def ashrae(aoi, b=0.05): | |||
return iam | |||
|
|||
|
|||
def physical(aoi, n=1.526, K=4.0, L=0.002, *, n_ar=None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All this does is require that the n_ar
argument be named, which seems like an antipattern for this codebase.
@markcampanelli a few in-flight comments:
|
@cwhanse @kandersolar The Question: Are folks open to switching the Note that it has become too much to ask for the |
Unfortunately, Python does not have true constant/immutable types, thus Python "constants" carry a risk that they will be mutated when used (often unintentionally, and causing horribly subtle bugs). By using a "getter" function instead, this mutation risk is greatly reduced. In this case, I did not make make it a private function because it gets used (like the pseudo-constant it supersedes) outside the module in which it is defined.
The name
Understood, but I have the present benefit of looking at this code with fresh eyes and seeing how hard it was to track down how different pieces are used in different parts, including outside this immediate Python module in the |
I would still make |
@markcampanelli I think the scope of this PR is becoming too broad. Can you break the PR into several smaller bites? |
@cwhanse Here is a proposal for two separate PRs:
Thoughts? |
Do we need to touch spectrum.mismatch.sapm to accomplish the end goal (allow any IAM model to be used with the Marion diffuse calculation)? If we don't need to change it, I would leave it of this initiative. If we change both IAM and spectrum functions, I would divide #1 into two parts (separate iam and spectrum). We could get by without deprecating the old iam.sapm function since I doubt it gets used. But spectrum.mismatch.sapm probably does get used and should be deprecated until v0.12. Overall I support the initiative here, to normalize the interfaces for these lower-level functions. |
docs/sphinx/source/reference
for API changes.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`
).remote-data
) and Milestone are assigned to the Pull Request and linked Issue.TODOs: