def calculate_sun_from_date_time(self, datetime, is_solar_time=False):
<EOL>if datetime.year != <NUM_LIT> and self.is_leap_year:<EOL><INDENT>datetime = DateTime(datetime.month, datetime.day, datetime.hour,<EOL>datetime.minute, True)<EOL><DEDENT>sol_dec, eq_of_time = self._calculate_solar_geometry(datetime)<EOL>hour = datetime.float_hour<EOL>is_daylight_saving = self.is_daylight_saving_hour(datetime.hoy)<EOL>hour = hour + <NUM_LIT:1> if self.is_daylight_saving_hour(datetime.hoy) else hour<EOL>sol_time = self._calculate_solar_time(hour, eq_of_time, is_solar_time) * <NUM_LIT><EOL>if sol_time / <NUM_LIT:4> < <NUM_LIT:0>:<EOL><INDENT>hour_angle = sol_time / <NUM_LIT:4> + <NUM_LIT><EOL><DEDENT>else:<EOL><INDENT>hour_angle = sol_time / <NUM_LIT:4> - <NUM_LIT><EOL><DEDENT>zenith = math.degrees(math.acos<EOL>(math.sin(self._latitude) *<EOL>math.sin(math.radians(sol_dec)) +<EOL>math.cos(self._latitude) *<EOL>math.cos(math.radians(sol_dec)) *<EOL>math.cos(math.radians(hour_angle))))<EOL>altitude = <NUM_LIT> - zenith<EOL>if altitude > <NUM_LIT>:<EOL><INDENT>atmos_refraction = <NUM_LIT:0><EOL><DEDENT>else:<EOL><INDENT>if altitude > <NUM_LIT:5>:<EOL><INDENT>atmos_refraction = <NUM_LIT> / math.tan(math.radians(altitude))<EOL>- <NUM_LIT> / (math.tan(math.radians(altitude)))**<NUM_LIT:3><EOL>+ <NUM_LIT> / (math.tan(math.radians(altitude)))**<NUM_LIT:5><EOL><DEDENT>else:<EOL><INDENT>if altitude > -<NUM_LIT>:<EOL><INDENT>atmos_refraction = <NUM_LIT><EOL>+ altitude * (-<NUM_LIT> + altitude *<EOL>(<NUM_LIT> + altitude *<EOL>(-<NUM_LIT> + altitude * <NUM_LIT>)))<EOL><DEDENT>else:<EOL><INDENT>atmos_refraction = -<NUM_LIT> / math.tan(<EOL>math.radians(altitude))<EOL><DEDENT><DEDENT><DEDENT>atmos_refraction /= <NUM_LIT><EOL>altitude += atmos_refraction<EOL>if hour_angle > <NUM_LIT:0>:<EOL><INDENT>azimuth = (math.degrees(<EOL>math.acos(<EOL>(<EOL>(math.sin(self._latitude) *<EOL>math.cos(math.radians(zenith))) -<EOL>math.sin(math.radians(sol_dec))) /<EOL>(math.cos(self._latitude) *<EOL>math.sin(math.radians(zenith)))<EOL>)<EOL>) + <NUM_LIT>) % <NUM_LIT><EOL><DEDENT>else:<EOL><INDENT>azimuth = (<NUM_LIT> - math.degrees(math.acos((<EOL>(math.sin(self._latitude) *<EOL>math.cos(math.radians(zenith))) -<EOL>math.sin(math.radians(sol_dec))) /<EOL>(math.cos(self._latitude) *<EOL>math.sin(math.radians(zenith))))<EOL>)) % <NUM_LIT><EOL><DEDENT>altitude = math.radians(altitude)<EOL>azimuth = math.radians(azimuth)<EOL>return Sun(datetime, altitude, azimuth, is_solar_time, is_daylight_saving,<EOL>self.north_angle)<EOL>
Get Sun for an hour of the year.

        This code is originally written by Trygve Wastvedt \
         (Trygve.Wastvedt@gmail.com)
        based on (NOAA) and modified by Chris Mackey and Mostapha Roudsari

        Args:
            datetime: Ladybug datetime
            is_solar_time: A boolean to indicate if the input hour is solar time.
                (Default: False)

        Returns:
            A sun object for this particular time