mikereedell / sunrisesunsetlib-java

Library for computing the sunrise/sunset from GPS coordinates and a date, in Java.
http://mikereedell.github.com/sunrisesunsetlib-java/
Apache License 2.0
299 stars 69 forks source link

null result from calculations #34

Closed pawelrokosznyvimana closed 7 years ago

pawelrokosznyvimana commented 7 years ago

Hi After executing such code for Warsaw/Poland

        Calendar calendar = Calendar.getInstance();
        SunriseSunsetCalculator calc = new SunriseSunsetCalculator(new Location(52.2297700,  21.0117800), "Poland");
        calc.getAstronomicalSunriseCalendarForDate(calendar);

I get null result. As I checked, it's returned by

computeSolarEventTme in:

        if ((cosineSunLocalHour.doubleValue() < -1.0) || (cosineSunLocalHour.doubleValue() > 1.0)) {
            return null;
        }
forrestguice commented 7 years ago

not really a bug - null is returned because there is no rise/set for astronomical twilight (at this location on this particular day). In other words it does not get darker than astronomical twilight.

https://www.timeanddate.com/astronomy/poland/warsaw

pawelrokosznyvimana commented 7 years ago

It could be more information about it or maybe more descriptive way of presenting it since null does not tell anything but your're right and thanks for explaining what went wrong. Cloing issue.