Closed
Description
Describe the bug
the disc method has a lot of power and polynomials. IMO whenever possible, polynomials should use Horner's method which is already implemented in np.polyval
but is easy to reimplement if needed.
To Reproduce
pvlib-python/pvlib/irradiance.py
Lines 1405 to 1422 in 8b98768
0.512 - 1.56*kt + 2.286*kt2 - 2.222*kt3
becomes
0.512 - kt * (1.56 + kt * (2.286 - 2.222 * kt))
or
np.polyval([-2.222, 2.286, -1.56, 0.512], kt)
Expected behavior
a few math tricks like this (atan2, log1p, Horner's method, etc.) are musts for efficiency and numerical stability.
Versions:
pvlib.__version__
: 0.8.1