CARMA C++
AstroTime.h
Go to the documentation of this file.
1 // $Id: AstroTime.h,v 1.21 2012/03/02 15:50:31 mpound Exp $
2 
12 #ifndef CARMA_SERVICES_ASTROTIME_H
13 #define CARMA_SERVICES_ASTROTIME_H
14 
15 #include "carma/util/Time.h"
18 #include <memory>
19 
20 namespace carma {
21 
22  namespace services {
23 
24  class Angle;
25  class HourAngle;
26  class Length;
27 
32  class AstroTime {
33  public:
37  AstroTime();
38 
45  AstroTime(Location location);
46 
48  virtual ~AstroTime();
49 
58  void setSite(Angle longitude, Angle latitude, Length altitude);
59  //__attribute__((deprecated));
60 
61 
69  void setSite(double longitude, double latitude, double altitude);
70 
76  void setSite(Location location);
77 
81  Location getSite() const;
82 
89  double localSiderealTime(double mjd = carma::util::Time::MJD());
90 
95  double meanSiderealTime(double mjd = carma::util::Time::MJD());
96 
103  std::string lstString(double mjd = carma::util::Time::MJD(),
104  int precision = 1);
105 
112  double eqnEqx(double mjd = carma::util::Time::MJD());
113 
120  double ut1Utc(double mjd = carma::util::Time::MJD());
121 
127  double xPolar(double mjd = carma::util::Time::MJD());
128 
134  double yPolar(double mjd = carma::util::Time::MJD());
135 
136 
145  double hourAngle(double mjd, double RA);
146 
154  HourAngle hourAngle(double mjd, Angle RA);
155 
156 
161  double iersTableAge();
162 
163  //====================================================
164  // STATIC METHODS - don't require Location
165  //====================================================
174  static double leap(const double mjd);
175 
186  static double elapsedJulCent( double mjd = carma::util::Time::MJD() );
187 
194  static double julianDay( double mjd = carma::util::Time::MJD() );
195 
200  static double modulo24(double hours);
201 
206  static const double JULIAN_DAY_ZERO ;
207 
211  static const double JULIAN_CENTURY ;
212 
216  static const double SECONDS_PER_DAY;
217 
218  // Yes, I realize Time.h already has this, but
219  // I want the full PER_DAY set in one place.
220  // These could in principal be replaced by
221  // calls to Units.convert(), which knows
222  // about sidereal vs. solar, etc. Must check
223  // the accuracy of its GnuUnits though.
224 
228  static const double MINUTES_PER_DAY;
229 
233  static const double HOURS_PER_DAY;
234 
238  static const double HOURS_PER_SIDEREAL_DAY;
239 
243  static const double SOLAR_DAY;
244 
248  static const double SIDEREAL_DAY;
249 
253  static const double SECONDS_PER_HOUR;
254 
258  static const double MINUTES_PER_HOUR ;
259 
263  static const double HOURS_PER_RADIAN;
264 
265  private:
266  Location siteLocation_; // Location holding site information
267  // Can't use auto_ptr because copy
268  // construction releases ownership of
269  // the contents. Perhaps auto_ptr_ref
270  // would work in this case, but I don't
271  // really understand its usage.
272  //std::auto_ptr<IERSTable> iers_;
273  IERSTable iers_;
274 
275  void checkIERSandLoadIfNecessary(void); // helper function to load new IERS table
276  void loadIERS(void); // Re-read IERS Table from disk
277  double lastIERSLoadTime_; // MJD when the IERS table was last read from disk.
278  };
279  }
280 }
281 
282 #endif //CARMA_SERVICES_ASTROTIME_H
double ut1Utc(double mjd=carma::util::Time::MJD())
class to access (processed) IERS tables The IERSTable class reads a (processed by mk-iers...
Definition: IERSTable.h:39
double meanSiderealTime(double mjd=carma::util::Time::MJD())
Common time functions.
static const double HOURS_PER_SIDEREAL_DAY
The number of solar hours per sidereal day.
Definition: AstroTime.h:238
static const double HOURS_PER_DAY
The number of solar hours per solar day.
Definition: AstroTime.h:233
static double elapsedJulCent(double mjd=carma::util::Time::MJD())
Computes the time in Julian Centuries (36525 days of universal time) elapsed since 2000 January 1 12 ...
AstroTime()
No-arg Constructor.
static const double SECONDS_PER_DAY
The number of seconds per solar day.
Definition: AstroTime.h:216
static double leap(const double mjd)
retrieve the number of leap seconds to be added to UTC to get TIA
double eqnEqx(double mjd=carma::util::Time::MJD())
Location getSite() const
This class implements various astronomical time computation routines.
Definition: AstroTime.h:32
static const double SOLAR_DAY
The length of a solar day in sidereal days.
Definition: AstroTime.h:243
static const double MINUTES_PER_DAY
The number of minutes per solar day.
Definition: AstroTime.h:228
static const double SIDEREAL_DAY
The length of a sidereal day in solar days.
Definition: AstroTime.h:248
std::string lstString(double mjd=carma::util::Time::MJD(), int precision=1)
double xPolar(double mjd=carma::util::Time::MJD())
static double modulo24(double hours)
static const double JULIAN_CENTURY
Value of one Julian Century, in days.
Definition: AstroTime.h:211
double localSiderealTime(double mjd=carma::util::Time::MJD())
Location specifies a location (observatory if you wish) on planet earth, as longitude, latitude, and altitude above sea-level.
Definition: Location.h:32
The Angle class can represent any angle in any units.
Definition: Angle.h:38
Access to an IERS table.
virtual ~AstroTime()
Destructor.
double yPolar(double mjd=carma::util::Time::MJD())
static const double MINUTES_PER_HOUR
Number of minutes in one hour.
Definition: AstroTime.h:258
static const double HOURS_PER_RADIAN
Number of solar hours per radian, i.e.
Definition: AstroTime.h:263
void setSite(Angle longitude, Angle latitude, Length altitude)
Set the location for calculating the time functions using Conformable Quantities. ...
double hourAngle(double mjd, double RA)
Compute the hour angle for a given RA and time, at the location set in setSite()
static const double SECONDS_PER_HOUR
Number of seconds in one hour.
Definition: AstroTime.h:253
The Length class can represent a length in any units.
Definition: Length.h:36
static const double JULIAN_DAY_ZERO
Difference between Julian Day and Modified Julian Day.
Definition: AstroTime.h:206
static double julianDay(double mjd=carma::util::Time::MJD())
Returns the Julian Day given the Modified Julian Day.
static double MJD()
Get current MJD.
The HourAngle class extends carma::services::Angle to specifically support hour angles.
Definition: HourAngle.h:36