Go to the documentation of this file.
42 opts.AddProgramDescription(std::string() +
43 "Converts a user supplied set of coordinates to another coordinate system. " +
44 "Additional parameters can be supplied to provide more accurate results.");
49 opts.AddGalacticPar();
50 opts.AddEclipticPar();
51 opts.AddObservedPar();
52 opts.AddObserverPars();
54 opts.AddStringParam(
"to",
"Coordinate system to convert into (\"CIRS\", \"ICRS\", \"Galactic\", \"Observed\", \"Ecliptic\")",
"");
57 opts.AddCorrFilePars();
76 if (opts.AsString(
"delim").size() == 1) {
77 delim = opts.AsString(
"delim")[0];
83 if (opts.AsString(
"cirs").size() > 0) {
89 }
else if (opts.AsString(
"icrs").size() > 0) {
95 }
else if (opts.AsString(
"galactic").size() > 0) {
98 }
else if (opts.AsString(
"observed").size() > 0) {
101 }
else if (opts.AsString(
"ecliptic").size() > 0) {
102 parname =
"ecliptic";
110 ycoord.
SetAngle(angles[1].c_str(), angle_type_y, delim);
111 xcoord.SetAngle(angles[0].c_str(), angle_type_x, delim);
113 return CESkyCoord(xcoord, ycoord, coord_type);
121 std::string user_type = opts.AsString(
"to");
122 if (user_type.size() == 0) {
123 throw std::invalid_argument(
"Must supply coordinate system to convert to (specify the \"to\" parameter)");
125 std::for_each(user_type.begin(), user_type.end(), [](
char &
c) {
131 if (user_type ==
"cirs") {
133 }
else if (user_type ==
"icrs") {
135 }
else if (user_type ==
"galactic") {
137 }
else if (user_type ==
"observed") {
139 }
else if (user_type ==
"ecliptic") {
154 std::map<CESkyCoordType, std::vector<std::string>> types;
161 std::vector<std::string> outnames = types[outcoord.
GetCoordSystem()];
162 std::vector<std::string> innames = types[incoord.
GetCoordSystem()];
166 std::printf(
"******************************************\n");
167 std::printf(
" Results of %s -> %s conversion\n",
168 innames[0].c_str(), outnames[0].c_str());
169 std::printf(
"******************************************\n");
170 std::printf(
"%s Coordinates (output)\n", outnames[0].c_str());
171 std::printf(
" %-15s: %f degrees\n", outnames[1].c_str(), outcoord.
XCoord().
Deg());
172 std::printf(
" %-15s: %+f degrees\n", outnames[2].c_str(), outcoord.
YCoord().
Deg());
173 if (outnames[2] ==
"Zenith") {
174 std::printf(
" %-15s: %+f degrees\n",
"Altitude", 90.0-outcoord.
YCoord().
Deg());
176 std::printf(
"%s Coordinates (input)\n", innames[0].c_str());
177 std::printf(
" %-15s: %f degrees\n", innames[1].c_str(), incoord.
XCoord().
Deg());
178 std::printf(
" %-15s: %+f degrees\n", innames[2].c_str(), incoord.
YCoord().
Deg());
179 std::printf(
"Julian Date : %f\n", date.
JD());
182 std::printf(
"Observer Info\n");
184 std::printf(
" Latitude : %+f deg\n", obs.
Latitude_Deg());
185 std::printf(
" Elevation : %f meters\n", obs.
Elevation_m());
186 std::printf(
" Pressure : %f hPa\n", obs.
Pressure_hPa());
187 std::printf(
" Temperature : %f Celsius\n", obs.
Temperature_C());
195 int main(
int argc,
char** argv) {
199 if (opts.ParseCommandLine(argc, argv))
return 0;
double Elevation_m() const
Return altitude in meters above sea level.
RA, Dec (referenced at the barycenter of the solarsystem)
CESkyCoordType
The following enum specifies what coordinates this object represents.
RA, Dec (referenced at the center of the Earth)
double Temperature_C() const
Return temperature in degrees Celsius.
double c()
speed of light (meters/second)
CEObserver GenObserver(void)
Generate an observer object.
double RelativeHumidity() const
Return relative humidity.
Galacitc longitude, latitude.
void SetAngle(const double &angle, const CEAngleType &angle_type=CEAngleType::RADIANS)
Set the angle from a double.
double Pressure_hPa() const
Return atmospheric pressure in units of hPa.
CESkyCoordType GetCoordSystem(void) const
Return coordinate system.
void SetCorrFiles(void)
Defines the corrections terms from user supplied options.
double Latitude_Deg() const
Return geographic latitude in degrees.
CESkyCoordType GetOutType(CEExecOptions &opts)
CESkyCoord GetInCoord(CEExecOptions &opts)
Get the user supplied coordinates.
int main(int argc, char **argv)
void CorrectionsInterp(bool set_interp)
Set the corrections object to use interpolation.
CEExecOptions DefineOpts()
Define the command line options for this program.
double Longitude_Deg() const
Return observer geographic longitude in degrees.
void PrintCoordConvResults(const CESkyCoord &outcoord, const CESkyCoord &incoord, const CEDate &date, const CEObserver &obs)
virtual double JD() const
Get the Julian date represented by this object.
void split(const std::string &s, const char &delim, std::vector< std::string > *elems)
Method for splitting a string based on some delimiter into a vector of strings.
Ecliptic longitude, latitude.
static CEAngle Deg(const double &angle)
Return angle (radians) constructed from a degree angle.
CESkyCoord ConvertTo(const CESkyCoordType &output_coord_type, const CEDate &date=CEDate(), const CEObserver &observer=CEObserver())
Convert these coordinates to another coordinate system NOTE: If this object is not OBSERVED coordinat...
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.