Ejemplo n.º 1
0
 def calc_solar_times(p_pyhouse_obj, p_date=datetime.date.today()):
     """
     @param p_date: is the datetime.date that we want sunrise and sunset for
     """
     l_a = astral.Location(info=(p_pyhouse_obj.House.Name,
                                 p_pyhouse_obj.House.Location.Region,
                                 p_pyhouse_obj.House.Location.Latitude,
                                 p_pyhouse_obj.House.Location.Longitude,
                                 p_pyhouse_obj.House.Location.TimeZoneName,
                                 p_pyhouse_obj.House.Location.Elevation))
     l_a.solar_depression = "civil"
     if (isinstance(p_date, datetime.datetime)):
         l_date = p_date.date(
         )  # convert datetime.datetime to datetime.date
     else:
         l_date = p_date
     # print(PrettyFormatAny.form('{}'.format(l_a), 'AA'))
     l_sun = l_a.sun(date=l_date, local=True)
     l_ret = RiseSetData()
     l_ret.Dawn = l_sun['dawn']
     l_ret.SunRise = l_sun['sunrise']
     l_ret.Noon = l_sun['noon']
     l_ret.SunSet = l_sun['sunset']
     l_ret.Dusk = l_sun['dusk']
     p_pyhouse_obj.House.Location.RiseSet = l_ret
     LOG.info('Sunrise/Sunset Calculation')
     return l_ret
Ejemplo n.º 2
0
 def RiseSet():
     l_ret = RiseSetData()
     l_ret.Dawn = TESTING_SCHEDULE_DAWN_0
     l_ret.SunRise = TESTING_SCHEDULE_SUNRISE_0
     l_ret.Noon = TESTING_SCHEDULE_NOON_0
     l_ret.SunSet = TESTING_SCHEDULE_SUNSET_0
     l_ret.Dusk = TESTING_SCHEDULE_DUSK_0
     return l_ret
Ejemplo n.º 3
0
 def RiseSet():
     l_ret = RiseSetData()
     l_ret.Dawn = 0
     l_ret.SunRise = 0
     l_ret.Noon = 0
     l_ret.SunSet = 0
     l_ret.Dusk = 0
     return l_ret
Ejemplo n.º 4
0
 def RiseSet():
     l_ret = RiseSetData()
     l_ret.SunRise = TESTING_SCHEDULE_SUNRISE_0
     l_ret.SunSet = TESTING_SCHEDULE_SUNSET_0
     return l_ret
Ejemplo n.º 5
0
 def RiseSet():
     l_ret = RiseSetData()
     l_ret.SunRise = T_SUNRISE
     l_ret.SunSet = T_SUNSET
     return l_ret