Module crepyscule_graphic
[show private | hide private]
[frames | no frames]

Module crepyscule_graphic

Package that contains everything to plot graphics for crepyscule. Based on rpy and GDD (R language). All images are in the png format.

Project home page is http://ptaff.ca/crepyscule/
Function Summary
  draw_sunrise_sunset(npSunrise, npSunset, npSunTime, nIndiceStartSunrise, nIndiceEndSunrise, nIndiceStartSunset, nIndiceEndSunset, lDateISO8601, sLty, sColorSunrise, sColorSunset, sColorTotalTime)
Draw sunrise and sunset lines on the graphics.
  init_time_values(lDateISO8601)
Set the value of time used by the graphs.
  plot_altitude(tToday, lSunAltitude, lDateISO8601, sFilename, sBackgroundColor, lSunAltitude2)
Plot the altitude of the sun during a year.
  plot_daylight_differences(lSunrise1, lSunset1, lDaylength1, lDateISO8601, sFilename, tToday, sBackgroundColor, lSunrise2, lSunset2, lDaylength2)
Plot the difference of daylight time between consecutive days.
  plot_max_solar_flux(lDateISO8601, sFilename, tToday, sBackgroundColor, fLat1, fLat2)
Plot the maximal solar flux in W/m^2 for all year.
  plot_monthly(lMonthLight, sFilename)
DEPRECATED Plot a graphical with total hour of light for each month.
  plot_sunset_sunrise(lSunrise, lSunset, lDaylength, lDateISO8601, sFilename, tToday, sBackgroundColor, lSunrise2, lSunset2, lDaylength2)
Plot the sunset and the sunrise of one year.
  plot_twilight_length(sFilename, tToday, sBackgroundColor, fLat1, dTwilightLength1, fLat2, dTwilightLength2)
Plot the twilight length in minutes for all year.

Function Details

draw_sunrise_sunset(npSunrise, npSunset, npSunTime, nIndiceStartSunrise, nIndiceEndSunrise, nIndiceStartSunset, nIndiceEndSunset, lDateISO8601, sLty='solid', sColorSunrise='orange', sColorSunset='red', sColorTotalTime='blue')

Draw sunrise and sunset lines on the graphics. This function is empiric. It has been developed by trials and errors, there is not much to understand.

There is only two complex case that are handled: when the sunrise (sunset) curve goes under (over) zero (24) value during one segment. In this case, there is 3 curves that are created corresponding to the value of rX_axis1, rX_axis2 and rX_axis3.
Parameters:
npSunrise - Array of sunrise values for one year to be displayed.
           (type=numpy.array)
npSunset - Array of sunset values for one year to be displayed.
           (type=numpy.array)
nIndiceStartSunrise - Indice where the sunrise goes under the zero value. If there is no such place, zero is given.
           (type=int)
nIndiceEndSunrise - Indice where the sunrise goes over zero if it ever goes under it. If it does not occurs, the length of the array (365 or 366) is given.
           (type=int)
nIndiceStartSunset - Indice where the sunrise goes over 24 value. If there is no such place, zero is given.
           (type=int)
nIndiceEndSunset - Indice where the sunset goes under 24 if it ever goes over it. If it does not occurs, the length of the array (365 or 366) is given.
           (type=int)
lDateISO8601 - List of strings for one year in iso8601 format.
           (type=list)
sLty - R Line style. See help for 'lty' in the 'par' documentation in R
           (type=string)
sColorSunrise - Color of sunrise curve. See Chart of R colors for possible values.
           (type=string)
sColorSunset - Color of sunset curve. See Chart of R colors for possible values.
           (type=string)
sColorTotalTime - Color of total time of day curve. See Chart of R colors for possible values.
           (type=string)

init_time_values(lDateISO8601)

Set the value of time used by the graphs. Declare the import here because a lot of output are written when it is done and we do not want to have it every time crepyscule is invoked, only when this module is called.
Parameters:
lDateISO8601 - Create the X axis based on the values of the list. Values are one year date in iso8601 format.
           (type=liste)

plot_altitude(tToday, lSunAltitude, lDateISO8601, sFilename, sBackgroundColor, lSunAltitude2=None)

Plot the altitude of the sun during a year.
Parameters:
tToday - Tuple as returned by the function time.gmtime.
           (type=tuple)
lSunAltitude - list of Sun altitude for the first place.
           (type=list)
