Re: About the next version of DateTme::Event::Sunrise
[email protected] (Rick Measham) Sat, 20 Jun 2020 11:17:11 +1000
| Newsgroups | perl.datetime |
|---|---|
| Message-ID | <[email protected]> |
What if you implemented it as 'spin' or 'hour' or 'spin_hour' or whatever, as a number and (optionally) exported constants to signify the algorithm? That means users could either provide their own number, or could use one of the provided. I don't write much perl any more so forgive me if I get the syntax wrong here ... use DateTime::Event::Sunrise qw/SIDEREAL SCHLYTER/; my $sunriseset = DateTime::Event::Sunrise->new( latitude => 42.3358, longitude => -71.2044, altitude => '-0.833', precise => 1, hour => SIDEREAL); - Rick On 6/20/2020 2:03 AM, Jean Forget wrote: > Following the creation of RT ticket > https://rt.cpan.org/Public/Bug/Display.html?id=132336 > I have decided to implement the proper precise algorithm in > DateTime::Event::Sunrise (already implemented in Astro::Sunrise) and > to check the values with NOAA's solar calculator and with Stellarium. > > After I have implemented the proper precise algorithm, there are still > differences between the values obtained by Stellarium and the NOAA on > one side and by DT::E::S on the other side. I have found that these > differences are the caused by the "magic" values 15 and 15.04107 used > in the module. > > 15.04107 is the angular speed of Earth's spin, while 15 is the > combination of Earth's spin with the orbital speed of the > Sun-Earth system. According to Paul Schlyter 's description of > the precise algorithm, we should use 15.04107, but I have found > that using 15 instead gives results closer to Stellarium. > > More abstractly, the problem is: when you are an low-level > amateur astronomer, who is an authoritative source for you? > Whom do you trust? Paul Schlyter or the Stellarium team or > the NOAA? > > I have decided to defer this question to the module user. There is a > new parameter, "algo", which lets the user choose between trusting > Paul Schlyter more than Stellarium or trusting Stellarium more > than Paul Schlyter. > > Now you may code either > > my $sunriseset = DateTime::Event::Sunrise->new( > latitude => 42.3358, > longitude => -71.2044, > altitude => '-0.833', > precise => 1, > algo => 'Schlyter'); > > or > > my $sunriseset = DateTime::Event::Sunrise->new( > latitude => 42.3358, > longitude => -71.2044, > altitude => '-0.833', > precise => 1, > algo => 'Stellarium'); > > Can you think of a better name for the new option? The creator of > ticket 132336 suggests > spin => 15.04107, > or > spin => 15, > > The problem is that the "magic" value 15.04107 is not easy to remember, > especially if the module user knows even less astronomy than myself. > While "Schlyter" and "Stellarium" are easier to remember. > > I will release the new version of DT::E::S to CPAN next week. > If you have a better idea for the name of the new parameter, please > tell me before this release. > > In the meantime, the updated code is available on Github. > > Thank you for your advice, > > By the way, this is the second attempt to write this message > to the datetime mailing list. As it happened already, my first > attempt was lost somewhere and did not reach you or the websites > https://www.nntp.perl.org/group/perl.datetime/ > and https://www.mail-archive.com/[email protected]/. > > Jean Forget -- Message protected for iSite by MailGuard: e-mail anti-virus, anti-spam and content filtering.http://www.mailguard.com.au