Sun Elevation (altitude) angle

Dear ninjas, thank you for this website! I am using raw data for solar PV in SAM, and SAM uses either DNI, DHI or GHI (2 out of 3 is enough). Here, I see that beam irradiance is the output (DNI*cos(theta_z)), so I cannot use it in SAM, but I also don’t want to use DHI & GHI input to calculate DNI because it gives some negative calculation errors in SAM. So I want to ask that can you please also include the sun elevation angle or the zenith angle (I don’t want to go deep to calculate all the angles on my own :frowning: ) so that I can find DNI values? Thanks in advance!

There is an excellent Python package in PyPI called PyEphem that will easily allow you to calculate the sun elevation and azimuth angle for any location on the globe and any time of the year. Really, it’s very easy!