17 po::options_description control(
"Smart FACT");
19 (
"source-name", var<string>(),
"Source name")
20 (
"date-time", var<string>(),
"SQL time (UTC)")
21 (
"source-database", var<string>(
""),
"Database link as in\n\tuser:password@server[:port]/database.")
22 (
"max-current", var<double>(75),
"Maximum current to display in other plots.")
23 (
"max-zd", var<double>(75),
"Maximum zenith distance to display in other plots")
24 (
"no-limits",
po_switch(),
"Switch off limits in plots")
27 po::positional_options_description p;
28 p.add(
"source-name", 1);
29 p.add(
"date-time", 2);
38 "makedata - The astronomy data listing\n" 49 "Usage: makedata sql-datetime [--ra={ra} --dec={dec}]\n";
53 int main(
int argc,
const char* argv[])
71 if (conf.
Has(
"date-time"))
74 const double max_current = conf.
Get<
double>(
"max-current");
75 const double max_zd = conf.
Get<
double>(
"max-zd");
76 const double no_limits = conf.
Get<
bool>(
"no-limits");
82 const double jd = floor(time.
Mjd())+2400001;
83 const double mjd = floor(time.
Mjd())+49718+0.5;
86 const double jd0 = fmod(sun_set.set, 1);
87 const double jd1 = fmod(sun_rise.rise, 1);
89 cout <<
Time::iso << time <<
", " << mjd-49718 <<
", ";
93 if (!conf.
Has(
"source-name"))
96 const string source_name = conf.
Get<
string>(
"source-name");
97 const string fDatabase = conf.
Get<
string>(
"source-database");
101 const mysqlpp::StoreQueryResult res =
102 Database(fDatabase).query(
"SELECT fRightAscension, fDeclination FROM Source WHERE fSourceName='"+source_name+
"'").store();
106 vector<mysqlpp::Row>::const_iterator row=res.begin();
111 pos.ra = double((*row)[0])*15;
112 pos.dec = double((*row)[1]);
115 for (
int i=0;
i<24*12;
i++)
117 const double h = double(
i)/(24*12);
132 const double ratio = pow(cos((90-hrz.alt)*M_PI/180), -2.664);
138 t += boost::posix_time::minutes(
i*5);
140 cout << t <<
", " << h <<
", ";
142 if (no_limits || cur<max_current)
146 if (no_limits || 90-hrz.alt<max_zd)
150 if (no_limits || (cur<max_current && 90-hrz.alt<max_zd))
151 cout << ratio*cur/6.2;
154 if (no_limits || (cur<max_current && 90-hrz.alt<max_zd))
Adds some functionality to boost::posix_time::ptime for our needs.
void SetPrintUsage(const std::function< void(void)> &func)
T Get(const std::string &var)
void SetupConfiguration(Configuration &conf)
static const _time_format iso
set to format to the sql format (without the fraction of seconds)
po::typed_value< bool > * po_switch()
void SetArgumentPositions(const po::positional_options_description &desc)
bool Has(const std::string &var)
int main(int argc, const char *argv[])
void AddOptions(const po::options_description &opt, bool visible=true)
Warning because the service this data corrsponds to might have been last updated longer ago than Local time
Commandline parsing, resource file parsing and database access.
void SetFromStr(const std::string &str, const char *fmt="%Y-%m-%d %H:%M:%S")
RstTime GetSolarRst(double jd, const LnLatPosn &obs, double hrz=LN_SOLAR_STANDART_HORIZON)
HrzPosn GetHrzFromEqu(const EquPosn &equ, const LnLatPosn &obs, double jd)
double GetAngularSeparation(const EquPosn &p1, const EquPosn &p2)
bool DoParse(int argc, const char **argv, const std::function< void()> &func=std::function< void()>())
double PredictI(const Nova::SolarObjects &so, const Nova::EquPosn &srcEqu)