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
373 stars 125 forks source link

Some checks for Clearness index to keep ìt between 0 and 1 #103

Open raghu1121 opened 5 years ago

raghu1121 commented 5 years ago

It seems in some scenarios i observed KT > 1 and ZeroDivisionError. So i made changes to my own code like this. This might be helpful for others.

    try:
        KT = (ghi_data / EXTR1)
        if KT > 1:
            KT = 1
    except ZeroDivisionError:
        return 0
    return KT 
pingswept commented 5 years ago

Fixed by commit 61855079. Thanks for the patch!

pingswept commented 5 years ago

Sorry, had to revert this, as it broke the build.

This broke the build with this error on Python 3.4: ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

I suspect this could be fixed pretty easily if anyone has the inclination.