pingswept / pysolar

Pysolar is a collection of Python libraries for simulating the irradiation of any point on earth by the sun. It includes code for extremely precise ephemeris calculations.
http://pysolar.org
GNU General Public License v3.0
372 stars 125 forks source link

RuntimeWarning: invalid value encountered in true_divide KT = (ghi_data / EXTR1) #136

Open mborsetti opened 3 years ago

mborsetti commented 3 years ago

Cannot figure out what's causing this warning during testing:

[...]\pysolar\util.py:690: RuntimeWarning: invalid value encountered in true_divide KT = (ghi_data / EXTR1)

Somehow unit testing succeeds, even though it reads ominously

pingswept commented 3 years ago

I’d guess that it’s a divide-by-zero error.

EXTR1 represents extraterrestrial radiation. Generally, that should be around 1366 W/m^2, so it’s probably just being tested weirdly, rather than a real bug in operation.

The line of code in question is here: https://github.com/pingswept/pysolar/blob/b539efbd1c45bfac5ea51f8ee1f5f101cbb69dac/pysolar/util.py#L690

Patches welcome from everyone, as always.