Module crepyscule_summer_time
[hide private]
[frames] | no frames]

Module crepyscule_summer_time

source code

Adjust the sunset and sunrise hour depending on the timezone. The list of timezone (lTimezone) is based on software kstars of the kdeedu project (http://edu.kde.org/kstars/). The original file contains informations by column like this: city : province : country : Lat_deg : Lat_min : Lat_sec : N|S : Lon_deg : Lon_min : Lon_sec : E|W : UTC_difference : two_letters[??]

Project home page is http://ptaff.ca/crepyscule/

Functions [hide private]
tuple
get_summer_time_days(sSummerCode, nYear)
Return in julian day the beginning of daylight time and the end of daylight time.
source code
int
__get_day(sPosition, sDay, sMonth, nYear)
Get the day of the month corresponding to the position in the month.
source code
int
__get_julian(sDate)
Return julian day corresponding to iso 8601 date format is YYYY-MM-DD
source code
list
adjust_summer_time(lSunrise, lSunset, sTimezone, nYear)
Adjust the hour of sunset and sunrise depending of the summer time
source code
 
adjust_summer_time_one_day(tDay, fValue, sTimezone)
Adjust the hour of sunset and sunrise depending of the summer time for this particular day.
source code
Variables [hide private]
  lTimezone = ('IR', 'JD', 'EU', 'IQ', 'US', 'CH', 'EG', 'MX', '...
  dMonth = {'APR': 4, 'AUG': 8, 'DEC': 12, 'FEB': 2, 'JAN': 1, '...
  dWeek = {'FRI': 4, 'MON': 0, 'SAT': 5, 'SUN': 6, 'THU': 3, 'TU...
  dYearSummertime = {2008: {'': (366, 0), 'US': (69, 307)}}
Function Details [hide private]

get_summer_time_days(sSummerCode, nYear)

source code 

Return in julian day the beginning of daylight time and the end of daylight time.

Parameters:
  • sSummerCode (string) - summer time two letters code
  • nYear (int) - Year to retrieve the dates for this summer code. Might have an effect in the case of 'US' since it had been change in 2007.
Returns: tuple
First and last julian day for this summer time code

__get_day(sPosition, sDay, sMonth, nYear)

source code 

Get the day of the month corresponding to the position in the month. Eg: First monday of april would be __get_day('first', 'MON', 'APR')

Parameters:
  • sPosition (string) - Value in ['first', 'second', 'third', 'last']
  • sDay (string) - Day of the week. See dWeek for possible value of string.
  • sMonth (string) - Month of the date. See dMonth for possible value of string.
  • nYear (int) - Year of which to retrieve the julian day.
Returns: int
Julian day of the year for this date.

__get_julian(sDate)

source code 

Return julian day corresponding to iso 8601 date format is YYYY-MM-DD

Parameters:
  • sDate (string) - ISO8601 date. Format is YYYY-MM-DD
Returns: int
Julian day

adjust_summer_time(lSunrise, lSunset, sTimezone, nYear)

source code 

Adjust the hour of sunset and sunrise depending of the summer time

Parameters:
  • lSunrise (list) - List of sunrise for the whole year.
  • lSunset (list) - List of sunset for the whole year.
  • sTimezone (string) - Summer time two letters code
  • nYear (int) - Year to retrieve the dates for this summer code.
Returns: list
List of the adjusted value of sunrise and sunset: [lSunrise, lSunset]

adjust_summer_time_one_day(tDay, fValue, sTimezone)

source code 

Adjust the hour of sunset and sunrise depending of the summer time for this particular day.

Parameters:
  • tDay (tuple) - Tuple of this day in the format (nYear, nMonth, nDay)
  • fValue (float) - sunrise or sunset value to adjust following summertime.

Variables Details [hide private]

lTimezone

Value:
('IR',
 'JD',
 'EU',
 'IQ',
 'US',
 'CH',
 'EG',
 'MX',
...

dMonth

Value:
{'APR': 4,
 'AUG': 8,
 'DEC': 12,
 'FEB': 2,
 'JAN': 1,
 'JUL': 7,
 'JUN': 6,
 'MAR': 3,
...

dWeek

Value:
{'FRI': 4, 'MON': 0, 'SAT': 5, 'SUN': 6, 'THU': 3, 'TUE': 1, 'WED': 2}