public void TestSolarClock() { var chandigarh = new double[] { 30.7333, 76.7794 }; var pune = new double[] { 18.5204, 73.8567 }; SolarClock sc = new DateTime(2016, 4, 1).SolarClock(chandigarh[0], chandigarh[1], 5.5, true); //since this is astronomical Debug.WriteLine(String.Format("Sunrise would be at {0}", sc.sunrise)); Debug.WriteLine(String.Format("Sunset would be at {0}", sc.sunset)); Debug.WriteLine(String.Format("Total duration of the day woudl be {0}", sc.daylength)); Debug.WriteLine(String.Format("Solar noon would be at {0}", sc.noon)); Debug.WriteLine(String.Format("Julian day would be {0}", sc.julian)); Debug.WriteLine(String.Format("Solar declination would be {0}", sc.declination)); Debug.WriteLine(""); Debug.WriteLine(""); Debug.WriteLine(String.Format("We are now outputting the vedic solar clock ")); sc = Solar.VedicShuddhi(new DateTime(2016, 4, 1).SolarClock(chandigarh[0], chandigarh[1], 5.5, false)); Debug.WriteLine(String.Format("Sunrise would be at {0}", sc.sunrise)); Debug.WriteLine(String.Format("Sunset would be at {0}", sc.sunset)); Debug.WriteLine(String.Format("Total duration of the day woudl be {0}", sc.daylength)); Debug.WriteLine(String.Format("Solar noon would be at {0}", sc.noon)); Debug.WriteLine(String.Format("Julian day would be {0}", sc.julian)); Debug.WriteLine(String.Format("Solar declination would be {0}", sc.declination)); }
public async Task <IHttpActionResult> VedicSolarEphemeris(double lat, double lng, double gmtoffset, int yr, int mn) { if (yr > 0 && mn <= 12 && mn > 0) { List <SolarClock> clocks = new List <SolarClock>(); //this is the output result DateTime startdt = new DateTime(yr, mn, 1, 0, 0, 0); //we start from the first day in the month requested for (int i = 0; i < DateTime.DaysInMonth(yr, mn); i++) { DateTime currDate = startdt.AddDays(i); clocks.Add(Solar.VedicShuddhi(currDate.SolarClock(lat, lng, gmtoffset, false))); } return(Ok <List <SolarClock> >(clocks)); } else { throw new ArgumentException(String.Format("The requested ephemeris is not in the correct time format")); } }