lDateISO8601 - List of strings for one year in iso8601 format.
           (type=list)
sFilename - Filename to save the graph. Filename is transformed like 'file.png' to 'file_alt.png'.
           (type=string)
sBackgroundColor - Color that will be used for the background color for the generated graphics. See Chart of R colors
           (type=string)
lSunAltitude2 - list of Sun altitude for the second place.
           (type=list)

plot_daylight_differences(lSunrise1, lSunset1, lDaylength1, lDateISO8601, sFilename, tToday, sBackgroundColor, lSunrise2=None, lSunset2=None, lDaylength2=None)

Plot the difference of daylight time between consecutive days.
Parameters:
lSunrise1 - List of sunrise values for one year for the first place.
           (type=list)
lSunset1 - List of sunset values for one year for the first place.
           (type=list)
lDaylength1 - List of day length for each day of the year.
           (type=list)
lDateISO8601 - List of strings for one year in iso8601 format.
           (type=list)
sFilename - Filename to save the graph. Filename is transformed like 'file.png' to 'file_delta_t.png'.
           (type=string)
tToday - Tuple as returned by the function time.gmtime.
           (type=tuple)
sBackgroundColor - Color that will be used for the background color for the generated graphics. See Chart of R colors
           (type=string)
lSunrise2 - List of sunrise values for one year for the second place.
           (type=list)
lSunset2 - List of sunset values for one year for the second place. @type lDaylength2 list
           (type=list)
lDaylength2 - List of day length for each day of the year for the second place.

plot_max_solar_flux(lDateISO8601, sFilename, tToday, sBackgroundColor, fLat1, fLat2=None)

Plot the maximal solar flux in W/m^2 for all year.
Parameters:
lDateISO8601 - List of strings for one year in iso8601 format.
           (type=list)
sFilename - Filename to save the graph. Filename is transformed like 'file.png' to 'file_sf.png'.
           (type=string)

plot_monthly(lMonthLight, sFilename)

DEPRECATED Plot a graphical with total hour of light for each month. Was used for debugging and development phase. Probably won't work. Code source is left here in case someone wants to use it. If it is your case, please contact the author.
Parameters:
lMonthLight - list containing the sum of day light for each month.
           (type=list)
sFilename - Filename to save the graph. Filename is transformed like 'file.png' to 'file_month.png'.
           (type=string)

plot_sunset_sunrise(lSunrise, lSunset, lDaylength, lDateISO8601, sFilename, tToday, sBackgroundColor, lSunrise2=None, lSunset2=None, lDaylength2=None)

Plot the sunset and the sunrise of one year.
Parameters:
lSunrise - List of sunrise values for one year for the first place.
           (type=list)
lSunset - List of sunset values for one year for the first place.
           (type=list)
lDaylength - List of day length for each day of the year.
           (type=list)
lDateISO8601 - List of strings for one year in iso8601 format.
           (type=list)
sFilename - Filename to save the graph.
           (type=string)
tToday - Tuple as returned by the function time.gmtime.
           (type=tuple)
sBackgroundColor - Color that will be used for the background color for the generated graphics. See Chart of R colors
           (type=string)
lSunrise2 - List of sunrise values for one year for the second place.
           (type=list)
lSunset2 - List of sunset values for one year for the second place. @type lDaylength2 list
           (type=list)
lDaylength2 - List of day length for each day of the year for the second place.

plot_twilight_length(sFilename, tToday, sBackgroundColor, fLat1, dTwilightLength1, fLat2=None, dTwilightLength2=None)

Plot the twilight length in minutes for all year.
Parameters:
sFilename - Filename to save the graph. Filename is transformed like 'file.png' to 'file_ss.png'.
           (type=string)
tToday - Tuple as returned by the function time.gmtime.
           (type=tuple)
sBackgroundColor - Color that will be used for the background color for the generated graphics. See Chart of R colors
           (type=string)
fLat1 - Latitude in decimal for the first place.
           (type=float)
dTwilightLength1 - dictionnary containing the date in ISO 8601 format and sunset speed for this first place.
           (type=dictionnary)
fLat2 - Latitude in decimal for the second place.
           (type=float)
dTwilightLength2 - dictionnary containing the date in ISO 8601 format and sunset speed for this second place.
           (type=dictionnary)

Generated by Epydoc 2.1 on Wed Jan 28 21:01:07 2009 http://epydoc.sf.net