pvlib-python icon indicating copy to clipboard operation
pvlib-python copied to clipboard

Equation in docstring of `pvlib.iam.martin_ruiz` does not match code

Open kandersolar opened this issue 2 years ago • 1 comments

The docstring of pvlib.iam.martin_ruiz includes an equation defining the IAM:

https://github.com/pvlib/pvlib-python/blob/bdbaf4c238ce2b373d04af48193b14659662cef1/pvlib/iam.py#L230-L231

This equation does not match what is implemented in the code (specifically, cos(aoi / a_r) versus cos(aoi) / a_r):

https://github.com/pvlib/pvlib-python/blob/bdbaf4c238ce2b373d04af48193b14659662cef1/pvlib/iam.py#L269

The formatting in the original reference leaves room for doubt in which of these is correct. IEC 61853-2 is unambiguous and specifies the version implemented in the code.

Correcting the docstring to match the code would be a good first PR for a new contributor!


The MATLAB version suffers from this same inconsistency: https://github.com/sandialabs/MATLAB_PV_LIB/blob/master/pvl_iam_martinruiz.m#L30

kandersolar avatar Sep 29 '22 16:09 kandersolar

Confirmed: code is correct, docstring is in error.

cwhanse avatar Sep 29 '22 16:09 cwhanse