There might be several similar questions and of course that helped me find a way to calculate sun position for specific lat-long coordinates, in my case Berlin. But I am getting the wrong result. There is an 8 or 9-degree difference in my result.
if you Check these two websites, where the values are different. https://www.timeanddate.com/sun/germany/berlin
https://www.suncalc.org/#/52.5072,13.4248,10/2019.01.30/16:45/1/0
I have a different type of codes but all work the same way. I can't figure it out if why my result has such a huge difference.
from astropy.coordinates import EarthLocation, SkyCoord, get_sun, AltAz
from astropy.time import Time
import astropy.units as u
utcoffset = 1*u.hour # Central European Time
ctime = Time.now() + utcoffset
Berlin = EarthLocation(lat = 52.50721*u.deg, lon = 13.42475*u.deg)
get_sun(ctime).transform_to(AltAz(location=Berlin))
The result is as follows:
<SkyCoord (AltAz: obstime=2019-01-30 16:58:26.084488, location=(3784032.5060993554, 903211.2359915433, 5037352.958007532) m, pressure=0.0 hPa, temperature=0.0 deg_C, relative_humidity=0.0, obswl=1.0 micron): (az, alt, distance) in (deg, deg, m)
(255.03483501, -10.75194363, 1.47368685e+11)>
Never Mind... Sorry Guys... I figured it out. I don't have to consider here the offset when already giving the location lat-long of Berlin.