예제 #1
0
        public void Seasons()
        {
            // 2 min error
            const double error = 2.0 / (24 * 60);

            // example 26.a
            {
                double jd = SolarEphem.Season(new Date(1962, 1, 1).ToJulianDay(), Season.Summer);
                Assert.AreEqual(2437837.39245, jd, error);
            }

            {
                double jd = SolarEphem.Season(new Date(1991, 1, 1).ToJulianDay(), Season.Spring);
                Assert.AreEqual(new Date(new DateTime(1991, 3, 21, 3, 2, 54, DateTimeKind.Utc)).ToJulianEphemerisDay(), jd, error);
            }

            {
                double jd = SolarEphem.Season(new Date(1991, 1, 1).ToJulianDay(), Season.Summer);
                Assert.AreEqual(new Date(new DateTime(1991, 6, 21, 21, 19, 46, DateTimeKind.Utc)).ToJulianEphemerisDay(), jd, error);
            }

            {
                double jd = SolarEphem.Season(new Date(1991, 1, 1).ToJulianDay(), Season.Autumn);
                Assert.AreEqual(new Date(new DateTime(1991, 9, 23, 12, 49, 04, DateTimeKind.Utc)).ToJulianEphemerisDay(), jd, error);
            }

            {
                double jd = SolarEphem.Season(new Date(1991, 1, 1).ToJulianDay(), Season.Winter);
                Assert.AreEqual(new Date(new DateTime(1991, 12, 22, 8, 54, 38, DateTimeKind.Utc)).ToJulianEphemerisDay(), jd, error);
            }
        }
예제 #2
0
        public ICollection <AstroEvent> EventsSeasons(AstroEventsContext context)
        {
            List <AstroEvent> events = new List <AstroEvent>();

            for (double jd = context.From; jd < context.To; jd += 365)
            {
                events.Add(new AstroEvent(SolarEphem.Season(jd, Season.Spring), Text.Get("SunEvents.Seasons.Spring")));
                events.Add(new AstroEvent(SolarEphem.Season(jd, Season.Summer), Text.Get("SunEvents.Seasons.Summer")));
                events.Add(new AstroEvent(SolarEphem.Season(jd, Season.Autumn), Text.Get("SunEvents.Seasons.Autumn")));
                events.Add(new AstroEvent(SolarEphem.Season(jd, Season.Winter), Text.Get("SunEvents.Seasons.Winter")));
            }

            return(events);
        }
예제 #3
0
        public ICollection <AstroEvent> EventsSeasons(AstroEventsContext context)
        {
            List <AstroEvent> events = new List <AstroEvent>();

            for (double jd = context.From; jd < context.To; jd += 365)
            {
                // check for cancel
                if (context.CancelToken?.IsCancellationRequested == true)
                {
                    return(new AstroEvent[0]);
                }

                events.Add(new AstroEvent(SolarEphem.Season(jd, Season.Spring), Text.Get("SunEvents.Seasons.Spring")));
                events.Add(new AstroEvent(SolarEphem.Season(jd, Season.Summer), Text.Get("SunEvents.Seasons.Summer")));
                events.Add(new AstroEvent(SolarEphem.Season(jd, Season.Autumn), Text.Get("SunEvents.Seasons.Autumn")));
                events.Add(new AstroEvent(SolarEphem.Season(jd, Season.Winter), Text.Get("SunEvents.Seasons.Winter")));
            }

            return(events);
        }
예제 #4
0
 private Date Seasons(SkyContext c, Season s)
 {
     return(c.GetDate(SolarEphem.Season(c.JulianDay, s)));
 }