Yitzchok / Zmanim

Jewish Zmanim Framework (Port of Java Zmanim project by KosherJava)
http://www.kosherjava.com/zmanim-project/
GNU Lesser General Public License v3.0
33 stars 17 forks source link

NOAA Calculator seems broken #5

Closed iderdik closed 8 years ago

iderdik commented 8 years ago

Values using the NOAA algorithm seem to be off. Sunrise/sunset are around 30 minutes different their USNO counterparts and they don't match the calendar generator on the kosherjava website either. Is it possible that something wasn't ported correctly?

Sample code that shows the large discrepancy:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Zmanim;
using Zmanim.TimeZone;
using Zmanim.TzDatebase;
using Zmanim.Utilities;

namespace TestNOAA
{
    class Program
    {
        static void Main(string[] args)
        {
            Zmanim.Calculator.IAstronomicalCalculator[] calculators = new Zmanim.Calculator.IAstronomicalCalculator[2];
            calculators[0] = new Zmanim.Calculator.SunTimesCalculator();
            calculators[1] = new Zmanim.Calculator.NOAACalculator();

            string locationName = "Cedarhurst, NY";
            double latitude = 40.626854; 
            double longitude = -73.726414;  
            double elevation = 0; 
            ITimeZone timeZone = new OlsonTimeZone("America/New_York");
            var location = new GeoLocation(locationName, latitude, longitude, elevation, timeZone);
            var calendar = new ComplexZmanimCalendar(new DateTime(2016, 2, 5), location);

            for (int i = 0; i < calculators.Length; i++)
            {
                calendar.AstronomicalCalculator = calculators[i];
                var zman = calendar.GetSunset();
                Console.WriteLine(calculators[i].CalculatorName + " " +  zman);
            }
            Console.ReadKey();
        }
    }
}

Yields the output:

US Naval Almanac Algorithm 2/5/2016 5:17:31 PM
US National Oceanic and Atmospheric Administration Algorithm 2/5/2016 5:51:18 PM
iderdik commented 8 years ago

Of course, I should have checked the closed issues first :)

Yitzchok commented 8 years ago

Nice thanks for letting me know that it was resolved.