FACT++  1.0
int main ( int  argc,
const char *  argv[] 
)

Definition at line 152 of file moon.cc.

References Moon::Angle(), Moon::dec, Moon::disk, Configuration::DoParse(), Configuration::Get(), Time::GetAsStr(), Configuration::Has(), Time::JD(), Time::Mjd(), period, PrintUsage(), Moon::ra, Time::SetFromStr(), Configuration::SetPrintUsage(), SetupConfiguration(), time, Moon::visible, and Moon::zd.

153 {
154  Configuration conf(argv[0]);
155  conf.SetPrintUsage(PrintUsage);
156  SetupConfiguration(conf);
157 
158  if (!conf.DoParse(argc, argv))
159  return 127;
160 
161  if (conf.Has("ra")^conf.Has("dec"))
162  {
163  cout << "ERROR - Either --ra or --dec missing." << endl;
164  return 1;
165  }
166 
167  Time time;
168  time.SetFromStr(conf.Get<string>("date-time"));
169 
170  ln_lnlat_posn observer;
171  observer.lng = -(17.+53./60+26.525/3600);
172  observer.lat = 28.+45./60+42.462/3600;
173 
174  Moon moon(observer.lng, observer.lat, time);
175 
176  cout << setprecision(15);
177  cout << time.GetAsStr() << '\n';
178 
179  ln_equ_posn pos;
180  ln_hrz_posn hrz;
181  ln_get_solar_equ_coords(time.JD(), &pos);
182  ln_get_hrz_from_equ(&pos, &observer, time.JD(), &hrz);
183  cout << 90-hrz.alt << '\n';
184 
185  const double kSynMonth = 29.53058868; // synodic month (new Moon to new Moon)
186  const double kEpoch0 = 44240.37917; // First full moon after 1980/1/1
187  const double kInstall = 393; // Moon period if FACT installation
188  const uint32_t period = floor(((time.Mjd()-kEpoch0)/kSynMonth-kInstall));
189 
190  cout << period << '\n';
191  cout << moon.visible << '\n';
192  cout << moon.disk << '\n';
193  cout << moon.zd << '\n';
194 
195  if (conf.Has("ra") && conf.Has("dec"))
196  {
197  pos.ra = conf.Get<double>("ra")*15;
198  pos.dec = conf.Get<double>("dec");
199 
200  cout << moon.Angle(pos.ra/15, pos.dec) << '\n';
201 
202  // Trick 17
203  moon.ra = pos.ra;
204  moon.dec = pos.dec;
205 
206  // Sun distance
207  cout << moon.Angle(pos.ra/15, pos.dec) << '\n';
208  }
209 
210  cout << endl;
211 
212  return 0;
213 }
void PrintUsage()
Definition: moon.cc:143
float period
Definition: HeadersSQM.h:92
void SetupConfiguration(Configuration &conf)
Definition: moon.cc:123
Adds some functionality to boost::posix_time::ptime for our needs.
Definition: Time.h:30
Definition: moon.cc:13
double JD() const
Definition: Time.h:87
void Mjd(double mjd)
Definition: Time.cc:145
Warning because the service this data corrsponds to might have been last updated longer ago than Local time
Definition: smartfact.txt:92
Commandline parsing, resource file parsing and database access.
Definition: Configuration.h:9
void SetFromStr(const std::string &str, const char *fmt="%Y-%m-%d %H:%M:%S")
Definition: Time.cc:273
std::string GetAsStr(const char *fmt="%Y-%m-%d %H:%M:%S") const
Definition: Time.cc:240

+ Here is the call graph for this function: