Module Sun :: Class Sun
[show private | hide private]
[frames | no frames]

Class Sun


Method Summary
  __init__(self)
  __daylen__(self, year, month, day, lon, lat, altit, upper_limb)
Note:
  __sunriset__(self, year, month, day, lon, lat, altit, upper_limb)
Note:
  acosd(self, x)
Returns the arc cos in degrees
  asind(self, x)
Returns the arc sin in degrees
  astronomicalTwilight(self, year, month, day, lon, lat)
This macro computes the start and end times of astronomical twilight.
  atan2d(self, y, x)
Returns the atan2 in degrees
  atand(self, x)
Returns the arc tan in degrees
  civilTwilight(self, year, month, day, lon, lat)
This macro computes the start and end times of civil twilight.
  cosd(self, x)
Returns the cos in degrees
  dayAstronomicalTwilightLength(self, year, month, day, lon, lat)
This macro computes the length of the day, incl.
  dayCivilTwilightLength(self, year, month, day, lon, lat)
This macro computes the length of the day, including civil twilight.
  dayLength(self, year, month, day, lon, lat)
This macro computes the length of the day, from sunrise to sunset.
  dayNauticalTwilightLength(self, year, month, day, lon, lat)
This macro computes the length of the day, incl.
  daysSince2000Jan0(self, y, m, d)
A macro to compute the number of days elapsed since 2000 Jan 0.0 (which is equal to 1999 Dec 31, 0h UT)
tuple equation_of_time(self, year, month, day, latitude)
Subroutine computing the part of the equation of time needed in the computing of the theoritical solar flux Correction originating of the CMC GEM model.
  get_max_solar_flux(self, latitude, year, month, day)
Compute the maximal solar flux to reach the ground for this date and latitude.
  GMST0(self, d)
This function computes GMST0, the Greenwich Mean Sidereal Time at 0h UT (i.e.
  Julian(self, year, month, day)
Return julian day.
  nauticalTwilight(self, year, month, day, lon, lat)
This macro computes the start and end times of nautical twilight.
  rev180(self, x)
Reduce angle to within +180..+180 degrees
  revolution(self, x)
This function reduces any angle to within the first revolution by subtracting or adding even multiples of 360.0 until the result is >= 0.0 and < 360.0
  sind(self, x)
Returns the sin in degrees
  solar_altitude(self, latitude, year, month, day)
Compute the altitude of the sun.
  sunpos(self, d)
Computes the Sun's ecliptic longitude and distance at an instant given in d, number of days since 2000 Jan 0.0.
  sunRADec(self, d)
Returns the angle of the Sun (RA) the declination (dec) and the distance of the Sun (r) for a given day d.
  sunRiseSet(self, year, month, day, lon, lat)
This macro computes times for sunrise/sunset.
  tand(self, x)
Returns the tan in degrees

Method Details

__daylen__(self, year, month, day, lon, lat, altit, upper_limb)

Note:
  • year,month,date = calendar date, 1801-2099 only. Eastern longitude positive, Western longitude negative Northern latitude positive, Southern latitude negative The longitude value is not critical. Set it to the correct longitude if you're picky, otherwise set to, say, 0.0
  • The latitude however IS critical - be sure to get it correct
  • altit = the altitude which the Sun should cross Set to -35/60 degrees for rise/set, -6 degrees for civil, -12 degrees for nautical and -18 degrees for astronomical twilight.
  • upper_limb: non-zero -> upper limb, zero -> center Set to non-zero (e.g. 1) when computing day length and to zero when computing day+twilight length.

__sunriset__(self, year, month, day, lon, lat, altit, upper_limb)

Note:
  • year,month,date = calendar date, 1801-2099 only. Eastern longitude positive, Western longitude negative Northern latitude positive, Southern latitude negative The longitude value IS critical in this function!
  • altit = the altitude which the Sun should cross Set to -35/60 degrees for rise/set, -6 degrees for civil, -12 degrees for nautical and -18 degrees for astronomical twilight.
  • upper_limb: non-zero -> upper limb, zero -> center Set to non-zero (e.g. 1) when computing rise/set times, and to zero when computing start/end of twilight.
  • *rise = where to store the rise time
  • *set = where to store the set time Both times are relative to the specified altitude, and thus this function can be used to compute various twilight times, as well as rise/set times
  • Return value:
  • 0 = sun rises/sets this day, times stored at *trise and *tset.
  • +1 = sun above the specified 'horizon' 24 hours. *trise set to time when the sun is at south, minus 12 hours while *tset is set to the south time plus 12 hours. 'Day' length = 24 hours
  • -1 = sun is below the specified 'horizon' 24 hours 'Day' length = 0 hours, *trise and *tset are both set to the time when the sun is at south.

acosd(self, x)

Returns the arc cos in degrees

asind(self, x)

Returns the arc sin in degrees

astronomicalTwilight(self, year, month, day, lon, lat)

This macro computes the start and end times of astronomical twilight. Astronomical twilight starts/ends when the Sun's center is 18 degrees below the horizon.

atan2d(self, y, x)

Returns the atan2 in degrees

atand(self, x)

Returns the arc tan in degrees

civilTwilight(self, year, month, day, lon, lat)

This macro computes the start and end times of civil twilight. Civil twilight starts/ends when the Sun's center is 6 degrees below the horizon.

cosd(self, x)

Returns the cos in degrees

dayAstronomicalTwilightLength(self, year, month, day, lon, lat)

This macro computes the length of the day, incl. astronomical twilight. Astronomical twilight starts/ends when the Sun's center is 18 degrees below the horizon.

dayCivilTwilightLength(self, year, month, day, lon, lat)

This macro computes the length of the day, including civil twilight. Civil twilight starts/ends when the Sun's center is 6 degrees below the horizon.

dayLength(self, year, month, day, lon, lat)

This macro computes the length of the day, from sunrise to sunset. Sunrise/set is considered to occur when the Sun's upper limb is 35 arc minutes below the horizon (this accounts for the refraction of the Earth's atmosphere).

