///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //----------------------------------------- COORDINATE_TRANSFORMATION --------------------------------------------- /* * This script does the following: * - Transform from horizontal to celestial coordinates * * * */ // returns the sidereal time at the designated longitude public static float LocalSiderealTime(float lng) { // get the current time DateTime now = DateTime.Now; //create time custom time object AASDate dateSunCalc = new AASDate(now.Year, now.Month, now.Day, now.Hour, now.Minute, now.Second, true); //get greenwich time double greenwich_sidereal_time = AASSidereal.MeanGreenwichSiderealTime(dateSunCalc.Julian); //adjust for longitude double adj_st = greenwich_sidereal_time + (lng * (24.0 / 360.0)); if (adj_st >= 24.0) { adj_st -= 24.0; } if (adj_st < 0) { adj_st += 24.0; } return((float)adj_st); }
public void MeanGreenwichSiderealTimeTest(int year, int month, int day, int hours, int minutes, int seconds, bool isGregorian, double expectedSideralTime) { var date = new AASDate(); date.Set(year, month, day, hours, minutes, seconds, isGregorian); double meanGreenwichSiderealTime = AASSidereal.MeanGreenwichSiderealTime(date.Julian); Assert.Equal(expectedSideralTime, meanGreenwichSiderealTime); }