pythonnumpy-ndarraypvlib

Solar Zenith Angle for many coordinates using PVLIB


I need calculate the solar zenith angle for approximately 106.000.000 of different coordinates. This coordinates are referrals to the pixels from an image projected at Earth Surface after the image had been taken by camera into the airplane.

I am using the pvlib.solarposition.get_position() to calculate the solar zenith angle. The values returned are being calculated correctly (I compared some results with NOOA website) but, how I need calculate the solar zenith angle for many couple of coordinates, the python is spending many days (about 5 days) to finish the execution of the function.

How I am a beginner in programming, I wonder is there is any way to accelerate the solar zenith angle calculation.

Below found the part of the code implemented which calculate the solar zenith angle:

sol_apar_zen = [] 
    for i in range(size3):
        solar_position = np.array(pvl.solarposition.get_solarposition(Data_time_index, lat_long[i][0], lat_long[i][1]))
        sol_apar_zen.append(solar_position[0][0])
 print(len(sol_apar_zen))

Solution

  • Since your coordinates represent a grid, another option would be to calculate the zenith angle for a subset of your coordinates, and the do a 2-d interpolation to obtain the remainder. 1 in 100 in both directions would reduce your calculation time by a factor of 10000.