dayNauticalTwilightLength(self, year, month, day, lon, lat)

This macro computes the length of the day, incl. nautical twilight. Nautical twilight starts/ends when the Sun's center is 12 degrees below the horizon.

daysSince2000Jan0(self, y, m, d)

A macro to compute the number of days elapsed since 2000 Jan 0.0 (which is equal to 1999 Dec 31, 0h UT)

equation_of_time(self, year, month, day, latitude)

Subroutine computing the part of the equation of time needed in the computing of the theoritical solar flux Correction originating of the CMC GEM model.
Parameters:
year - Year
           (type=int)
month - Month
           (type=int)
day - Day
           (type=int)
latitude - latitude to comput the equation of time
           (type=float)
Returns:
(double fEot, double fR0r, tuple tDeclsc)
  • dEot: Correction for the equation of time
  • dR0r: Corrected solar constant for the equation of time
  • tDeclsc: Declinaison

           (type=tuple)

get_max_solar_flux(self, latitude, year, month, day)

Compute the maximal solar flux to reach the ground for this date and latitude. Originaly comes from Environment Canada weather forecast model. Information was of the public domain before release by Environment Canada Output is in W/M^2.

GMST0(self, d)

This function computes GMST0, the Greenwich Mean Sidereal Time at 0h UT (i.e. the sidereal time at the Greenwhich meridian at 0h UT). GMST is then the sidereal time at Greenwich at any time of the day. I've generalized GMST0 as well, and define it as: GMST0 = GMST - UT -- this allows GMST0 to be computed at other times than 0h UT as well. While this sounds somewhat contradictory, it is very practical: instead of computing GMST like:

GMST = (GMST0) + UT * (366.2422/365.2422)

where (GMST0) is the GMST last time UT was 0 hours, one simply computes:

GMST = GMST0 + UT

where GMST0 is the GMST "at 0h UT" but at the current moment! Defined in this way, GMST0 will increase with about 4 min a day. It also happens that GMST0 (in degrees, 1 hr = 15 degr) is equal to the Sun's mean longitude plus/minus 180 degrees! (if we neglect aberration, which amounts to 20 seconds of arc or 1.33 seconds of time)

Julian(self, year, month, day)

Return julian day.

nauticalTwilight(self, year, month, day, lon, lat)

This macro computes the start and end times of nautical twilight. Nautical twilight starts/ends when the Sun's center is 12 degrees below the horizon.

rev180(self, x)

Reduce angle to within +180..+180 degrees

revolution(self, x)

This function reduces any angle to within the first revolution by subtracting or adding even multiples of 360.0 until the result is >= 0.0 and < 360.0

Reduce angle to within 0..360 degrees

sind(self, x)

Returns the sin in degrees

solar_altitude(self, latitude, year, month, day)

Compute the altitude of the sun. No atmospherical refraction taken in account. Altitude of the southern hemisphere are given relative to true north. Altitude of the northern hemisphere are given relative to true south. Declination is between 23.5° North and 23.5° South depending on the period of the year. Source of formula for altitude is PhysicalGeography.net http://www.physicalgeography.net/fundamentals/6h.html

sunpos(self, d)

Computes the Sun's ecliptic longitude and distance at an instant given in d, number of days since 2000 Jan 0.0. The Sun's ecliptic latitude is not computed, since it's always very near 0.

sunRADec(self, d)

Returns the angle of the Sun (RA) the declination (dec) and the distance of the Sun (r) for a given day d.

sunRiseSet(self, year, month, day, lon, lat)

This macro computes times for sunrise/sunset. Sunrise/set is considered to occur when the Sun's upper limb is 35 arc minutes below the horizon (this accounts for the refraction of the Earth's atmosphere).

tand(self, x)

Returns the tan in degrees

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