1-*- encoding: utf-8; indent-tabs-mode:nil -*- 2 3=encoding utf-8 4 5=head1 Document Status 6 7This text is published under the I<Creative Commons> license 8CC-BY-ND. 9 10Copyright (c) 2017-2021 Jean Forget. All rights reserved. 11 12I must precise that I am not a professional astronomer. The text 13below may contain errors, be aware of this. I will not be held 14responsible for any consequences of your reading of this text. 15The "NO WARRANTY" paragraphs from the GPL and the Artistic License 16apply not only to Perl code, but also to English (and French) 17texts. 18 19The text is often (but irregularly) updated on Github. There are 20a French version and an English version. Since I am more at ease 21discussing astronomical subjects in French, the English version 22will lag behind the French one. 23 24This text is an integral part of the module's distribution package. 25So you can read it on web pages generated from CPAN 26(for example L<https://metacpan.org>). 27But it is not used during the module installation process. 28So, I guess it will not appear in C<.deb> or C<.rpm> packages. 29 30Although this text is stored in the L<Astro::Sunrise> repository, it 31also documents the L<DateTime::Event::Sunrise> module, which has a 32very similar core (astronomical computations) and a different API. 33Since both modules move at different speeds, it may happen that the 34text you are reading is not synchronised with the L<Astro::Sunrise> 35module. 36 37=head1 Why This Text? For Whom? 38 39The main purpose of this text is to explain how the sunrises 40and sunsets are computed. These explanations are much too long 41to be included into the module's POD section. 42 43=head2 For Whom? For My Teddy Bear 44 45Have you read 46L<brian's Guide to Solving Any Perl Problem|http://www252.pair.com/~comdog/brian's_guide.pod>? 47While most advices deal with debugging Perl code, a few advices have 48a broader scope and apply to any intellectual problem. 49One of these advices consists in "talking to the teddy-bear". 50And do not pretend to talk while just forming sentences in your 51mind. You must really talk in a clear voice in front of your 52teddy-bear, with syntactically correct sentences. 53Actually, in the present case, the topic is so big that I skipped to the next level and 54I prefer writing (on GitHub) for my teddy-bear. 55 56I write this text to tell my teddy-bear which problems I have 57encountered while maintaining this module and how I fixed them. 58But mainly, I write this to give him a detailed description of the 59precise iterative algorithm, because 60L<Paul Schlyter's explanations|https://www.stjarnhimlen.se/comp/riset.html#3> 61are not detailed enough for my taste and there is no 62compilable source available to check this algorithm (unlike the 63L<simple version without iteration|https://www.stjarnhimlen.se/comp/sunriset.c>). 64 65=head2 For Whom? For The Next Module Maintainer 66 67Actually, my teddy-bear understands French, so the present 68English version is not for him. 69The second person for whom I write is the next module maintainer. I have read 70L<Neil Bowers' message|http://codeverge.com/perl.module-authors/the-module-authors-pledge/744969> 71about I<the module authors pledge>. I agree with him and I declare that 72should I stop maintaining my modules for whatever reason, I accept that 73any volunteer can take charge of them. 74 75What Neil did not explain, is that the new maintainer must obey a few 76criteria and must have three available resources to take over a module maintenance: 77be competent in Perl programming, have enough available time to work on 78the module and be enthusiastic enough to get around to it. 79 80In the case of astronomical module, the competence in Perl programming is 81not enough, you must also be competent in astronomy. So, if you think you might 82maintain this module, first read the present text. If you understand why I bother 83about such and such question, if you can follow my train of thought without being 84lost, then you are competent enough. If you think I am playing 85L<Captain Obvious|https://tvtropes.org/pmwiki/pmwiki.php/Main/CaptainObvious> 86and if you have instant answers to my questions, then you are the ideal 87person that could maintain this module. If you do not understand what all 88this is about, and if sines and cosines put you off, do not consider 89working on this module's innards. 90 91=head2 For Whom? For Bug Reporters 92 93This text is also for those who think they have found a bug 94in the module or who want to offer an idea to improve the module. 95Maybe the bug is already known and is waiting for a fix. 96Maybe the bug was found and the fix is not successful. Maybe 97the proposed improvement contradicts some other functionality 98of the module. 99 100=head2 For Whom? For Curious Users 101 102Lastly, this text is aimed at any person curious enough to learn 103a few astronomical facts. I tried to steer away from overly complicated 104computations. Their place is in the Perl source, not in this text. 105Yet, you will find here simple computations and mathematical reasoning. 106 107=head2 Remarks About The Style 108 109Some chunks of this text appear as a series of questions and answers. 110This is not a FAQ. Rather, this is a elegant way to give a progressive 111explanation of some subject. This method has already been used by 112many other writers, especially Plato, Galileo and Douglas Hofstadter. 113 114=head2 Other Remarks 115 116In my explanations, I usually take the point of view of a person living 117in the Northern hemisphere, between the Tropic of Cancer and the Arctic Circle. 118For example, I will write that at noon, the sun is located exactly southward, 119although any schoolboy from Australia, New Zealand, South Africa, Argentina 120and similar countries perfectly knows that at noon, the sun is northward. 121 122In a similar way, 21st of March is called the I<vernal equinox> or the 123I<spring equinox>, even if it pinpoints the beginning of autumn in the Southern 124hemisphere. 125 126But using politically correct sentences would yield convoluted phrases, 127which hinders the pedagogical purpose of the text and the understanding 128of the described phenomena. 129 130About minutes and seconds: the problem is that minutes and seconds are both 131angular units (for longitudes and latitudes) and time units (for instants 132and for durations). I have adopted three different formats to help distinguish 133between these cases: C<12:28:35> for time instants, C<2 h 28 mn 35 s> for 134time durations and C<59° 28' 35"> for angles (latitudes, longitudes and others). 135So, even if the hour-part or the degree-part is missing, you will be able 136to distinguish between a C<28' 35"> angle and a C<28 mn 35 s> duration. 137 138=head1 Sources 139 140I will give here only the sources that provide lists of numerical values. 141Books and articles with only a literary description of the subject are too 142many to be listed here. 143 144=head2 Unused Sources 145 146Some sources provide a list of sunsets and sunrises, but I did not use 147them because they do not explain which algorithm they use or because 148I cannot control the parameters. 149 150=over 4 151 152=item The I<Almanach Du Facteur> 153 154In France, it is (or rather it was) customary to buy almanachs from the postman 155each year. In each almanach, you find a page giving the sunrise and sunset times 156for all the days of the year. Unfortunately, the times are given in HH:MM syntax, not 157including the seconds. In addition, even if you buy a provincial edition, the 158sunrise and sunset times are given for Paris. Lastly, the algorithm is not 159specified. 160 161=item The I<Institut de Mécanique Céleste et de Calcul des Éphémérides> (IMCCE, Institute of Celestial Mechanics and Ephemerides Computation) 162 163This L<website|https://www.imcce.fr/> 164(also available in L<english|https://www.imcce.fr/langues/en/index.html>) 165used to give an HTML form to generate a table giving the sunrise and sunset times 166for a location and a time span of your choosing. Unfortunately, this webpage 167disappeared. 168 169There is an available 170L<webservice|http://vo.imcce.fr/webservices/miriade/?rts> 171to give the same functionality, but I did not try it. 172 173=back 174 175=head2 Used Sources 176 177=over 4 178 179=item Paul Schlyter's Website 180 181This L<site|https://www.stjarnhimlen.se/english.html> 182provides a 183L<C program|https://stjarnhimlen.se/comp/sunriset.c> 184ready to compile and use, giving the 185L<sunrise and sunset|https://stjarnhimlen.se/comp/riset.html> 186times. This is the basis of the simple algorithm used in 187L<Astro::Sunrise>. Its precision, as stated by the author, 188is one or two minutes, but it can be much less precise depending 189on the location and date, especially when we are close to the 190beginning or the end of the period when the midnight sun is visible. 191 192Paul Schlyter's website includes also 193L<many informations|https://stjarnhimlen.se/comp/ppcomp.html> 194about computing the position of various celestial bodies. 195This website is very interesting, but I preferred writing 196my own version, describing the computation of only the sun 197and not bothering with other celestial bodies. 198 199=item The U.S Naval Observatory 200 201L<The US Naval Observatory|http://aa.usno.navy.mil/faq/index.php> 202gives a 203L<HTML form|http://aa.usno.navy.mil/data/docs/RS_OneYear.php> 204to compute the sunrise and sunset times. These times are given 205in HH:MM format. I would have preferred HH:MM:SS, but I will have 206to deal with just HH:MM. 207 208This website gives also 209L<very interesting informations|http://aa.usno.navy.mil/faq/index.php> 210about celestial computations, but without restricting itself to the sun, 211like I am doing here. 212 213=item The NOAA solar calculator 214 215L<The NOAA's Earth System Research Laboratories|https://www.esrl.noaa.gov/> 216provide a 217L<solar calculator|https://www.esrl.noaa.gov/gmd/grad/solcalc/> 218similar to the USNO. 219 220=item Stellarium 221 222Stellarium is a PC app to simulate a night sky. If you do not bother with 223the main view giving a real time sky simulation, you can use it to obtain 224the coordinates of a given celestial body at a given time when seen from 225a given Earth location. Here is how you can determine the time 226of sunrise, sunset or true solar noon (version 0.18.0). 227 228=over 4 229 230=item * 231 232Choose an approximate value for the requested time: 12:00 for 233the true solar noon or use L<Astro::Sunrise> (basic mode) for 234sunrise or sunset. 235 236=item * 237 238Choose the search criterion: azimuth equal to 180° for true 239solar noon or real altitude equal to 0 degrees and I<xx> 240minutes below the horizon. I<xx> must be compatible with the 241C<altitude> parameter of L<Astro::Sunrise>'s functions. 242 243Note: we do not use the I<apparent> altitude given by Stellarium. 244For the deviation angle of sun rays near the horizon, we use 245L<Astro::Sunrise>'s value, which is 35' or 0.583 degree and 246we aim at this value in Stellarium. And if we want to take into 247account the radius of the sun's disk, we will use the average value 15' 248instead of recomputing the precise value depending on the 249Earth-Sun distance. In this case, we will aim at a 50' altitude 250below the horizon, that is, 0.833 degree. 251 252=item * 253 254In Stellarium, freeze the time with C<7> unless already frozen. 255 256=item * 257 258Look for the Sun. The search window is activated by C<< <F3> >>. 259 260=item * 261 262You may prefer a display without the ground and without the atmosphere. 263Use the flip-flops C<g> and C<a>. And C<e> or C<z> to display or 264to hide the equatorial and azimutal grids, acording to 265your current taste. 266 267By the way, when the atmosphere is deactivated, Stellarium no longer 268displays the apparent coordinates of the Sun. So the choice above, using 269the I<real> Sun altitude and not its I<apparent> altitude is justified. 270 271=item * 272 273Press C<< <F6> >> to specify the observation location. With a location 274on the Greenwich meridian, the UTC time will coincide with the 275mean solar time. Do not forget to tick the personalised time zone check 276box and to select UTC. 277 278In version 0.18.0, use "Royal Observatory (Greenwich)". In the 279previous version, I entered a location at 51° 28' 40" N, 5" E and 280a height of 27 m. The longitude and latitude are the values given by 281Wikipedia for the Greenwich Observatory and the height is nothing more 282than the previously entered height. This has no relation with the 283observatory's real height, or this is a lucky coincidence. 284 285=item * 286 287Press C<< <F5> >> to specify date and time. 288 289=item * 290 291While keeping the date-time windows opened, try several 292time values until you get the best approximation of the 293target azimut or of the target altitude. 294 295=back 296 297Note: on the previous version I used before 0.18.0, the timezone was 298not a property of the observation location, it was a global 299application configuration parameter. I had to hit C<< <F2> >> to open 300the configuration menu. In this menu, I selected the C<Plugins> tab, 301then C<Time zone>. With this, I selected a UTC display instead of a 302display using the computer's local timezone. 303 304=back 305 306=head1 Heliocentrism Or Geocentrism? 307 308Here are two assertions. Are they true of false? 309 310=over 4 311 312=item A 313 314The Sun goes around the Earth. 315 316=item B 317 318The Earth goes around the Sun. 319 320=back 321 322Assertion A is false, everyone agrees. But assertion B is false too. 323 324Oh yes indeed, will you answer, it should read actually: 325 326=over 4 327 328=item C 329 330The Earth runs along an elliptic orbit with the Sun located on 331one focus of the ellipse. 332 333=back 334 335This assertion is false too. Each one of the following assertions 336is nearer to the truth than assertions B and C (and A). 337 338=over 4 339 340=item D 341 342The center of mass of the Earth-Moon binary system runs along an 343elliptic orbit with the center of mass of the Solar System located 344on a focus of the ellipse. 345 346And I will point that the center of mass of the Sun is not the same 347as the center of mass of the Solar System. There are even times when 348the center of mass of the Solar System is I<outside> the surface of the Sun. 349The L<webpage|http://hp41programs.yolasite.com/solar-sys-bary.php> 350about an HP-41 program states that on 15th March 1983, the distance between 351both centers of mass was nearly 2.1 Sun radii. 352 353=item E 354 355The Earth runs along an orbit around the Sun, with noticeable perturbations 356caused by the Moon, Jupiter, Saturn, etc. 357 358Which is a formulation equivalent to assertion D. 359 360=item F 361 362The movement of the Earth with the Solar System is a I<n>-body problem, 363with I<n> ≥ 3. Therefore, there is no analytical solution. 364 365=item G 366 367The Solar System is a chaotic system. Even if we can predict with a reasonable 368accuracy what the various orbits will look like within the next hundred million 369years, this prediction is no longer possible for an interval of one milliard years 370(one billion years for US). 371 372=item H 373 374The Earth corkscrews in the general direction of the Hercules constellation 375with a approximate speed of 220 km/s. 376 377=item I 378 379The Earth runs along an orbit around the center of the Milky Way, with noticeable 380perturbations caused by the Sun, the Moon, Jupiter, Saturn, etc. 381 382=back 383 384Assertions B and C are what Terry Pratchett, Jack Cohen and Ian Stewart call 385I<lies to children> (I<Science of Discworld>, chapter 4, pages 38 and 39). These 386are false assertions, but simple enough to be understood by a child and which, even 387if false, leads children to a better understanding of the described phenomena and brings 388them closer to truth. You cannot tell assertion C to a child and expect him to understand 389it without telling him first assertion B. And it is worse with assertions D and next. 390 391Moreover, these are what I would call I<lies to adults>. In the beginning, people would consider that 392the aim of Physics was to build a mathematical representation of the real world, 393getting closer and closer to the ultimate truth. Then, there was quantum physics 394including especially de Broglie's work 395with the duality of wave and particle and the Copenhagen interpretation. Is the ultimate 396nature of the electron (for example) a wave? No. Is it a particle? No. So what? We do not 397care about the ultimate nature of the electron. The aim of Physics is to no longer 398to provide a mathematical I<representation> of the real world, but to build 399several mathematical I<models> of the real world. We know that intrinsically all 400models are false, but each one has it usefulness to lead to make computations about 401the real world. 402 403Please note that I was talking about scientific methods. I was not dealing with 404electoral campaigns and advertisements. Every sane adult knows for 405sure that these are ridden with lies. 406 407Other lies to adults, also known as "simplifying 408hypotheses", you will find in the following: 409 410=over 4 411 412=item * 413 414the light propagates instantly from one place to another, 415 416=item * 417 418the celestial bodies outside the Solar System are motionless, 419 420=item * 421 422they are located on a sphere call the I<Celestial Sphere>, 423 424=item * 425 426UTC time is equal to GMT time 427 428=item * 429 430the Earth's surface is a perfect sphere, without any polar flattening and without any equatorial bulge, 431 432=item * 433 434the Earth's surface is a perfect sphere, without any mountains, valleys or molehills, 435 436=item * 437 438there is even a place in this text where I imply that the duration of 439an astronomical year is an integer number of days (365, of course), 440 441=item * 442 443and, as I have already stated, all interesting locations 444on Earth are between the Tropic of Cancer and the Arctic Circle. 445 446=back 447 448In some paragraphs, I will temporarily set aside some of these lies. But in most 449paragraphs most of these lies will be in effect. 450 451=head2 Conclusion 452 453All this to explain that in the following text, I will not refrain from using 454the geocentric model where the Sun turns around the Earth in 24 hours or the 455geocentric model where the Sun turns around the Earth in 365.25 days. 456 457"It is not necessary that the following hypothesis be true or even 458resemble the truth. One thing is for sure that they provide calculations 459in accordance with the actual observations" 460 461Excerpt from Osiander's preface to Copernic's book. This excerpt was reused 462by Jean-Pierre Petit as a foreword to 463L<Cosmic Story|https://www.savoir-sans-frontieres.com/JPP/telechargeables/English/cosmic_story_anglo_indien/cosmic_story_en.html>. 464In Copernic's time, Osiander wanted to have heliocentrism accepted 465by people who were certain that geocentrism was the one and only truth. 466It is ironical that I use the same quotation to have geocentrism accepted 467by people who believe that heliocentrism is the one and only truth. 468 469=head1 Earth / Sun Movements 470 471=head2 Basic Movements 472 473In an heliocentric system pointing at fixed stars, Earth orbits around 474the Sun in one year. In other words, in a geocentric system, the Sun 475orbits around the Earth in one year, with an average speed of 0.9856 476degrees per day or 0.04107 degrees per hour. 477 478Also, the Earth spins around itself, making one turn in 23h 56mn 4s, 479with a speed of 4.178e-3 degrees per second, that is, 360.9856 degrees 480per day or 15.04107 degrees per hour. 481 482Q: I thought that the Earth was spinning in 24h! 483 484A: While the Earth spins, the Sun orbits around it. And what we see is 485the combination of both movements, which gives a combined speed of 360 degrees per day. 486What the commoner is interested in is to find the Sun at the same place in the 487sky at regular times day after day. Only after this is achieved, the commoner 488becomes a learned person and is interested in knowing and understanding the 489positions of the Moon, the stars and the planets. 490 491Q: And why did you say "average" two or three times? 492 493A: Because the angular speed of the Sun is not constant. We will get back 494to this question later. 495 496=head2 Coordinates 497 498The ecliptic is the plane where the Earth's orbit around the Sun is located (when 499using an heliocentric model) or where the Sun's orbit around the Earch is 500located (when using a geocentric model). We define also the equatorial plane, 501the plane which contains the Earth's equator. These two planes intersect with 502a 23° 26' angle. The intersection is a line, named I<line of nodes>. 503In some cases, it is more convenient to use a half-line than a line. 504In this case, the line of nodes is a half line starting at the Earth center 505and aiming at the Pisces constellation. 506The point where the line of nodes meets the celestial sphere is called 507I<vernal point> (which is politically incorrect, this is the beginning of 508autumn in the southern hemisphere). 509 510For a point on Earth, we generally use longitude and latitude. We start from 511an origin in the Gulf of Guinea, where the Greenwich meridian meets the equator. 512Then we move along the equator in a first arc and along a meridian in a second arc 513to reach the point. The angle of the first arc is the longitude, the angle of the 514second arc is the latitude for a point on the ground. But when we consider a celestial body, the 515first angle is counted from the line of nodes instead of the Gulf 516of Guinea and is called I<right ascension>; the second angle is called I<declination>. 517Because of tradition, an old charter or something, 518the right ascension is usually expressed as hours, minutes and seconds instead of 519degrees. The declination still uses degrees. And Paul Schlyter's program uses 520decimal degrees for the right ascension, like any other angle. 521 522I<Ecliptic coordinates> follow the same principle, but the first arc is drawn 523along the ecliptic instead of the equator. Likewise, the second arc is perpendicular 524to the ecliptic. These angles are named I<ecliptic longitude> and I<ecliptic latitude> 525respectively. The ecliptic longitude is counted from the same origin as the 526right ascension: the line of nodes. That simplifies a little bit the conversions 527between the two systems of coordinates. On the other hand, the use of hours, minutes 528and seconds for the right ascension and of degrees for all other angles 529is an unnecessary complication in the conversions. 530 531Because of the definition of the ecliptic plane, the ecliptic latitude of the 532sun is always zero. 533 534Lastly, there is the local coordinate system. For a given celestial body, we 535project its location to the ground, or rather to the plane that is tangent to 536the ground. The angle between the North and this location on the tangent plane 537is called I<azimuth> and the angle between the tangent plane and the line to the 538celestial body is called I<altitude>. 539 540=head3 Sidereal Time 541 542The sidereal time is an ambivalent notion. 543People are divided into two categories, those 544who describe it as an angle, 545and those who describe it as a time. Strangely, 546there is no flame war about these diverging 547attitudes, each category of people seeming to ignore 548"the other side". 549 550In the first category, people consider that despite its name, the 551sidereal time is an angle. See these French webpages: 552L<https://fr.wikipedia.org/wiki/Temps_sid%C3%A9ral> 553L<https://www.futura-sciences.com/sciences/definitions/univers-temps-sideral-960/> 554L<http://users.skynet.be/zmn/docs/temps/TempsSideral2.html> 555L<https://astrochinon.fr/index.php/documents/nos-dossiers/95-le-temps-sideral-de-greenwich>. 556Even if this notion is measured with hours, minutes 557and seconds, this is an angle. After all, the right ascension 558also is measured with hours, minutes and seconds and it is 559still an angle. 560 561Paul Schlyter is definetely in this category. He even 562defines the sidereal time as the right ascension of an 563earth-bound location and in his programs, he measures sidereal 564times in decimal degrees instead of hms values, just like 565he does for right ascensions. 566 567The second category considers that the sidereal time 568is a measure of time. See 569L<https://www.localsiderealtime.com/whatissiderealtime.html> 570and L<https://en.wikipedia.org/wiki/Sidereal_time>, 571as well as 572L<https://sites.google.com/site/astronomievouteceleste/5---temps-sideral> 573L<http://www.astrosurf.com/toussaint/dossiers/heuredetoiles/heuredetoiles.htm> 574L<http://dictionnaire.sensagent.leparisien.fr/Temps%20sid%C3%A9ral/fr-fr/> 575in French. 576 577But these descriptions seem to never mention issues linked 578with the measure of time: How is sidereal time influenced by 579timezones and daylight-saving time? What about leap seconds? 580With sidereal time as an angle, we can see that if you take two points 581on the surface of Earth within a few kilometers from each 582other in the E → W direction, these points have a different sidereal 583time. With sidereal time as a time, that would translate as saying 584that sidereal time and the principle of timezones are incompatible. 585Am I right or am I wrong? I found nothing about that in the 586"sidereal time as a time" explanations. 587 588So, between a simple and comprehensive definition on one side 589and a convoluted and incomplete definition on the other side, 590I will stick with "sidereal time as an angle" definition. 591 592=head2 Other Movements 593 594Before I explain the other movements involved with the 595Sun and the Earth, let me tell you a little digressive note. 596 597=head3 Weather And Climate 598 599I hate these people who, each time snow falls, cry 600"Where is this global warming scientists talk about 601again and again?" These people seem to ignore that 602climate and weather are two different things. When 603the temperature from a meteorologic station varies 604by 10 degrees C from one day to the following, this 605is a mundane meteorological event. When the I<average> 606temperature for a decade varies by 2 degrees C from 607one century to the next, this is a catastrophic 608climate event. 609 610The movements I explain below are more "climatic" and 611less "meteorogical" than Earth's spin and orbital 612rotation. Their values over a short timespan are so 613low that the algorithms computing astronomical positions 614over a short timespan do not care about them. 615 616Note: weather (but not climate) will come back in a few 617chapters as a real phenomenon, not as a metaphor. 618 619=head3 Equinox Precession 620 621The best known movement with a long timescale is the 622equinox precession. Presently, the vernal point lies 623within the constellation of Pisces. But actually, it moves 624all along the ecliptic, making a whole turn in about 62526,000 years. 626 627=head3 Nutation 628 629The angle between the equatorial plane and the ecliptic 630plane varies slightly. In Paul Schlyter's C program, the 631angle decreases by 356 nanodegrees per day (3.56e-7 °/d, 6321.3e-4 °/yr). 633 634=head3 Perihelion Precession 635 636There is also the perihelion precession. This movement 637is best known for Mercury, because it is the most apparent, 638but all other planets have a perihelion precession, including 639the Earth. 640 641=head3 Other Drifts And Fluctuations 642 643The formulas computing the positions of celestial bodies 644use some constants. But these values are constant only 645on a short timespan (astronomically speaking; or, with the 646metaphor above, on a "meteorological" timespan). But they are 647variable on a longer timespan (or a "climatic" timespan) For example, 648everybody knows that the day lasts 24 hours (the mean 649solar day, not the sidereal day). Yet, as I have read it 650somewhere, in paleontological times, it used to last 65122 hours or so. 652 653The variation of the duration of the day is a tiny 654variation, but with our modern measure instruments, we 655can measure it. Since the time when scientists abolished the 656astronomical standard of time for an atomic 657standard, it has been necessary to add 27 leap seconds 658over 47 years to synchronise the atomic timescale with 659the Earth's spin. 660 661For the moment, all adjustments have consisted in 662adding a leap second. But it can happen that we 663would have to synchronise in the other direction by removing 664a second. So this phenomenon produces fluctuations 665rather than a slow drift in a single direction. 666 667=head3 The Equation Of Time 668 669There are other fluctuations, easier to measure and with a more 670"meteorological" and less "climatic" timescale. The I<true> solar noon 671does not occur on the same precise time as the I<mean> solar noon. 672There are two reasons. 673 674=head4 Obliquity of the Earth 675 676First, there is an angle between the ecliptical plane and the equatorial plane, 677therefore, a constant-speed rotation on the ecliptical plane does not translate 678to a constant-speed rotation when measured by right ascension on the equatorial 679plane. The rate of variation of the right ascension is a variable rate. 680 681If we use the same units for the ecliptic longitude and the right ascension 682(either degrees or hours), then both values are nearly equal, but still different. 683So, when the ecliptic longitude is 46°20'31", the right ascension is 43°52'36", 684that is, a 2°27'54" gap. The same happens at longitude 226°20'31". And at 685longitude 313°32'52", the right ascension is 316°47", that is a gap of 2°27'54", 686but in the other direction. And the same happens at 133°32'52". These are 687the maximum values for the gap when using an obliquity of 23°26'. 688And if you prefer hours, here are the values: 689 690 . longitude right ascension gap longitude right ascension gap 691 . 3h05mn22s 2h55mn30s -9mn51s 46°20'31" 43°52'36" -2°27'54" 692 . 8h54mn11s 9h04mn03s 9mn51s 133°32'52" 136°00'47" 2°27'54" 693 . 15h05mn22s 14h55mn30s -9mn51s 226°20'31" 223°52'36" -2°27'54" 694 . 20h54mn11s 21h04mn03s 9mn51s 313°32'52" 316°00'47" 2°27'54" 695 696=head4 Kepler's Second Law 697 698Second, the rotational speed of Sun itself on the ecliptical plane is not a constant. 699It obeys Kepler's second law, with a rotational speed more or less inversely 700proportional to the Earth-Sun distance. 701 702Q: You cannot apply Kepler's second law to a geocentric model! 703 704A: No. Kepler's second law applies to a barycentric model as D above. It applies 705I<approximately> to an heliocentric model as C. But once we have computed 706Earth's angular speed on its orbit around the Sun in model C, the computation of the 707Sun's coordinates and speed in the geocentric model is very simple. Especially, 708the Sun's angular speed in a geocentric model is equal to the Earth's speed in 709an heliocentric model. 710 711Here are the Sun's positions for 2017, as given by Stellarium. The software 712gives the equatorial coordinates and I translate them into ecliptic coordinates. 713 714 date right ascension declination ecliptic longitude 715 4 January 18h59mn1s 284°45'15" -22°44'43" -76°24'58" or -76,4162° 716 5 January 19h3mn24s 285°51' -22°38'18" -75°23'58" or -75,3996° 717 3 July 6h48mn 102° 22°58'35" 101°2'7" or 101,0355° 718 4 July 6h52mn8s 103°02' 22°53'39" 101°59'26" or 101,9907° 719 720This translates as a speed of 1.0166 degree per day in January at perigee (when 721in a geocentric model, that is perihelion in an heliocentric model) and a speed 722of 0.9552 degree per day in July at apogee (or aphelion). Values are respectively 7230.0423°/h and 0.0398°/h. 724 725=head4 Equation of Time 726 727The Earth's spin velocity is constant, that is 360.9856 degrees per day 728but the Sun's orbital speed around the Earth is not. The combination of 729both speeds is variable and it is I<not> 360 degrees per day. The crossing 730of the meridian by the Sun is not exactly every 86400 seconds. 731There is a difference between the Solar I<Mean> Time, where noon occurs 732every 86400 seconds, no more, no less, and the Solar I<Real> Time, in which 733noon is defined by the time when the Sun crosses the meridian. The difference 734between the Solar Mean Time and the Solar Real Time is called I<equation 735of time>. 736 737Here are the extreme values for the equation of time in 2017, computed 738by a script using L<DateTime::Event::Sunrise> and refined with Stellarium. 739 740 Date DT::E::S Stellarium 741 2017-11-02 11:43:33 11:43:37 -16mn23s earliest noon value, 742 2017-02-10 12:14:12 12:14:14 +14mn14s latest noon value 743 2017-09-11 11:56:33 11:56:34 -3mn26s 744 2017-09-12 11:56:11 11:56:13 -3mn47s biggest decrease: 21 or 22 seconds 745 2017-12-17 11:56:11 11:56:14 -3mn46s 746 2017-12-18 11:56:41 11:56:44 -3mn16s biggest increase: 30 seconds 747 748And here is the curve for the equation of time. 749 750=for html 751<p> 752<img src='equ-time.png' alt='Curve of the equation of time during one year' /> 753</p> 754 755=head4 The Analemma 756 757The irregularity of the Sun's trajectory can be visualised by using the Local Mean Time 758as a reference and pinpointing the positions of the Sun at noon in LMT. 759The various Sun positions day after day build an 8-shaped curve, called I<analemma>. 760 761=head4 Mean Sun, Virtual Homocinetic Sun 762 763In the following, it is useful to imagine a virtual Sun which would use an constant 764angular speed (either in equatorial coordinates or ecliptic coordinates, depending on 765which is more convenient). 766 767The concept of I<Mean Sun> is a virtual Sun like this, calibrated so it crosses 768the meridian at 12:00 (Local Mean Time) each day, and which minimizes the difference 769between the real local noon and the mean local noon. 770 771I will also consider several "virtual homocinetic suns" or VHS (no relation with 772magnetic tapes). These virtal suns are synchronised with the real Sun at some 773convenient point and then move with a constant angular speed. 774 775=head1 Computing Sunrise and Sunset 776 777Computing sunrise and sunset consists in taking in account both the variation of 778day's length and the equation of time to pinpoint when the Sun reaches the 779altitude that corresponds to sunrise or sunset. 780 781In the schema below, the variation of day's length results in a bobbing up and 782down of the sinusoidal curve (and less obviously, a vertical stretch or compression 783of this curve). The equation of time results in a leftward or rightward shift 784of the curve. 785 786=for html 787<p> 788<img src='pseudo-analemma.gif' alt="Evolution of the Sun's trajectory during a year" /> 789</p> 790 791Q: Wahoo! Impressive! 792 793A: You should not be impressed. I took some liberties with the reality. First, 794I figured the Sun's trajectory as a sinusoidal curve, because it is easy to compute, 795but I did not check whether it was the real curve. And I would bet that it is 796only approximately close to the real curve. Second, the equation of time is very much 797increased. Instead of a true solar noon varying from 11:43 to 12:15 (in mean solar time), 798here the variation is multiplied by 4 and the solar noon varies from 11:00, or even less, 799to 13:00. But without this stretching, you would not have seen anything. 800 801Q: And this figure eight, is this the analemma? 802 803A: No. The analemma gives the position of the Sun as azimuth and height at 804I<mean> solar noon. In the curve above, the abscisse is the mean time of 805I<true> solar noon and the ordinate is the height of the Sun at this instant. 806In other words, the analemma is based on a regular temporal event, the mean solar 807noon, and plots the correlation between two variable spatial phenomena, the 808azimuth and the height of the Sun. On the other hand, the curve above is based on 809a precise spatial event, the azimuth 180°, and plots the correlation between a 810variable spatial phenomenon, the height of the Sun and a variable temporal event, 811the true solar noon. 812 813I admit that the ordinates of both curves are very similar notions, and it would be 814comparing golden apples with Granny Smiths. On the other hand, the abscisses are 815a spatial angle in one case and a time of the day in the other case, so it would 816be comparing apples with oranges. 817 818Q: And the similarity of the shapes is juste a coincidence? 819 820A: No, this is no coincidence. Let us start with the ordinates. 821The curve above, which I will call "pseudo-analemma", gives the 822height of the Sun at I<true> solar noon, so the Sun is at its highest for the current day. 823Therefore, the height of the Sun in the analemma is obviously lower than on the 824pseudo-analemma (except during the 4 days when the curve crosses the Y-axis). 825But since we are near a point with an horizontal tangent, the variation 826is very small. For example, we consider an observer at Greenwich observatory on 8272nd November 2017. At true solar noon (11h 43mn 37s), the Sun is at 23°37'39" 828while a quarter of an hour later, at mean solar noon it is at 23°31'40" 829(values given by Stellarium). 830 831For the abscisses, it is a bit more complicated. Let us use the same example as 832above. At mean solar noon, the Sun's azimuth is 184°19'08", so on the analemma 833the dot for 2nd November is on the right of the Y-axis. On the pseudo-analemma, 834true solar noon occurs at 11h 43mn 37s, so the dot for 2nd November is on the 835left of the Y-axis. Not only the units of measure are not the same, but there 836is a change of sign. So the pseudo-analemma and the analemma 837are, approximately, the symetrical image of the other curve. 838 839See L<below|"Policitally Correct Analemma"> for a politically correct 840discussion of the analemma and pseudo-analemma. 841 842=head2 Principle of the Iterative Computation 843 844There are two models for the variability of the true solar 845noon from one day to the next. Let us take the example 846of an observer in Greenwich in September 2017. 847On 11th September, the true solar noon occurs at 11:56:34, 848with an altitude of 42°53'40" and the next day it occurs 849at 11:56:13 with an altitude of 42°30'47". 850 851With the first model, we consider that the 11:56:34 value applies on the 11th from 00:00:01 until 23:59:59, at which time it instantly jumps 852to 11:56:13 for the 12th. In other words, the pseudo-analemma 853is a cloud of 365 discrete points. 854 855Or else, we can consider that the true solar noon is a continuous function 856and that the pseudo-analemma is a continuous curve. When using the orbital parameters 857for the 11th at 11:56:34, the computed sunset occurs at 18:23:59. Since the true solar noon varies by 21 seconds over a timespan 858of 86379 seconds (one day minus 21 seconds), using linear interpolation, 859we can find that after 23225 seconds (i.e. at 18:23:59), the true solar 860noon has varied by 5.6 seconds. Likewise, the altitude varies 861by 22'53" in 86379 seconds and by 6'9" in 23225 seconds. So at 86218:23:59, we have a I<virtual> true solar noon of 11:56:28 863and a I<virtual> noon altitude of 42°47'31". 864 865So we move a little bit the course of the Sun so it will 866be at its highest at his virtual point 867and we recompute the intersection between the new course and 868the horizontal line corresponding to sunset. The result will not 869be 18:23:59, but very near to this value and even nearer to the value 870from Stellarium: 18:23:24. 871 872=head2 Implementation of Basic Algorithm 873 874Before describing the precise algorithm, let us talk about the basic algorithm. 875We will use the example of the sunset at Greenwich, on 4th January, 2018. 876 877This paragraph and the following are based on the Perl code below: 878 879 for(0, 1) { 880 say join( " | ",$_, sunrise({ year => 2018, month => 1, day => 4, 881 lon => 0, lat => +51.5, tz => 0, isdst => 0, 882 alt => -.833, upper_limb => 0, precise => $_, polar => 'retval', 883 trace => *STDOUT } )); 884 } 885 886The basic algorithm begins by computing the day's true solar noon. 887On 4th Jan, the true solar noon at Greenwich happens at 12:04:56. 888 889Then we apply both Earth's spin (360.9856 degrees per day) and 890the movement of a VHS ("virtual homocinetic sun"), that is, 0.9856 degrees per 891day. The result is a combined rotational speed of 360 degrees per day, that is, 89215 degrees per hour. And sunset happens when the VHS reaches the target altitude. 893 894So on 4th Jan, the angle between noon and sunset is 59.9746° (59° 58' 28"). 895We need 3.9983 hours (3 h 59 mn 53 s) to run this angle and the sunset for 896the VHS occurs at 16:04:50. 897 898=head2 Implementation of Precise Algorithm 899 900With the precise algorithm, we keep separate Earth's spin (360.9856 degrees 901per day) and the Sun's rotational speed around Earth. In addition, this 902rotational speed is the real speed, spanning from 0.9552 to 1.0166 903degree per day. 904 905First iteration. We start from the true solar noon at 12:04:56 and we apply Earth's spin 906(15.04107 degrees per hour). The first result, a very approximate one, is the 907instant when Earth's spin brings the Sun to the target altitude. 908On 4th Jan, this first value is 16:04:11. 909 910For iteration 2, we determine the virtual solar noon that corresponds to the 911Sun's position at 16:04:11. This virtual solar noon occurs at 12:05:01. 912With this reference, we apply the Earth's rotation and we get a second 913value for sunset, 16:04:23 (16.0731615074431 in decimal hours). 914 915For iteration 3, we determine the virtual solar noon 916that corresponds to the Sun's position at 16:04:23. This new virtual solar 917noon occurs at 12:05:01. And one more time we apply the Earth's rotation 918and we obtain a third value for sunset, 16:04:23, differing from the previous 919value by less than a second: 16.0731642391519 instead of 16.0731615074431. 920The difference is 2,73e-6 hours, that is 9 ms, so we leave the computation loop. 921 922This is one way to describe the algorithm: the Sun reaches by anticipation 923its position in the evening and stays there, waiting for the spinning Earth 924to spin until the Sun disappears below the horizon. Another way to describe 925the algorithm is as follows: 926 927During iteration 2, between the real solar noon 12:04:56 and the time given 928by iteration 1, 16:04:11, the Sun orbitates with its real speed of 1.0166 degree per day 929while the Earth spins at 360.9856 degrees per day. 930Then, at 16:04:11, the Sun freezes in its track and after that, we adjust the 931position with only the Earth's spin to reach the required altitude. 932And the sunset occurs at 16:04:23. 933 934During iteration 3, between the real solar noon 12:04:56 and the time given 935by iteration 2, 16:04:23, the Sun orbitates with its real speed 1.0166 degree per day. 936Then at 16:04:23, it freezes, letting the Earth continue its spin. And sunset 937happens 9 milliseconds later, at 16:04:23. So, there are 3 h 59 mn 27 s when we use 938the Sun's real orbital speed and 9 milliseconds when we use an obviously wrong orbital 939speed. In the end, it is better than the basic algorithm, which uses an approximate 940but still wrong orbital speed, but for the whole span of 3 h, 59 mn and 57 s. 941 942=head2 What Happened in Spring 2020? 943 944Let us look a bit farther into the past. In January 2019, I published 945version 0.98 of L<Astro::Sunrise>, with the precise algorithm 946implemented as explained in the preceding paragraph. For test data, I 947did not know how to cross-check with authoritative sources, so I just 948checked they looked plausible and that the iterative computation 949stopped after a few iterations. At this time, I did not synchronise 950L<DateTime::Event::Sunrise> with L<Astro::Sunrise>, because it was not 951the proper time yet. 952 953Then in April 2020, a user created an RT ticket, explaining that he 954had compared the results of L<DateTime::Event::Sunrise> with 955authoritative websites and that the results were not precise enough. 956Of course the results were not precise, I had not yet synchronised 957L<DateTime::Event::Sunrise> with L<Astro::Sunrise>. Yet this ticket 958gave me two things: first, a website which would provide precise 959day-after-day computations of sunrise, sunset and real solar noon, and 960second a few round tuits to upgrade L<DateTime::Event::Sunrise> to the 961same level as L<Astro::Sunrise>, with real tests values. 962 963There was a glitch. The precise algorithm copied from 964L<Astro::Sunrise> and the test data from the NOAA website were not 965matching. After tweaking the algorithm and asking for advice on the 966DateTime mailing-list 967(L<https://www.nntp.perl.org/group/perl.datetime/2020/06/msg8241.html>), 968I had to admit that using a 15-degree-per-hour spin speed was giving 969better results than the normal 15.04107-degree-per-hour value. So I 970coded the C<15> value in L<DateTime::Event::Sunrise> and I published 971the module. 972 973=head3 What Went Wrong? 974 975I still think my explanations of the precise algorithm are correct. I 976think that the error lies in the implementation of this algorithm. 977Using as an example the values above, during iteration 2 we should use 978the Sun at its 16:04:11 position and not moving. Without being 979certain, I think that actually, the program computes the virtual solar 980noon for 16:04:11, which is 12:05:01 and that after that it uses the 981Sun at its 12:05:01 position. 982 983How can I check this hypothesis? I need to "create" a new fixed star 984at the 16:04:11 position of the Sun. And I do not know how to do that 985in Stellarium. A few months later, I read the documentation for 986Stellarium 0.20.1-1. In chapter 13, I found that the user can add 987unofficial novas to the novas coming from the official star 988catalogues. This would answer my need. The problem is that I have 989Stellarium 0.18.0 and that I did not succeed in creating "my" nova in 990this version. So for the moment, it is impossible to check the 991implementation of the precise algorithm. 992 993=head1 More About The Parameters 994 995Below, I give some detailed explanations about the parameter used when 996calling the module's functions. These explanations would have been too 997long if they had been included in the module's POD and a casual doc reader 998would have been drowned in a deluge of informations. 999 1000=head2 Choosing The Algorithm, C<precise> Parameter 1001 1002Q: When should I choose the precise algorithm? 1003 1004A: The short answer is "Never". The long answer is the following: 1005 1006=over 4 1007 1008=item * 1009 1010If you want some twilight, use the basic algorithm. 1011 1012=item * 1013 1014If you live between the polar circles, use the basic algorithm. 1015 1016=item * 1017 1018If the date is far from a transition between day+night and either polar 1019night or midnight sun, use the basic algorithm. 1020 1021=item * 1022 1023If the date is near a transition between day+night and polar 1024night, use the basic algorithm. 1025 1026=item * 1027 1028If you live in a polar location AND the date is near a transition between 1029day+night and midnight Sun AND you are interested in the 1030visibility of the Sun's disk above the horizon, then you may use the 1031precise algorithm. 1032 1033Note that if you live a bit southward of the arctic circle (say, Reykjavik), 1034you should use the precise algorithm around the 21st of June, even if midnight 1035sun does not happen there. Same thing aoround the 21st of December if you live 1036a bit northward of the antarctic circle. 1037 1038=back 1039 1040Q: And can we know why the use of the precise algorithm is so narrow? 1041 1042A: Let us go back to the animated picture of the solar course curve that 1043moves along the pseudo-analemma. But instead of using a location 1044at Greenwich, we use a polar location still at longitude zero, but at 104576 degrees and 59 minutes from the equator. 1046 1047=for html 1048<p> 1049<img src='ps-an-pol.gif' alt="Evolution of the Sun's trajectory during a year (arctic variant)" /> 1050</p> 1051 1052 1053As you can see, around 21st April and 21st August, the solar course 1054is tangent or nearly so with the line of horizon. 1055With these conditions, a variation of 6' of the solar altitude 1056can produce a much bigger variation of the points where the 1057solar course crosses the horizon. 1058For example, on 20th April 2017, at sunset time, we need 8 mn 18 s 1059to achieve this variation of 6'. 1060 1061Q: Where does this 6' value come from? 1062 1063A; This is the value I calculated in the chapter 1064L<Principle of the Iterative Computation>. 1065 1066On the other hand, if you live in a temperate location far from the 1067arctic circles, the slope of the solar course when crossing 1068the horizon is always a bit steep. 1069For example, at Greenwich, the shallowest slope occurs at each solstice 1070and is about 6 or 7 degrees of altitude per hour. So a variation of 6' shifts the sunrise and sunset times by 1071only 50 seconds or less. 1072 1073The diagram below shows the effect of a 6' vertical translation on the solar course in 1074two cases: 20th April at 76° 59' N and 21st December at Greenwich. 1075Warning: it is not to scale. 1076 1077=for html 1078<p> 1079<img src='sunset-slope.png' alt="Sun course, comparison between Greenwich on 21/12 and latitude 76 on 20/04" /> 1080</p> 1081 1082Q: And what happens to people living in polar locations when 1083the date is far from any transition? 1084 1085A: If the period is day+night, the explanations above about the steep enough slope 1086of the curve still apply. If the period is the polar night or the 1087midnight Sun, then the course of the Sun never crosses the horizon and 1088any variation of altitude, within limits, cannot create an intersection 1089with the horizon. 1090 1091Q: For the transition with the polar night, the solar course is tangent 1092to the equator, like it is at the transition with the midnight Sun period. 1093So, why do you still advise to use the basic algorithm in this case? 1094 1095A: The basic algorithm and the precise algorithm both try to estimate 1096the ecliptic longitude and the altitude of the virtual noon sun at 1097the time of sunset. But while the precise algorithm uses the real 1098orbital speed which varies from 0.9552°/d to 1.0166°/d, the basic 1099algorithm uses a constant speed of 0.9856°/d, with an error of 1100±0.0310°/d. For the transition between day+night and midnight Sun, 1101this error runs for more than 11 hours, which might result in an error 1102of 0.015° on the Sun's ecliptic longitude. But for the transition 1103between day+night and polar night, the error runs for one hour or 1104less, yielding an error on the ecliptic longitude of 0.0013° only. So 1105even if a small error on the sun altitude gives a big error on the 1106sunset time, at the transition with the polar night, you will have a 1107I<tiny> error, not a I<small> one. 1108 1109Q: And what about the computation of twilights? We can encounter a situation 1110where the solar course is tangent to the horizon, if I may use this word for a 1111line situated 24 degrees below the horizontal plane. And we have a ≈12 hour 1112gap as for the midnight Sun transition, not a 1-hour gap as for the polar night 1113transition. 1114 1115A: Why do you compute twilight times? Because you want a low enough light 1116level and good enough conditions to observe celestial bodies. 1117Do you think there is a big difference between a night when the Sun is 1118at its lowest at 17°57' below the horizon and a night when it is at its 1119lowest at 18°3' below? In some circumstances, you'd better begin your observations 1120when the Sun is at, say, -15° than to wait for the -18° twilight if you know 1121that the Moon will rise at the same time or if a weather report gives a warning 1122about an incoming overcast layer. 1123 1124=head2 C<alt> Parameter (Altitude) and C<upper_limb> Parameter 1125 1126Parameter C<alt>, in decimal degrees, allows you to specify the altitude 1127of the sun corresponding to the event you are looking for: sun rise, sun 1128set or a twilight of some degree. 1129 1130First, the various twilight values: they are arbitrary values. Nothing 1131to add. 1132 1133For sunrise and sunset, the usual value is -0.833°, that is, -50'. 1134It comes from two values: 1135 1136=over 4 1137 1138=item * -0.583° or -35' for the refraction, 1139 1140=item * -0.25° or -15' for the radius of the solar disk. 1141 1142=back 1143 1144Actually, in both cases, these are approximate values for variable phenomena. 1145The radius of the sun disk varies between 0.271° (or 16'16") on 3rd January, when 1146the sun is closest from the Earth, and 0.262° (or 15'44") on 3rd July, when it is 1147farthest from the Earth. 1148 1149And the deviation caused by refraction is highly dependent on the temperature 1150profile in the atmosphere, therefore dependent on the current weather. 1151 1152You can refine the computation by using value -0.583 for the C<alt> parameter and 1153giving a true value to the C<upper_limb>) parameter (usually 1). In this case, the 1154radius of the sun disk is computed anew for each day. On the other hand, there is 1155no way within the module to refine the computation of the refraction. The answer 1156can only come from outside the module computing sunrises and sunsets. 1157 1158Q: So using a parameter C<alt> with -0.583 and a parameter C<upper_limb> with 0 is stupid? 1159 1160A: No, it is just unusual. As stated by Paul Schlyter 1161L<in his website|http://www.stjarnhimlen.se/comp/riset.html#2>, 1162the Swedish national almanacs define sunrise and sunset as the instants when the I<centre> 1163of the sun disk reaches the optical horizon, not the instants when the I<upper limb> of 1164the sun disk reaches the optical horizon. 1165 1166Q: On the other hand, using a parameter C<alt> with -0.833 and a parameter C<upper_limb> with 1 is stupid? 1167 1168A: I would say neither "stupid" nor "unusual", but "suspicious". Actually, the usual -0.833 value comes from 1169three elements: 1170 1171=over 4 1172 1173=item * 0 for the position of the observer relative to the surrounding landscape, 1174 1175=item * -0.583° or -35' for the refraction, 1176 1177=item * -0.25° or -15' for the radius of the solar disk, or 0 if you give a true value to C<upper_limb>. 1178 1179=back 1180 1181But if you are at the top of a 60-meter tower, the horizon line no longer 1182coincides with the horizontal plane, but with a cone making a 0.25° angle with the 1183horizontal direction. In this case, we have: 1184 1185=over 4 1186 1187=item * -0.25° for the position of the observer relative to the surrounding landscape, 1188 1189=item * -0.583° for the refraction, 1190 1191=item * 0° for the radius of the solar disk if you give a true value to C<upper_limb>, or -0.25° for a false value. 1192 1193=back 1194 1195So this parameter combination is valid, but it is suspicious because it does not correspond 1196to a usual and mundane situation. 1197 1198Q: After your explanation about the C<precise> parameter, is there a significant 1199difference between C<< alt => -0.833, upper_limb => 0 >> and 1200C<< alt => -0.583, upper_limb => 1 >>? 1201 1202A: You guessed, it, there is nearly no difference. The example I will take is sunset 1203at Fairbanks on 3rd January 2020. I take 3rd January because it is the time of the year 1204when the sun is at its largest. According to Stellarium, the diameter is 32'32", so the 1205radius is 16'16". And I take Fairbanks, because near a polar circle, the course of the sun 1206at sunset is much shallower than near the equator. So, for 1207C<< alt => -0.833, upper_limb => 0 >> the sunset occurs when the 1208center of the sun dist is at -50' and for 1209C<< alt => -0.583, upper_limb => 1 >> it occurs when the center of the sun disk is at -51'16". 1210Stellarium gives 15:59:12 in the first case and 15:59:37 in the second case. 1211A meagre 25-second difference. 1212 1213On the other hand, let us move a few hundred kilometers to the North, 1214to 68°01'46" N, 147°42'59" W, beyond the polar circle. The computation with 1215C<< alt => -0.833, upper_limb => 0 >> shows that the sun 1216stays below the horizon and neither rises nor sets, while the computation with 1217C<< alt => -0.583, upper_limb => 1 >> gives a sunrise at 12:45:11 and a 1218sunset at 13:05:53. 1219 1220=head2 C<year> Parameter 1221 1222Q: Why does L<Astro::Sunrise> need the year to compute sunrise and sunset? 1223I have seen an algorithm which only needs the month and the day. 1224 1225A: Let us compute the sunset at the Greenwich observatory at the end 1226of February and at the beginning of March. The times are respectively: 1227 1228 . 26/02 27/02 28/02 29/02 01/03 02/03 03/03 1229 2015 17:46:17 17:35:43 17:37:29 17:39:15 17:41:01 17:42:47 1230 2016 17:47:36 17:35:17 17:37:03 17:38:49 17:40:35 17:42:21 17:44:06 1231 2017 17:47:11 17:36:37 17:38:24 17:40:10 17:41:55 17:43:41 1232 2018 17:46:45 17:36:12 17:37:58 17:39:44 17:41:30 17:43:15 1233 2019 17:46:20 17:35:46 17:37:32 17:39:18 17:41:04 17:42:49 1234 2020 17:47:39 17:35:20 17:37:06 17:38:52 17:40:38 17:42:24 17:44:09 1235 2021 17:47:13 17:36:40 17:38:26 17:40:12 17:41:58 17:43:44 1236 2022 17:46:48 17:36:14 17:38:01 17:39:47 17:41:32 17:43:18 1237 2023 17:46:23 17:35:48 17:37:35 17:39:21 17:41:07 17:42:52 1238 1239As you can see in this table, when we go forward by 365 days, the sunset 1240time decreases by about 25 seconds. When we go forward by 366 days, the 1241sunset time increases by about 1 mn 20 s. And if we go forward by one 1242civil year, the sunset time seesaws. So, for the 28th of February, 1243which result should your yearless algorithm give? 17:37:03? Or 17:38:26? 1244 1245Q: That means that my algorithm is bad. 1246 1247A: No. If you want to know the precise instant when the Sun disappear 1248from our field of view, your algorithm is wrong indeed. On the other hand; if you are only interested 1249in the level of light, your algorithm is OK. I know a person who uses 1250a yearless algorithm to activate automated lights in his living room. 1251For him, turning on the lights at 17:37:03 or 17:38:26 has no importance. 1252Under our latitudes, the light variation in two minutes is negligible. 1253Actually, the weather may have a much important effect. If you have a clear 1254sky or a heavy layer of black thunder clouds, you will have to light 1255later or sooner than the computed time. 1256 1257Q: By the way, you seem to say that a yearless algorithm would be sufficient 1258to compute twilight times? So why use an algorithm requiring the year? 1259 1260A: Firstly, because the basic algorithm was already coded and a slightly worse 1261algorithm would be redundant. Then because I do not know which licenses 1262apply to these yearless algorithms, while at the same time, Paul Schlyter's 1263algorithm is in the public domain. 1264 1265Q: Another thing, how did you get the seconds in the table? L<Astro::Sunrise> 1266does not provide the seconds. 1267 1268A: Because I have used L<DateTime::Event::Sunrise> instead of L<Astro::Sunrise>, 1269which produces L<DateTime> objects, complete with seconds. 1270 1271Q: Could we modify L<Astro::Sunrise> to give C<"hh:mm:ss"> results instead 1272of C<"hh:mm">? 1273 1274A: We could. But would this precision be meaningful? According to Paul 1275Schlyter, the algorithm precision is about 1 or 2 minutes, except at the 1276beginning and the end of the Polar Day period when the precision is much 1277worse. So it is not worth adding the seconds to the results produced by 1278L<Astro::Sunrise>. 1279 1280Q: And in the discussion above, why did you keep the seconds, if they 1281are not significant? 1282 1283A: Because I think that if there is an error, it will be the same error 1284for similar dates, that is, end-February and beg-March within a decade. 1285For instance, we may have a S<+45 s> bias on 2015-02-28 and a S<-50 s> 1286bias on 2015-10-28 and on 2050-02-28, but for all the dates similar 1287to 2015-02-28 in both a YYYY fashion and a MM-DD fashion, the bias will 1288be approximately the same as 2015-02-28. Maybe S<+43 s> or S<+46 s> instead 1289of S<+45 s>, but surely not S<-50 s>. So I can make comparisons with a 1290granularity of 1 second. By the way, the bias values I gave above are 1291complete guesses, they are not the result of a precise computation. 1292 1293TO BE COMPLETED 1294 1295=head1 Annex: Politically Correct Explanations 1296 1297=head2 Policitally Correct Analemma 1298 1299First, let us deal with observers located north of the Arctic Polar Circle. 1300They just have to know that the analemma and the pseudo-analemma cross the horizon 1301and are partly hidden by the ground. The hidden part, more or less important depending 1302on the observer's latitude, corresponds to the year period when the I<polar night> is 1303in effect. You can find an example of the arctic pseudo-analemma in the 1304paragraph about the C<precise> parameter. 1305 1306For observers between the Tropic of Capricorn and the Antarctic Polar Circle, 1307this is more strange. True solar noon corresponds to a right ascension of 0°, 1308when the Sun is exactly northward. As the observer must face north instead of south, 1309he sees the sun crossing the sky in the direction E → N → W, that is, in the 1310direction of I<decreasing> right ascension values. So, when the true solar noon is 1311ahead of the mean solar noon, the point on the analemma will be to the left of the Y-axis, 1312and when the true solar noon is later than the mean solar noon, the point on the analemma 1313will be to the right of the Y-axis. 1314 1315On the same time, for the pseudo-analemma, there is no reason to change the way 1316the time of day is represented on the abscisses, that is, left to right. Therefore, 1317the analemma and the pseudo-analemma will be more or less superposable, without 1318an intervening symmetry. 1319 1320For observer to the south of the Antarctic Polar Circle, the situation is the same, 1321with the additional provision that the analemma and the pseudo-analemma will be partly 1322hidden by the ground. 1323 1324And what about observers located between both tropics? An observer facing south 1325cannot see the whole analemma, he would miss the part around 21st of June, 1326which is located behind his back. And if he faces north, he will miss the 1327part around 21st of December. What to do then? Just lie on the ground. If the 1328observer lies with the head to the north and the feet to the south, the observed 1329analemma will be similar to the curve seen by an observer north of the Tropic of Cancer. 1330If the observer lies with the head to the south and the feet to the north, the situation 1331will be similar to an observer on the south of the Tropic of Capricorn and facing north. 1332 1333TO BE COMPLETED 1334 1335