Esempio n. 1
0
 public static DailyPosition[] MoonPhase(DailyPosition[] tgtdata)
 {
     //Computes moon phase for each date in tgtdata
     Celestial.RADec sunradec;
     Celestial.RADec moonradec;
     foreach (DailyPosition dp in tgtdata)
     {
         sunradec  = DailyPosition.SunRADec(Celestial.DateToJ2kC(dp.UTCdate));
         moonradec = DailyPosition.MoonRaDec(Celestial.DateToJ2kC(dp.UTCdate));
         dp.SetMoonPhase(sunradec.RA, moonradec.RA);
     }
     return(tgtdata);
 }
Esempio n. 2
0
        //public methods for managing the daily position functions
        //SunCycle generates a year of sunrise and sunset events
        //TargetCycle generates a year of target rise and set events (within sunrise-sunset)
        //MoonCycle generates a year of moon rise and set events (within target rise-set)
        //MoonPhase adds phase to target events
        //Moonclear adds moonless percentage to target events

        public static DailyPosition[] SunCycle(int dYear, Celestial.LatLon obsLocation)
        {
            //Calculates a year//s worth of sunrises and sunsets
            const double twilight = -18; //(degrees)

            DailyPosition[] sunspots = new DailyPosition[367];
            Celestial.RADec sunpos;

            DateTime ndate = new DateTime(dYear, 1, 1, 0, 0, 0); //create datetime object for jan 1, dYear
            DateTime udate = ndate.ToUniversalTime();            //convert to UTC
            DateTime sdate = udate.AddDays(-1);                  //back up one day to make sure Jan 1 is covered

            for (int dayidx = 0; dayidx < sunspots.Length; dayidx++)
            {
                DateTime tdate = sdate.AddDays(dayidx);
                sunpos           = DailyPosition.SunRADec(Celestial.DateToJ2kC(tdate));
                sunspots[dayidx] = new DailyPosition(tdate,
                                                     tdate.AddDays(1),
                                                     sunpos,
                                                     obsLocation,
                                                     twilight);
            }
            return(sunspots);
        }