Subject: | Inaccurate calculation of sunrise for Boston area (perhaps others) |
Date: | Mon, 13 Apr 2020 18:49:54 -0400 |
To: | bug-DateTime-Event-Sunrise [...] rt.cpan.org |
From: | timezones [...] kosowsky.org |
Hi,
I was just testing DateTime::Event::Sunrise for Newton Center,
Massachuseets for the month of April 2020 against several other
calculators, including:
1. NOAA (https://www.esrl.noaa.gov/gmd/grad/solcalc/table.php?lat=42.3358&lon=-71.2044&year=2020)
2. timeanddate.com (https://www.timeanddate.com/sun/@4945289)
3. https://keisan.casio.com/exec/system/1224686065
They all were consistent within about 1 minute.
On the other hand, DateTime::Event::Sunrise for *sunrise* seemed to be
about 2 minutes earlier on most days in my tested month of April.
Yet, for *sunset* the times were accurate for the month.
Any ideas on what might be going on here?
Note I used the following code:
#!/usr/bin/perl
use strict;
use warnings;
use DateTime;
use DateTime::Event::Sunrise;
my $sunriseset = DateTime::Event::Sunrise->new( #Note this is a different object type (used with sunrise_datetime and sunset_datetime)
longitude => 42.3358,
latitude => -71.2044,
altitude => '-0.833',
precise => 1);
my $dt = DateTime->new(
year => 2020,
month => 4,
day => 12,
hour => 12,
time_zone => 'America/New_York');
for(my $i=1; $i<=30; $i++) {
$dt->set(day => $i);
print $dt->mdy, "\t", $sunriseset->sunrise_datetime($dt)->hms, "\t", $sunriseset->sunset_datetime($dt)->hms, "\n";
};