Is it possible using Python libraries like pysolar, pvlib or similarly to calculate the
If you do not already have irradiance data I would recommend either using data from PVGIS or NREL's NSRDB PSM3 (Americas).
In either case, I would suggest you first get familiar with the service through the web application. This should give you a good idea of the geographical coverage and the available parameters and settings.
Then, you can use the corresponding pvlib function to programmatically retrieve data. The function to retrieve PVGIS hourly data is: pvlib.iotools.get_pvgis_hourly().
A short example of how to retrieve irradiance data from PVGIS is shown below:
import pvlib
import pandas as pd
data, inputs, meta = pvlib.iotools.get_pvgis_hourly(
latitude=55.7905, # North is positive
longitude=12.5250, # East is positive
start=pd.Timestamp('2020-01-01'), # First available year is 2005
end=pd.Timestamp('2020-12-31'), # Last available year is 2020 (depends on database)
raddatabase='PVGIS-SARAH2',
surface_tilt=5, # surface tilt angle
surface_azimuth=0, # 0 degrees corresponds to south
components=True, # Whether you want the individual components or just the total
url='https://re.jrc.ec.europa.eu/api/v5_2/', # URL for version 5.2
)
data[['poa_direct','poa_sky_diffuse','poa_ground_diffuse']].plot(
figsize=(6,4), subplots=True, sharex=True)