Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Failure to calculate equation of time and declination of the sun

  1. Oct 16, 2011 #1
    Calculating the equation of time and the declination of the sun

    Hi,

    I'm trying to calculate the equation of time and the declination of the sun in the prettiest way possible:

    https://gist.github.com/1278755" [Broken]

    But right now I'm getting some unexpected values:

    Code (Text):
    1) Failure:
    test_suns_declination(TestSolarCalculations):
    Expected -3.18, not -0.8773192601265396.

    2) Failure:
    test_equation_of_time(TestSolarCalculations):
    Expected 2011-10-01 10:23:00 +0100, not 301.80925318673167.
    Can anybody see what's wrong?

    --Dwayne
     
    Last edited by a moderator: May 5, 2017
  2. jcsd
  3. Oct 17, 2011 #2
    Getting closer, still one month off though:

    Code (Text):
    1) Failure:
    test_equation_of_time(TestSolarCalculations):
    Expected 2011-10-01 10:23:00 UTC, not 2011-10-28 17:02:35 UTC.

    2) Failure:
    test_suns_declination(TestSolarCalculations):
    Expected -3.18, not 1.380604820284565.
     
  4. Oct 17, 2011 #3

    BobG

    User Avatar
    Science Advisor
    Homework Helper

    When your computer calculates sine and cosine, is it calculating trig functions for an angle in radians or an angle in degrees?

    (Excel, for example, has to have the angles converted into radians before calculating the sine or cosine.)
     
  5. Oct 18, 2011 #4
    Cool! So I added a degrees to radians converter. But whereas my declination of the sun is getting really close, my equation of time has gotten way off by 10 months!

    Code (Text):
    1) Failure:
    test_equation_of_time(TestSolarCalculations):
    Expected 2011-10-01 10:23:00 UTC, not 2011-01-06 01:08:11 UTC.

    2) Failure:
    test_suns_declination(TestSolarCalculations):
    Expected -3.18, not -3.2087920449753007.
    Any ideas? I hope my script remains readable.

    https://gist.github.com/1278755" [Broken]

    Have you seen this by the way?

    http://www.youtube.com/watch?v=y2R3FvS4xr4"

    --Dwayne
     
    Last edited by a moderator: May 5, 2017
  6. Oct 20, 2011 #5
    I realized I forgot to convert my sun's mean longitude back to degrees before calculating the equation of time. Now I'm back to being just a month off.

    Code (Text):
    1) Failure:
    test_equation_of_time(TestSolarCalculations):
    Expected 2011-10-01 10:23:00 UTC, not 2011-10-28 10:59:31 UTC.

    2) Failure:
    test_suns_declination(TestSolarCalculations):
    Expected -3.18, not -3.2087920449753007.
    --Dwayne
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Failure to calculate equation of time and declination of the sun
  1. Declination of the Sun (Replies: 9)

Loading...