[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[pysolar-discuss] get_radiation_direct


Hi,

I tried to use get_radiation_direct, but I doubt that the results are
correct. The radiation for noon in spring is much stronger then for noon in
summer. You can easily check with the following code:

from pysolar import solar
import datetime as dt
import dateutil
import time
import matplotlib.pyplot as plt
import numpy as np

# for when in [dt.datetime(2017,3,21,12,0), dt.datetime(2017,6,21,12,0)]:
results = []
for days in range(365):
    # when = dt.datetime(2017,1,1,12,0) + dt.timedelta(days=days)
    when = dt.datetime.fromtimestamp(time.mktime((2017, 1, 1, 12, 0,
0, 0, 0, 0)), tz=dateutil.tz.tzoffset("CET", 1*60*60)) +
dt.timedelta(days=days)
    altitude = solar.get_altitude(48.1980552, 16.3508735, when)
    power = solar.radiation.get_radiation_direct(when, altitude)
    print(altitude, power)
    day = when.utctimetuple().tm_yday
    results.append((day, power,
solar.radiation.get_apparent_extraterrestrial_flux(day),
solar.radiation.get_optical_depth(day),
solar.radiation.get_air_mass_ratio(altitude)))
    print(results[-1])

r = np.array(results)
ax = None
for i in range(1,5):
    ax = plt.subplot(4,1,i, sharex=ax)
    plt.plot(r[:,i])
plt.show()

[image: pysolar.png]

Maybe the function works for the southern hemisphere only, or do I need to
consider the actual angle in addition?

I miss the theoretical background. Can somebody please give me a hint, how
to correct it.

Thanks,
Mick

PNG image