Go to the documentation of this file.
35 const double& duration,
36 const double& step_size) ;
41 int main(
int argc,
char** argv)
45 if (opts.ParseCommandLine(argc,argv))
return 0;
53 if (planet.
Name().empty())
return 0 ;
56 std::string method = opts.AsString(
"method");
57 std::transform(method.begin(), method.end(), method.begin(), ::tolower);
58 if (method ==
"sofa") {
60 }
else if (method ==
"jpl") {
64 "[ERROR] Invalid planet algorithm: " + method);
77 PrintEphemeris(coords, opts.AsDouble(
"duration"), opts.AsDouble(
"step")) ;
90 opts.AddProgramDescription(std::string() +
91 "Returns the apparent ICRS RA,Dec and observed Az,Alt coordinates for " +
92 "a given planet for a given observer. It is important also to note " +
93 "observed coordinates will be dubious very close to the horizon due " +
94 "to the atmospheric correction algorithms employed.");
97 opts.AddIntParam(
"p,planet",
98 "Planet number (1=Mercury, 2=Venus, 4=Mars, 5=Jupiter, 6=Saturn, 7=Uranus, 8=Neptune)",
105 opts.AddDoubleParam(
"startJD",
106 "Starting time as a Julian date. Default will be the current Julian date",
108 opts.AddDoubleParam(
"duration",
109 "Duration for printing out results (in minutes). Results will be printed from 'startJD' to 'startJD + duration'. Default is for one 24 hour period",
111 opts.AddDoubleParam(
"step",
112 "Number of minutes between each line of the print out.",
114 opts.AddStringParam(
"method",
115 "Method for computing planet positions ('sofa' or 'jpl', default='sofa')",
144 std::string msg = std::string() +
"[ERROR] Planet ID (" +
145 std::to_string(p_id) +
") is not valid!";
154 const double& duration,
155 const double& step_size)
159 CEPlanet* planet = dynamic_cast<CEPlanet*>( obs.
Body() );
164 std::vector<double> lon_dms =
CEAngle(observer->Longitude_Rad()).DmsVect();
165 std::vector<double> lat_dms =
CEAngle(observer->Latitude_Rad()).DmsVect();
168 std::printf(
"= OBSERVER ===================\n");
169 std::printf(
" Longitude: %+4dd %02dm %4.1fs\n",
int(lon_dms[0]),
int(lon_dms[1]), lon_dms[2]+lon_dms[3]);
170 std::printf(
" Latitude : %+3dd %02dm %4.1fs\n",
int(lat_dms[0]),
int(lat_dms[1]), lat_dms[2]+lat_dms[3]);
171 std::printf(
" Elevation: %f m \n", observer->Elevation_m());
172 std::printf(
" Pressure : %f hPa\n", observer->Pressure_hPa());
173 std::printf(
" Temp : %f Celsius\n", observer->Temperature_C());
174 std::printf(
" Humidity : %f %%\n", 100.0*observer->RelativeHumidity());
175 std::printf(
" Wavelen. : %f micrometers\n", observer->Wavelength_um());
176 std::printf(
" LocalTime: %02d:%02d:%04.1f\n",
int(localtime[0]),
int(localtime[1]), localtime[2]+localtime[3]);
177 std::printf(
" UTCOffset: %2d hrs\n\n",
int(observer->UTCOffset()));
180 std::printf(
"= PLANET =====================\n");
181 std::printf(
" Name : %s\n", planet->
Name().c_str());
182 std::printf(
" Mass : %e kg\n", planet->
Mass_kg());
183 std::printf(
" Radius: %f km\n", planet->
Radius_m()/1000.0);
184 std::printf(
" Albedo: %f\n\n", planet->
Albedo());
186 std::vector<double> ra;
187 std::vector<double> dec;
190 std::printf(
"= NOTES ======================\n");
191 std::printf(
" * RA,DEC represent apparent ICRS coordinates for the observer\n");
192 std::printf(
" * Coordinates should be considered dubious at small altitudes\n");
194 std::printf(
" JD LOCAL RA (appar.) DEC (appar.) Az Alt \n") ;
195 std::printf(
" =======================================================================\n") ;
196 int max_steps = int(duration/step_size);
199 for (
int s=0; s<=max_steps; s++) {
210 std::printf(
" %11.2f %08.1f %2.0fh %2.0fm %4.1fs %+3.0fd %2.0fm %4.1fs %8.3f %+7.3f\n",
211 double(*date), date->
GetTime(observer->UTCOffset()),
212 ra[0], ra[1], ra[2] + ra[3],
213 dec[0], dec[1], dec[2] + dec[3],
221 std::printf(
" -------------------------------------------------------------------\n");
void SetUTCOffset(const double &utc_offset)
Set the UTC offset for the observers time.
static CEPlanet Uranus()
Returns an object representing Uranus.
std::vector< double > DmsVect(void) const
Return vector of doubles representing the {degrees, arcmin, arcsec, arcsec-fraction}.
static CEPlanet Mercury()
Returns an object representing Mercury.
static CEPlanet Mars()
Returns an object representing Mars.
static CEPlanet Neptune()
Returns an object representing Neptune.
CEObserver * Observer()
Access the underlying objects.
CEExecOptions DefineOpts()
Forward declarations.
static std::vector< double > TimeDbl2Vect(const double &time)
Convert a time formatted as HHMMSS.SS into a vector.
virtual double GetTime(const double &utc_offset=0.0) const
Method for getting the current time.
CEObserver GenObserver(void)
Generate an observer object.
void SetAlgorithm(const CEPlanetAlgo &new_algo)
Set the desired planet computation algorithm.
Use methods included in sofa software.
void AddObserverPars(void)
Add parameters defining an observer and their atmospheric properties.
void PrintEphemeris(CEObservation &obs, const double &duration, const double &step_size)
Prints the results of the planet position query.
std::vector< double > HmsVect(void) const
Return vector of doubles representing the {hours, min, sec, sec-fraction}.
Use Keplerian algorithm outlined by JPL.
void SetCorrFiles(void)
Defines the corrections terms from user supplied options.
std::string Name(void) const
Get the name of this object.
static CEPlanet Venus()
Returns an object representing Venus.
CEBody * Body()
Access underlying CEBody object.
static CEPlanet Saturn()
Returns an object representing Saturn.
static double SystemUTCOffset_hrs()
virtual double GetAzimuth_Rad()
static double CurrentJD()
Static method for getting the current Julian date.
void CorrectionsInterp(bool set_interp)
Set the corrections object to use interpolation.
void AddCorrFilePars(void)
Add parameter for the corrections file path.
virtual void SetDate(const double &date=CurrentJD(), const CEDateType &time_format=CEDateType::JD)
Set the date based on an actual date and the desired time_format.
CEPlanet GetPlanet(const int &p_id)
Returns the planet requested by the user.
virtual double GetZenith_Rad()
virtual void SetCoordinates(const CEAngle &xcoord, const CEAngle &ycoord, const CESkyCoordType &coord_type=CESkyCoordType::ICRS) const
Set the coordinates of this object.
CEDate * Date()
Access underlying CEDate object.
virtual double JD() const
Get the Julian date represented by this object.
static CEPlanet Jupiter()
Returns an object representing Jupiter.
static CEAngle Deg(const double &angle)
Return angle (radians) constructed from a degree angle.
int main(int argc, char **argv)
Main method.
CESkyCoord ConvertToICRS(const CEDate &date=CEDate(), const CEObserver &observer=CEObserver())
Convert this coordinate to ICRS coordinates.
virtual CEAngle XCoord(const CEDate &jd=CppEphem::julian_date_J2000()) const
Return x coordinate at given Julian date.
Azimuth, Zenith (requires additional observer information)
virtual CEAngle YCoord(const CEDate &jd=CppEphem::julian_date_J2000()) const
Return y coordinate at given Julian date.