CppEphem
CECoordinates.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  * CECoordinates.cpp: CppEphem *
3  * ----------------------------------------------------------------------- *
4  * Copyright © 2016-2019 JCardenzana *
5  * ----------------------------------------------------------------------- *
6  * *
7  * This program is free software: you can redistribute it and/or modify *
8  * it under the terms of the GNU General Public License as published by *
9  * the Free Software Foundation, either version 3 of the License, or *
10  * (at your option) any later version. *
11  * *
12  * This program is distributed in the hope that it will be useful, *
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15  * GNU General Public License for more details. *
16  * *
17  * You should have received a copy of the GNU General Public License *
18  * along with this program. If not, see <http://www.gnu.org/licenses/>. *
19  * *
20  ***************************************************************************/
21 
33 #include "CECoordinates.h"
34 #include "CEObserver.h"
35 
36 /**********************************************************************/
40 {
41  init_members();
42 }
43 
44 
45 /**********************************************************************/
54  const CEAngle& ycoord,
55  const CECoordinateType& coord_type)
56 {
57  init_members();
58  CECoordinates::SetCoordinates(xcoord, ycoord, coord_type);
59 }
60 
61 
62 /**********************************************************************/
70 CECoordinates::CECoordinates(const std::vector<double>& xcoord,
71  const std::vector<double>& ycoord,
72  const CECoordinateType& coord_type)
73 {
74  init_members();
75  CEAngle x;
76  if ((coord_type == CECoordinateType::GALACTIC) ||
77  (coord_type == CECoordinateType::OBSERVED)) {
78  x = CEAngle::Dms(xcoord);
79  } else {
80  x = CEAngle::Hms(xcoord);
81  }
82  CEAngle y = CEAngle::Dms(ycoord);
83  CECoordinates::SetCoordinates(x, y, coord_type);
84 }
85 
86 
87 /**********************************************************************/
93 {
94  init_members();
95  coord_type_ = coord_type;
96 }
97 
98 /**********************************************************************/
104 {
105  free_members();
106  init_members();
107  copy_members(other);
108 }
109 
110 /**********************************************************************/
114 {}
115 
116 
117 /**********************************************************************/
124 {
125  if (this != &other) {
126  free_members();
127  init_members();
128  copy_members(other);
129  }
130  return *this;
131 }
132 
133 
134 /**********************************************************************/
145 void CECoordinates::CIRS2ICRS(double input_ra, double input_dec,
146  double *return_ra, double *return_dec,
147  const CEDate& date, const CEAngleType& angle_type)
148 {
149  // Convert to radians if that's what is passed
150  if (angle_type==CEAngleType::DEGREES) {
151  input_ra *= DD2R ;
152  input_dec *= DD2R ;
153  }
154 
155  // Use the sofa library to convert these coordinates
156  double eo ; // Equation of the origins
157  double tdb1(0.0);
158  double tdb2(0.0);
159  CEDate::UTC2TDB(date.MJD(), &tdb1, &tdb2);
160  iauAtic13(input_ra, input_dec, tdb1, tdb2, return_ra, return_dec, &eo) ;
161 
162  // Subtract the eo from RA if J2000 coordinates are desired
163  //*return_ra -= eo ;
164 
165  // Return the coordinates in the requested units
166  if (angle_type == CEAngleType::DEGREES) {
167  *return_ra *= DR2D ;
168  *return_dec *= DR2D ;
169  }
170 }
171 
172 /**********************************************************************/
182 void CECoordinates::CIRS2Galactic(double input_ra, double input_dec, double *glon, double *glat,
183  const CEDate& date, const CEAngleType& angle_type)
184 {
185  // Convert to radians if that's what is passed
186  if (angle_type==CEAngleType::DEGREES) {
187  input_ra *= DD2R ;
188  input_dec *= DD2R ;
189  }
190 
191  // In order to do this with the sofa package, we must first
192  // convert from CIRS -> ICRS
193  double ICRS_ra(0.0), ICRS_dec(0.0) ;
194  CIRS2ICRS(input_ra, input_dec, &ICRS_ra, &ICRS_dec, date, CEAngleType::RADIANS);
195 
196  // Now we can convert to galactic
197  ICRS2Galactic(ICRS_ra, ICRS_dec, glon, glat, CEAngleType::RADIANS) ;
198 
199  // Convert to the desired units
200  if (angle_type == CEAngleType::DEGREES) {
201  *glon *= DR2D ;
202  *glat *= DR2D ;
203  }
204 }
205 
206 /**********************************************************************/
225 int CECoordinates::CIRS2Observed(double ra, double dec,
226  double *az, double *zen,
227  const CEDate& date,
228  const CEObserver& observer,
229  const CEAngleType& angle_type,
230  double wavelength,
231  double *observed_ra,
232  double *observed_dec,
233  double *hour_angle)
234 {
235  // If we've passed in angles that are in degrees we need to convert to radians
236  if (angle_type == CEAngleType::DEGREES) {
237  ra *= DD2R ;
238  dec *= DD2R ;
239  }
240 
241  // Setup the observed RA, Dec and hour_angle variables
242  double temp_ra, temp_dec, temp_hour_angle ;
243  // If values were passed, point these variables at the passed ones
244  if (observed_ra == nullptr) observed_ra = &temp_ra;
245  if (observed_dec == nullptr) observed_dec = &temp_dec;
246  if (hour_angle == nullptr) hour_angle = &temp_hour_angle;
247 
248  int err_code = CIRS2Observed(ra, dec,
249  az, zen,
250  date.JD(),
251  observer.Longitude_Rad(),
252  observer.Latitude_Rad(),
253  observer.Elevation_m(),
254  observer.Pressure_hPa(),
255  observer.Temperature_C(),
256  observer.RelativeHumidity(),
257  date.dut1(),
258  date.xpolar(),
259  date.ypolar(),
260  wavelength,
261  observed_ra,
262  observed_dec,
263  hour_angle) ;
264 
265  // Now convert back to degrees if that's what we were passed
266  if (angle_type == CEAngleType::DEGREES) {
267  *az *= DR2D;
268  *zen *= DR2D;
269  *observed_ra *= DR2D;
270  *observed_dec *= DR2D;
271  *hour_angle *= DR2D;
272  }
273 
274  return err_code ;
275 }
276 
277 /**********************************************************************/
288 void CECoordinates::ICRS2CIRS(double input_ra, double input_dec,
289  double *return_ra, double *return_dec,
290  const CEDate& date, const CEAngleType& angle_type)
291 {
292  // Convert to radians if necessary
293  if (angle_type==CEAngleType::DEGREES) {
294  input_ra *= DD2R ;
295  input_dec *= DD2R ;
296  }
297 
298  // Store the equation of the origins
299  double eo ; // Equation of the origins
300 
301  // Use the sofa library to convert these coordinates
302  try {
303  double tdb1(0.0);
304  double tdb2(0.0);
305  CEDate::UTC2TDB(date.MJD(), &tdb1, &tdb2);
306  iauAtci13(input_ra, input_dec,
307  0.0, 0.0, 0.0, 0.0,
308  tdb1, tdb2,
309  return_ra, return_dec, &eo) ;
310 
311  // Subtract the equation of the origins if J2000 coordinates are desired
312  //*return_ra -= eo ;
313  } catch (std::exception &e) {
314  throw CEException::sofa_exception("CECoordinates::ICRS2CIRS",
315  "iauAtci13",
316  "Exception thrown");
317  }
318 
319  // Convert the returned coordinates to the correct angle type
320  if (angle_type == CEAngleType::DEGREES) {
321  *return_ra *= DR2D ;
322  *return_dec *= DR2D ;
323  }
324 
325  return ;
326 }
327 
328 /**********************************************************************/
337 void CECoordinates::ICRS2Galactic(double input_ra, double input_dec,
338  double *glon, double *glat,
339  const CEAngleType& angle_type)
340 {
341  // Convert to radians if necessary
342  if (angle_type == CEAngleType::DEGREES) {
343  input_ra *= DD2R ;
344  input_dec *= DD2R ;
345  }
346 
347  // Use the sofa method to convert the coordinates
348  iauIcrs2g(input_ra, input_dec, glon, glat) ;
349 
350  // Convert back to degrees if necessary
351  if (angle_type == CEAngleType::DEGREES) {
352  *glon *= DR2D ;
353  *glat *= DR2D ;
354  }
355 }
356 
357 /**********************************************************************/
374 int CECoordinates::ICRS2Observed(double ra, double dec,
375  double *az, double *zen,
376  const CEDate& date,
377  const CEObserver& observer,
378  const CEAngleType& angle_type,
379  double wavelength,
380  double *observed_ra,
381  double *observed_dec,
382  double *hour_angle)
383 {
384  // Setup the observed RA, Dec and hour_angle variables
385  double temp_ra(0.0);
386  double temp_dec(0.0);
387  double temp_hour_angle(0.0);
388 
389  // If values were not passed, point them at the temporary ones
390  if (observed_ra == nullptr) observed_ra = &temp_ra;
391  if (observed_dec == nullptr) observed_dec = &temp_dec;
392  if (hour_angle == nullptr) hour_angle = &temp_hour_angle;
393 
394  // If we've passed in angles that are in degrees we need to convert to radians
395  if (angle_type == CEAngleType::DEGREES) {
396  ra *= DD2R ;
397  dec *= DD2R ;
398  }
399 
400  // Call the necessary sofa method
401  int err_code = ICRS2Observed(ra, dec,
402  az, zen,
403  date.JD(),
404  observer.Longitude_Rad(),
405  observer.Latitude_Rad(),
406  observer.Elevation_m(),
407  observer.Pressure_hPa(),
408  observer.Temperature_C(),
409  observer.RelativeHumidity(),
410  date.dut1(),
411  date.xpolar(),
412  date.ypolar(),
413  wavelength,
414  observed_ra, observed_dec, hour_angle) ;
415 
416  // Now convert back to degrees if that's what we were passed
417  if (angle_type == CEAngleType::DEGREES) {
418  *az *= DR2D ;
419  *zen *= DR2D ;
420  *observed_ra *= DR2D ;
421  *observed_dec *= DR2D ;
422  *hour_angle *= DR2D ;
423  }
424 
425  return err_code ;
426 }
427 
428 
429 /*********************************************************
430  * Convert GALACTIC Coordinates
431  *********************************************************/
432 
433 /**********************************************************************/
443 void CECoordinates::Galactic2CIRS(double glon, double glat, double *ra, double *dec,
444  const CEDate& date, const CEAngleType& angle_type)
445 {
446  // Check for degrees
447  if (angle_type == CEAngleType::DEGREES) {
448  glon *= DD2R ;
449  glat *= DD2R ;
450  }
451 
452  // Do the Galactic -> ICRS converstion
453  Galactic2ICRS(glon, glat, ra, dec, CEAngleType::RADIANS) ;
454 
455  // Now convert ICRS -> CIRS
456  double tmp_ra(*ra);
457  double tmp_dec(*dec);
458  ICRS2CIRS(tmp_ra, tmp_dec, ra, dec, date, CEAngleType::RADIANS) ;
459 
460  // Now make sure to return the coordinates in the correct format
461  if (angle_type == CEAngleType::DEGREES) {
462  *ra *= DR2D ;
463  *dec *= DR2D ;
464  }
465 }
466 
467 /**********************************************************************/
476 void CECoordinates::Galactic2ICRS(double glon, double glat,
477  double *ra, double *dec,
478  const CEAngleType& angle_type)
479 {
480  // Check for degrees
481  if (angle_type == CEAngleType::DEGREES) {
482  glon *= DD2R ;
483  glat *= DD2R ;
484  }
485 
486  // Do the Galactic -> ICRS converstion
487  iauG2icrs(glon, glat, ra, dec) ;
488 
489  // Now make sure to return the coordinates in the correct format
490  if (angle_type == CEAngleType::DEGREES) {
491  *ra *= DR2D ;
492  *dec *= DR2D ;
493  }
494 }
495 
496 /**********************************************************************/
510 int CECoordinates::Galactic2Observed(double glon, double glat,
511  double *az, double *zen,
512  const CEDate& date,
513  const CEObserver& observer,
514  const CEAngleType& angle_type,
515  double wavelength,
516  double *observed_glon,
517  double *observed_glat,
518  double *hour_angle)
519 {
520  // Convert angles to radians if necessary
521  if (angle_type == CEAngleType::DEGREES) {
522  glon *= DD2R ;
523  glat *= DD2R ;
524  }
525 
526  // Do the conversion
527  int error_code = Galactic2Observed(glon, glat,
528  az, zen,
529  date.JD(),
530  observer.Longitude_Rad(),
531  observer.Latitude_Rad(),
532  observer.Elevation_m(),
533  observer.Pressure_hPa(),
534  observer.Temperature_C(),
535  observer.RelativeHumidity(),
536  date.dut1(),
537  date.xpolar(),
538  date.ypolar(),
539  wavelength,
540  observed_glon, observed_glat, hour_angle) ;
541 
542  // Convert back to degrees if necessary
543  if (angle_type == CEAngleType::DEGREES) {
544  *az *= DR2D ;
545  *zen *= DR2D ;
546  if (observed_glon != nullptr) *observed_glon *= DR2D ;
547  if (observed_glat != nullptr) *observed_glat *= DR2D ;
548  if (hour_angle != nullptr) *hour_angle *= DR2D ;
549  }
550 
551  return error_code;
552 }
553 
554 /*********************************************************
555  * Convert OBSERVED Coordinates
556  *********************************************************/
557 
558 
559 /**********************************************************************/
569 int CECoordinates::Observed2CIRS(double az, double zen,
570  double *ra, double *dec,
571  const CEDate& date,
572  const CEObserver& observer,
573  const CEAngleType& angle_type)
574 {
575  // Convert to radians if necessary
576  if (angle_type == CEAngleType::DEGREES) {
577  az *= DD2R ;
578  zen *= DD2R ;
579  }
580 
581  // Call the raw method
582  int err_code = Observed2CIRS(az, zen, ra, dec, date.JD(),
583  observer.Longitude_Rad(), observer.Latitude_Rad(),
584  observer.Elevation_m(),
585  observer.Pressure_hPa(), observer.Temperature_C(),
586  observer.RelativeHumidity(),
587  date.dut1(),
588  date.xpolar(),
589  date.ypolar(),
590  observer.Wavelength_um()) ;
591 
592  // Convert back to degrees if necessary
593  if (angle_type == CEAngleType::DEGREES) {
594  *ra *= DR2D ;
595  *dec *= DR2D ;
596  }
597 
598  return err_code ;
599 }
600 
601 /**********************************************************************/
611 int CECoordinates::Observed2ICRS(double az, double zen,
612  double *ra, double *dec,
613  const CEDate& date,
614  const CEObserver& observer,
615  const CEAngleType& angle_type)
616 {
617  // Convert to radians if necessary
618  if (angle_type == CEAngleType::DEGREES) {
619  az *= DD2R ;
620  zen *= DD2R ;
621  }
622 
623  // Call the raw method
624  int err_code = Observed2ICRS(az, zen, ra, dec,
625  date.JD(),
626  observer.Longitude_Rad(),
627  observer.Latitude_Rad(),
628  observer.Elevation_m(),
629  observer.Pressure_hPa(),
630  observer.Temperature_C(),
631  observer.RelativeHumidity(),
632  date.dut1(),
633  date.xpolar(),
634  date.ypolar(),
635  observer.Wavelength_um()) ;
636 
637  // Convert back to degrees if necessary
638  if (angle_type == CEAngleType::DEGREES) {
639  *ra *= DR2D ;
640  *dec *= DR2D ;
641  }
642 
643  return err_code ;
644 }
645 
646 /**********************************************************************/
656 int CECoordinates::Observed2Galactic(double az, double zen,
657  double *glon, double *glat,
658  const CEDate& date,
659  const CEObserver& observer,
660  const CEAngleType& angle_type)
661 {
662  // Convert to radians if necessary
663  if (angle_type == CEAngleType::DEGREES) {
664  az *= DD2R ;
665  zen *= DD2R ;
666  }
667 
668  // Call the raw method
669  int err_code = Observed2Galactic(az, zen, glon, glat, date.JD(),
670  observer.Longitude_Rad(), observer.Latitude_Rad(),
671  observer.Elevation_m(),
672  observer.Pressure_hPa(), observer.Temperature_C(),
673  observer.RelativeHumidity(),
674  date.dut1(),
675  date.xpolar(), date.ypolar(),
676  observer.Wavelength_um()) ;
677 
678  // Convert back to degrees if necessary
679  if (angle_type == CEAngleType::DEGREES) {
680  *glon *= DR2D ;
681  *glat *= DR2D ;
682  }
683 
684  return err_code ;
685 }
686 
687 
688 /*********************************************************
689  * Main routines for converting TO OBSERVED Coordinates
690  *********************************************************/
691 
692 /**********************************************************************/
716 int CECoordinates::CIRS2Observed(double ra, double dec,
717  double *az, double *zen,
718  double julian_date,
719  double longitude,
720  double latitude,
721  double elevation_m,
722  double pressure_hPa,
723  double temperature_celsius,
724  double relative_humidity,
725  double dut1,
726  double xp, double yp,
727  double wavelength_um,
728  double *observed_ra,
729  double *observed_dec,
730  double *hour_angle)
731 {
732  // Setup the observed RA, Dec and hour_angle variables
733  double temp_ra(0.0);
734  double temp_dec(0.0);
735  double temp_hour_angle(0.0);
736 
737  // If values were not passed, point them at the temporary ones
738  if (observed_ra == nullptr) observed_ra = &temp_ra;
739  if (observed_dec == nullptr) observed_dec = &temp_dec;
740  if (hour_angle == nullptr) hour_angle = &temp_hour_angle;
741 
742  // Call the necessary sofa method
743  int err_code = 0;
744  try {
745  CEDate date(julian_date, CEDateType::JD);
746  err_code = iauAtio13(ra, dec,
747  CEDate::GetMJD2JDFactor(), date.MJD(),
748  dut1,
749  longitude,
750  latitude,
751  elevation_m,
752  xp, yp,
753  pressure_hPa,
754  temperature_celsius,
755  relative_humidity,
756  wavelength_um,
757  az, zen,
758  hour_angle,
759  observed_dec,
760  observed_ra) ;
761  } catch (std::exception &e) {
762  throw CEException::sofa_exception("CECoordinates::CIRS2Observed",
763  "iauAtio13",
764  e.what());
765  }
766 
767  return err_code ;
768 }
769 
770 /**********************************************************************/
791 int CECoordinates::Observed2CIRS(double az, double zen,
792  double *ra, double *dec,
793  double julian_date,
794  double longitude,
795  double latitude,
796  double elevation_m,
797  double pressure_hPa,
798  double temperature_celsius,
799  double relative_humidity,
800  double dut1,
801  double xp, double yp,
802  double wavelength_um)
803 {
804  CEDate date(julian_date, CEDateType::JD);
805  int err_code = iauAtoi13("A", az, zen,
806  CEDate::GetMJD2JDFactor(), date.MJD(),
807  dut1,
808  longitude, latitude,
809  elevation_m,
810  xp, yp,
811  pressure_hPa,
812  temperature_celsius,
813  relative_humidity,
814  wavelength_um,
815  ra, dec) ;
816  return err_code ;
817 }
818 
819 /**********************************************************************/
842 int CECoordinates::ICRS2Observed(double ra, double dec,
843  double *az, double *zen,
844  double julian_date,
845  double longitude,
846  double latitude,
847  double elevation_m,
848  double pressure_hPa,
849  double temperature_celsius,
850  double relative_humidity,
851  double dut1,
852  double xp, double yp,
853  double wavelength_um,
854  double *observed_ra,
855  double *observed_dec,
856  double *hour_angle)
857 {
858  // Setup the observed RA, Dec and hour_angle variables
859  double temp_ra(0.0);
860  double temp_dec(0.0);
861  double temp_hour_angle(0.0);
862 
863  // If values were passed, point these variables at the passed ones
864  if (observed_ra == nullptr) observed_ra = &temp_ra;
865  if (observed_dec == nullptr) observed_dec = &temp_dec;
866  if (hour_angle == nullptr) hour_angle = &temp_hour_angle;
867 
868  // First convert the ICRS coordinates to CIRS coordinates
869  CEDate date(julian_date, CEDateType::JD) ;
870  ICRS2CIRS(ra, dec, &ra, &dec, date) ;
871 
872  // Call the necessary sofa method
873  int err_code = CIRS2Observed(ra, dec,
874  az, zen,
875  julian_date,
876  longitude,
877  latitude,
878  elevation_m,
879  pressure_hPa,
880  temperature_celsius,
881  relative_humidity,
882  dut1, xp, yp,
883  wavelength_um,
884  observed_ra,
885  observed_dec,
886  hour_angle) ;
887 
888  // Convert the apparent CIRS RA,Dec to ICRS RA,Dec
889  CIRS2ICRS(*observed_ra, *observed_dec, observed_ra, observed_dec,
890  date, CEAngleType::RADIANS) ;
891 
892  return err_code ;
893 }
894 
895 /**********************************************************************/
915 int CECoordinates::Observed2ICRS(double az, double zen,
916  double *ra, double *dec,
917  double julian_date,
918  double longitude,
919  double latitude,
920  double elevation_m,
921  double pressure_hPa,
922  double temperature_celsius,
923  double relative_humidity,
924  double dut1,
925  double xp, double yp,
926  double wavelength_um)
927 {
928  // Convert from Observed -> CIRS
929  int err_code = Observed2CIRS(az, zen,
930  ra, dec,
931  julian_date,
932  longitude, latitude,
933  elevation_m, pressure_hPa,
934  temperature_celsius, relative_humidity,
935  dut1, xp, yp, wavelength_um) ;
936  if (err_code == 0) {
937  // Convert from CIRS -> ICRS
938  CIRS2ICRS(*ra, *dec, ra, dec,
939  CEDate(julian_date,CEDateType::JD),
941  }
942 
943  return err_code ;
944 }
945 
946 /**********************************************************************/
969 int CECoordinates::Galactic2Observed(double glon, double glat,
970  double *az, double *zen,
971  double julian_date,
972  double longitude,
973  double latitude,
974  double elevation_m,
975  double pressure_hPa,
976  double temperature_celsius,
977  double relative_humidity,
978  double dut1,
979  double xp, double yp,
980  double wavelength,
981  double *observed_glon,
982  double *observed_glat,
983  double *hour_angle)
984 {
985  // Setup the observed RA, Dec and hour_angle variables
986  double temp_glon(0.0);
987  double temp_glat(0.0);
988  double temp_ra(0.0);
989  double temp_dec(0.0);
990  double temp_hour_angle(0.0);
991 
992  // If values were passed, point these variables at the passed ones
993  if (observed_glon == nullptr) observed_glon = &temp_glon;
994  if (observed_glat == nullptr) observed_glat = &temp_glat;
995  if (hour_angle == nullptr) hour_angle = &temp_hour_angle;
996 
997  // Convert GALACTIC to ICRS
998  double ra(0.0);
999  double dec(0.0);
1000  CEDate date(julian_date, CEDateType::JD) ;
1001  Galactic2CIRS(glon, glat, &ra, &dec, date) ;
1002 
1003  // Call the necessary sofa method
1004  int err_code = CIRS2Observed(ra, dec,
1005  az, zen,
1006  julian_date,
1007  longitude,
1008  latitude,
1009  elevation_m,
1010  pressure_hPa,
1011  temperature_celsius,
1012  relative_humidity,
1013  dut1, xp, yp,
1014  wavelength,
1015  &temp_ra,
1016  &temp_dec,
1017  &temp_hour_angle) ;
1018 
1019  // Convert the apparent RA,Dec to galactic longitude,latitude
1020  CIRS2Galactic(temp_ra, temp_dec, observed_glon, observed_glat, date) ;
1021 
1022  return err_code ;
1023 }
1024 
1025 /**********************************************************************/
1045 int CECoordinates::Observed2Galactic(double az, double zen,
1046  double *glon, double *glat,
1047  double julian_date,
1048  double longitude,
1049  double latitude,
1050  double elevation_m,
1051  double pressure_hPa,
1052  double temperature_celsius,
1053  double relative_humidity,
1054  double dut1,
1055  double xp, double yp,
1056  double wavelength_um)
1057 {
1058  // Convert from Observed -> ICRS
1059  int err_code = Observed2ICRS(az, zen,
1060  glon, glat,
1061  julian_date,
1062  longitude, latitude,
1063  elevation_m, pressure_hPa,
1064  temperature_celsius, relative_humidity,
1065  dut1, xp, yp, wavelength_um) ;
1066  if (err_code == 0) {
1067  // Convert from ICRS -> Galactic
1068  ICRS2Galactic(*glon, *glat, glon, glat,
1070  }
1071 
1072  return err_code ;
1073 }
1074 
1075 /**********************************************************************/
1091 CECoordinates CECoordinates::GetObservedCoords(const double& julian_date,
1092  const double& longitude,
1093  const double& latitude,
1094  const double& elevation_m,
1095  const double& pressure_hPa,
1096  const double& temperature_celsius,
1097  const double& relative_humidity,
1098  const double& dut1,
1099  const double& xp, const double& yp,
1100  const double& wavelength) const
1101 {
1102  // Preliminary variables
1103  double azimuth(0);
1104  double zenith(0);
1105  double observed1(0);
1106  double observed2(0);
1107  double observed3(0);
1108 
1110  // Convert CIRS to Observed
1111  CIRS2Observed(xcoord_, ycoord_, &azimuth, &zenith,
1112  julian_date, longitude, latitude,
1113  elevation_m, pressure_hPa, temperature_celsius,
1114  relative_humidity, dut1, xp, yp, wavelength,
1115  &observed1, &observed2, &observed3) ;
1116  } else if (coord_type_ == CECoordinateType::ICRS) {
1117  // Convert ICRS to Observed
1118  ICRS2Observed(xcoord_, ycoord_, &azimuth, &zenith,
1119  julian_date, longitude, latitude,
1120  elevation_m, pressure_hPa, temperature_celsius,
1121  relative_humidity, dut1, xp, yp, wavelength,
1122  &observed1, &observed2, &observed3) ;
1123  } else if (coord_type_ == CECoordinateType::GALACTIC) {
1124  // Convert Galactic to Observed
1125  Galactic2Observed(xcoord_, ycoord_, &azimuth, &zenith,
1126  julian_date, longitude, latitude,
1127  elevation_m, pressure_hPa, temperature_celsius,
1128  relative_humidity, dut1, xp, yp, wavelength,
1129  &observed1, &observed2, &observed3) ;
1130  } else if (coord_type_ == CECoordinateType::OBSERVED) {
1131  azimuth = xcoord_;
1132  zenith = ycoord_;
1133  }
1134 
1135  // Create the CECoordinates object to be returned
1136  return CECoordinates(azimuth, zenith, CECoordinateType::OBSERVED) ;
1137 }
1138 
1139 /**********************************************************************/
1148  const CEObserver& observer) const
1149 {
1150  return GetObservedCoords(date,
1151  observer.Longitude_Rad(),
1152  observer.Latitude_Rad(),
1153  observer.Elevation_m(),
1154  observer.Pressure_hPa(),
1155  observer.Temperature_C(),
1156  observer.RelativeHumidity(),
1157  date.dut1(),
1158  date.xpolar(),
1159  date.ypolar(),
1160  observer.Wavelength_um());
1161 }
1162 
1163 
1164 /**********************************************************************/
1174 {
1175  return AngularSeparation(*this, coords);
1176 }
1177 
1178 /**********************************************************************/
1194  const CECoordinates& coords2)
1195 {
1196  // Make sure the coordinates are in the same frame
1197  if (coords1.GetCoordSystem() != coords2.GetCoordSystem()) {
1198  throw CEException::invalid_value("CECoordinates::AngularSeparation(CECoords&, CECoords&)",
1199  "Supplied coordinates are in different frames");
1200  }
1201 
1202  // Get the appropriate Y-Coordinates
1203  double y1 = coords1.YCoordinate_Rad();
1204  double y2 = coords2.YCoordinate_Rad();
1205  if (coords1.GetCoordSystem() == CECoordinateType::OBSERVED) {
1206  y1 = M_PI_2 - y1;
1207  y2 = M_PI_2 - y2;
1208  }
1209 
1210  // Convert the second coordinates to be the same type as the first set of coordinates
1211  CEAngle angsep = AngularSeparation(coords1.XCoord(), y1,
1212  coords2.XCoord(), y2) ;
1213 
1214  return angsep ;
1215 }
1216 
1217 /**********************************************************************/
1239 CEAngle CECoordinates::AngularSeparation(const CEAngle& xcoord_first,
1240  const CEAngle& ycoord_first,
1241  const CEAngle& xcoord_second,
1242  const CEAngle& ycoord_second)
1243 {
1244  // Call the 'iauSeps' SOFA algorithm
1245  CEAngle angsep(iauSeps(xcoord_first, ycoord_first,
1246  xcoord_second, ycoord_second)) ;
1247 
1248  return angsep ;
1249 }
1250 
1251 /**********************************************************************/
1266  const CEObserver& observer,
1267  const CEDate& date)
1268 {
1269  CEDate tmpdate(date);
1270  return ConvertTo(output_coord_type,
1271  tmpdate,
1272  observer.Longitude_Rad(),
1273  observer.Latitude_Rad(),
1274  observer.Elevation_m(),
1275  observer.Pressure_hPa(),
1276  observer.Temperature_C(),
1277  observer.RelativeHumidity(),
1278  tmpdate.dut1(),
1279  tmpdate.xpolar(),
1280  tmpdate.ypolar(),
1281  observer.Wavelength_um()) ;
1282 }
1283 
1284 
1285 /**********************************************************************/
1305  double jd,
1306  double longitude,
1307  double latitude,
1308  double elevation_m,
1309  double pressure_hPa,
1310  double temperature_celsius,
1311  double relative_humidity,
1312  double dut1,
1313  double xp, double yp,
1314  double wavelength_um)
1315 {
1316  // Create return coordinate object
1317  CECoordinates out_coord;
1318 
1319  // Do conversion to CIRS
1320  if (output_coord_type == CECoordinateType::CIRS) {
1321  out_coord = ConvertToCIRS(jd, longitude, latitude,
1322  elevation_m, pressure_hPa,
1323  temperature_celsius, relative_humidity,
1324  dut1, xp, yp, wavelength_um) ;
1325  } else if (output_coord_type == CECoordinateType::ICRS) {
1326  out_coord = ConvertToICRS(jd, longitude, latitude,
1327  elevation_m, pressure_hPa,
1328  temperature_celsius, relative_humidity,
1329  dut1, xp, yp, wavelength_um) ;
1330  } else if (output_coord_type == CECoordinateType::GALACTIC) {
1331  out_coord = ConvertToGalactic(jd, longitude, latitude,
1332  elevation_m, pressure_hPa,
1333  temperature_celsius, relative_humidity,
1334  dut1, xp, yp, wavelength_um) ;
1335  } else if (output_coord_type == CECoordinateType::OBSERVED) {
1336  out_coord = ConvertToObserved(jd, longitude, latitude,
1337  elevation_m, pressure_hPa,
1338  temperature_celsius, relative_humidity,
1339  dut1, xp, yp, wavelength_um) ;
1340  }
1341 
1342  return out_coord;
1343 }
1344 
1345 /**********************************************************************/
1363  double longitude,
1364  double latitude,
1365  double elevation_m,
1366  double pressure_hPa,
1367  double temperature_celsius,
1368  double relative_humidity,
1369  double dut1,
1370  double xp, double yp,
1371  double wavelength_um)
1372 {
1373  double xcoord_new(0.0);
1374  double ycoord_new(0.0) ;
1376  // CIRS -> CIRS
1377  xcoord_new = XCoordinate_Rad() ;
1378  ycoord_new = YCoordinate_Rad() ;
1379  } else if (coord_type_ == CECoordinateType::ICRS) {
1380  // ICRS -> CIRS
1382  &xcoord_new, &ycoord_new,
1383  jd, CEAngleType::RADIANS) ;
1384  } else if (coord_type_ == CECoordinateType::GALACTIC) {
1385  // Galactic -> CIRS
1387  &xcoord_new, &ycoord_new,
1388  jd, CEAngleType::RADIANS) ;
1389  } else if (coord_type_ == CECoordinateType::OBSERVED) {
1390  // Observed -> CIRS
1392  &xcoord_new, &ycoord_new,
1393  jd, longitude, latitude,
1394  elevation_m, pressure_hPa,
1395  temperature_celsius, relative_humidity,
1396  dut1, xp, yp, wavelength_um) ;
1397  }
1398 
1399  return CECoordinates(xcoord_new,
1400  ycoord_new,
1402 }
1403 
1404 /**********************************************************************/
1423  double longitude,
1424  double latitude,
1425  double elevation_m,
1426  double pressure_hPa,
1427  double temperature_celsius,
1428  double relative_humidity,
1429  double dut1,
1430  double xp, double yp,
1431  double wavelength_um)
1432 {
1433  double xcoord_new(0.0);
1434  double ycoord_new(0.0);
1437  &xcoord_new, &ycoord_new, jd, CEAngleType::RADIANS) ;
1438  } else if (coord_type_ == CECoordinateType::ICRS) {
1439  xcoord_new = XCoordinate_Rad() ;
1440  ycoord_new = YCoordinate_Rad() ;
1441  } else if (coord_type_ == CECoordinateType::GALACTIC) {
1443  &xcoord_new, &ycoord_new, CEAngleType::RADIANS) ;
1444  } else if (coord_type_ == CECoordinateType::OBSERVED) {
1446  &xcoord_new, &ycoord_new,
1447  jd, longitude, latitude,
1448  elevation_m, pressure_hPa,
1449  temperature_celsius, relative_humidity,
1450  dut1, xp, yp, wavelength_um) ;
1451  }
1452 
1453  return CECoordinates(xcoord_new, ycoord_new,
1455 }
1456 
1457 /**********************************************************************/
1476  double longitude,
1477  double latitude,
1478  double elevation_m,
1479  double pressure_hPa,
1480  double temperature_celsius,
1481  double relative_humidity,
1482  double dut1,
1483  double xp, double yp,
1484  double wavelength_um)
1485 {
1486  double xcoord_new(0.0);
1487  double ycoord_new(0.0);
1490  &xcoord_new, &ycoord_new, jd, CEAngleType::RADIANS) ;
1491  } else if (coord_type_ == CECoordinateType::ICRS) {
1493  &xcoord_new, &ycoord_new, CEAngleType::RADIANS) ;
1494  } else if (coord_type_ == CECoordinateType::GALACTIC) {
1495  xcoord_new = XCoordinate_Rad() ;
1496  ycoord_new = YCoordinate_Rad() ;
1497  } else if (coord_type_ == CECoordinateType::OBSERVED) {
1499  &xcoord_new, &ycoord_new,
1500  jd, longitude, latitude,
1501  elevation_m, pressure_hPa,
1502  temperature_celsius, relative_humidity,
1503  dut1, xp, yp, wavelength_um) ;
1504  }
1505 
1506  return CECoordinates(xcoord_new, ycoord_new, CECoordinateType::GALACTIC) ;
1507 }
1508 
1509 /**********************************************************************/
1527  double longitude,
1528  double latitude,
1529  double elevation_m,
1530  double pressure_hPa,
1531  double temperature_celsius,
1532  double relative_humidity,
1533  double dut1,
1534  double xp, double yp,
1535  double wavelength_um)
1536 {
1537  double xcoord_new(0.0);
1538  double ycoord_new(0.0);
1539  double apparent_x, apparent_y, apparent_hourangle;
1542  &xcoord_new, &ycoord_new,
1543  jd,
1544  longitude, latitude,
1545  elevation_m, pressure_hPa,
1546  temperature_celsius,
1547  relative_humidity,
1548  dut1, xp, yp,
1549  wavelength_um,
1550  &apparent_x, &apparent_y, &apparent_hourangle) ;
1551  } else if (coord_type_ == CECoordinateType::ICRS) {
1553  &xcoord_new, &ycoord_new,
1554  jd,
1555  longitude, latitude,
1556  elevation_m, pressure_hPa,
1557  temperature_celsius,
1558  relative_humidity,
1559  dut1, xp, yp,
1560  wavelength_um,
1561  &apparent_x, &apparent_y, &apparent_hourangle) ;
1562  } else if (coord_type_ == CECoordinateType::GALACTIC) {
1564  &xcoord_new, &ycoord_new,
1565  jd,
1566  longitude, latitude,
1567  elevation_m, pressure_hPa,
1568  temperature_celsius,
1569  relative_humidity,
1570  dut1, xp, yp,
1571  wavelength_um,
1572  &apparent_x, &apparent_y, &apparent_hourangle) ;
1573  } else {
1574  // Throw an exception
1575  std::string msg = "[ERROR] ";
1577  // Cant convert from observed to observed without additional
1578  // observer information
1579  msg += "Unable to convert to OBSERVED from OBSERVED";
1580  }
1581  throw CEException::invalid_value("CECoordinates::ConvertToObserved(long form)",
1582  msg);
1583  }
1584 
1585  return CECoordinates(xcoord_new, ycoord_new, CECoordinateType::OBSERVED) ;
1586 }
1587 
1588 /**********************************************************************/
1598 std::vector<double> CECoordinates::GetDMS(const double& angle,
1599  const CEAngleType& angle_type)
1600 {
1601  CEAngle ang;
1602  ang.SetAngle(angle, angle_type);
1603  return ang.DmsVect() ;
1604 }
1605 
1606 /**********************************************************************/
1617 std::vector<double> CECoordinates::GetHMS(const double& angle,
1618  const CEAngleType& angle_type)
1619 {
1620  // Convert to degrees if passed radians
1621  CEAngle ang;
1622  ang.SetAngle(angle, angle_type);
1623  return ang.HmsVect();
1624 }
1625 
1626 
1627 /**********************************************************************/
1640 double CECoordinates::HMSToAngle(const std::vector<double>& angle,
1641  const CEAngleType& return_type)
1642 {
1643  CEAngle ret_angle = CEAngle::Hms(angle);
1644 
1645  if (return_type == CEAngleType::DEGREES) {
1646  return ret_angle.Deg();
1647  } else {
1648  return ret_angle.Rad();
1649  }
1650 }
1651 
1652 
1653 /**********************************************************************/
1666 double CECoordinates::DMSToAngle(const std::vector<double>& angle,
1667  const CEAngleType& return_type)
1668 {
1669  CEAngle ret_angle = CEAngle::Dms(angle);
1670 
1671  if (return_type == CEAngleType::DEGREES) {
1672  return ret_angle.Deg();
1673  } else {
1674  return ret_angle.Rad();
1675  }
1676 }
1677 
1678 
1679 /**********************************************************************/
1686 void CECoordinates::SetCoordinates(const CEAngle& xcoord,
1687  const CEAngle& ycoord,
1688  const CECoordinateType& coord_type)
1689 {
1690  xcoord_ = xcoord ;
1691  ycoord_ = ycoord ;
1692  coord_type_ = coord_type ;
1693 }
1694 
1695 /**********************************************************************/
1699 void CECoordinates::SetCoordinates(const CECoordinates& coords)
1700 {
1701  copy_members(coords);
1702 }
1703 
1704 
1705 /**********************************************************************/
1709 std::string CECoordinates::print(void) const
1710 {
1711  std::string msg = "Coordinates:\n";
1712  msg += " - System : " + std::to_string(int(coord_type_)) + "\n";
1713  msg += " - X-coord: " + std::to_string(XCoordinate_Deg()) + " deg\n";
1714  msg += " - Y-coord: " + std::to_string(YCoordinate_Deg()) + " deg\n";
1715  return msg;
1716 }
1717 
1718 
1719 /**********************************************************************/
1723 void CECoordinates::copy_members(const CECoordinates& other)
1724 {
1725  coord_type_ = other.coord_type_;
1726  xcoord_ = other.xcoord_;
1727  ycoord_ = other.ycoord_;
1728 }
1729 
1731 /**********************************************************************/
1734 void CECoordinates::free_members(void)
1735 {
1736  // Nothing to do here
1737 }
1738 
1740 /**********************************************************************/
1743 void CECoordinates::init_members(void)
1744 {
1746  xcoord_ = 0.0;
1747  ycoord_ = 0.0;
1748 }
1749 
1750 
1751 /**********************************************************************/
1755 bool operator==(const CECoordinates& lhs, const CECoordinates& rhs)
1756 {
1757  bool are_equal = true;
1758 
1759  // Check the coordinate systems are equivalent
1760  if (lhs.GetCoordSystem() != rhs.GetCoordSystem()) {
1761  are_equal = false;
1762  }
1763  // Check that the x-coordinate and the y-coordinate are the same
1764  else {
1765  // Check how far appart the coordinates are from each other
1766  CEAngle angsep = CECoordinates::AngularSeparation(lhs, rhs);
1767  // Currently require separation < 0.03 arcsec
1768  double marcsec_rad = 4.848e-6;
1769  if (angsep > 3.0*marcsec_rad) {
1770  are_equal = false;
1771  }
1772  }
1773 
1774  return are_equal;
1775 }
1776 
1777 
1778 /**********************************************************************/
1782 bool operator!=(const CECoordinates& lhs, const CECoordinates& rhs)
1783 {
1784  return !(lhs == rhs);
1785 }
CEObserver::Elevation_m
double Elevation_m() const
Return altitude in meters above sea level.
Definition: CEObserver.h:166
CECoordinates::DMSToAngle
static double DMSToAngle(const std::vector< double > &angle, const CEAngleType &return_type=CEAngleType::DEGREES)
Convert a given angle vector from {degrees, minutes, seconds} to an angle.
Definition: CECoordinates.cpp:1662
CEAngle::Dms
static CEAngle Dms(const char *angle_str, const char &delim=0)
Return double constructed from a string representing degrees, minutes, seconds.
Definition: CEAngle.cpp:234
CECoordinates::Observed2Galactic
static int Observed2Galactic(double az, double zen, double *glon, double *glat, const CEDate &date, const CEObserver &observer, const CEAngleType &angle_type=CEAngleType::RADIANS)
Convert Observed -> Galactic coordinates.
Definition: CECoordinates.cpp:653
CECoordinates::AngularSeparation
virtual CEAngle AngularSeparation(const CECoordinates &coords) const
Get the angular separation between the coordinates represented by this object and another coordinate ...
Definition: CECoordinates.cpp:1169
CECoordinates::operator=
CECoordinates & operator=(const CECoordinates &other)
Overloaded '=' (assignment) operator.
Definition: CECoordinates.cpp:122
CECoordinates::ycoord_
CEAngle ycoord_
Definition: CECoordinates.h:386
CECoordinateType::GALACTIC
Galacitc longitude, latitude.
CEAngle::DmsVect
std::vector< double > DmsVect(void) const
Return vector of doubles representing the {degrees, arcmin, arcsec, arcsec-fraction}.
Definition: CEAngle.cpp:291
CEDate
Definition: CEDate.h:43
CppEphem::yp
double yp(const double &mjd)
Polar motion (x) for a given modified julian date (radians)
Definition: CENamespace.cpp:160
CECoordinates::CIRS2Galactic
static void CIRS2Galactic(double ra, double dec, double *glon, double *glat, const CEDate &date=CEDate(), const CEAngleType &angle_type=CEAngleType::RADIANS)
CIRS -> Galactic coordinate conversion.
Definition: CECoordinates.cpp:181
CEObserver::Temperature_C
double Temperature_C() const
Return temperature in degrees Celsius.
Definition: CEObserver.h:186
CECoordinates::ICRS2Galactic
static void ICRS2Galactic(double ra, double dec, double *glon, double *glat, const CEAngleType &angle_type=CEAngleType::RADIANS)
ICRS -> Galactic coordinate conversion (uses the SOFA 'iauIcrs2g' function)
Definition: CECoordinates.cpp:336
CECoordinates::XCoordinate_Deg
virtual double XCoordinate_Deg(double jd=CppEphem::julian_date_J2000()) const
Returns x coordinate at given julian date in degrees.
Definition: CECoordinates.h:450
CECoordinates::ConvertToICRS
CECoordinates ConvertToICRS(double jd=CEDate::CurrentJD(), double longitude=0.0, double latitude=0.0, double elevation_m=0.0, double pressure_hPa=-1.0, double temperature_celsius=-1000, double relative_humidity=0.0, double dut1=0.0, double xp=0.0, double yp=0.0, double wavelength_um=0.5)
Convert these coordinates to ICRS coordinates.
Definition: CECoordinates.cpp:1418
CECoordinates::GetObservedCoords
virtual CECoordinates GetObservedCoords(const double &julian_date, const double &longitude, const double &latitude, const double &elevation_m=0.0, const double &pressure_hPa=-1.0, const double &temperature_celsius=-1000, const double &relative_humidity=0.0, const double &dut1=0.0, const double &xp=0.0, const double &yp=0.0, const double &wavelength_um=0.5) const
Return the local sky coordinates of this object as a CECoordinates object.
Definition: CECoordinates.cpp:1087
CECoordinates::CIRS2ICRS
static void CIRS2ICRS(double input_ra, double input_dec, double *return_ra, double *return_dec, const CEDate &date=CEDate(), const CEAngleType &angle_type=CEAngleType::RADIANS)
CIRS -> ICRS coordinate conversion.
Definition: CECoordinates.cpp:144
CECoordinates::Observed2CIRS
static int Observed2CIRS(double az, double zen, double *ra, double *dec, const CEDate &date, const CEObserver &observer, const CEAngleType &angle_type=CEAngleType::RADIANS)
Convert Observed -> CIRS coordinates.
Definition: CECoordinates.cpp:566
CEObserver.h
CEAngleType
CEAngleType
Definition: CEAngle.h:30
CECoordinates::XCoordinate_Rad
virtual double XCoordinate_Rad(double jd=CppEphem::julian_date_J2000()) const
Return x coordinate at given Julian date in radians.
Definition: CECoordinates.h:437
CECoordinates::free_members
void free_members(void)
Cleanup data members that need to be freed or cleared.
Definition: CECoordinates.cpp:1730
CECoordinates::ConvertToGalactic
CECoordinates ConvertToGalactic(double jd=CEDate::CurrentJD(), double longitude=0.0, double latitude=0.0, double elevation_m=0.0, double pressure_hPa=-1.0, double temperature_celsius=-1000, double relative_humidity=0.0, double dut1=0.0, double xp=0.0, double yp=0.0, double wavelength_um=0.5)
Convert these coordinates to GALACTIC coordinates.
Definition: CECoordinates.cpp:1471
CEObserver::RelativeHumidity
double RelativeHumidity() const
Return relative humidity.
Definition: CEObserver.h:216
CEObserver::Longitude_Rad
double Longitude_Rad() const
Return observer geographic longitude in radians.
Definition: CEObserver.h:126
CECoordinates::YCoordinate_Deg
virtual double YCoordinate_Deg(double jd=CppEphem::julian_date_J2000()) const
Returns y coordinate at given Julian date in degrees.
Definition: CECoordinates.h:475
CECoordinateType::ICRS
RA, Dec (referenced at the barycenter of the solarsystem)
CECoordinates::ConvertTo
CECoordinates ConvertTo(CECoordinateType output_coord_type, const CEObserver &observer, const CEDate &date=CEDate::CurrentJD())
Convert these coordinates to another coordinate system NOTE: If this object is not OBSERVED coordinat...
Definition: CECoordinates.cpp:1261
CEAngle::HmsVect
std::vector< double > HmsVect(void) const
Return vector of doubles representing the {hours, min, sec, sec-fraction}.
Definition: CEAngle.cpp:199
CECoordinates::Observed2ICRS
static int Observed2ICRS(double az, double zen, double *ra, double *dec, const CEDate &date, const CEObserver &observer, const CEAngleType &angle_type=CEAngleType::RADIANS)
Convert Observed -> ICRS coordinates.
Definition: CECoordinates.cpp:608
CECoordinates::copy_members
void copy_members(const CECoordinates &other)
Copy data members from another CECoordinates object.
Definition: CECoordinates.cpp:1719
operator==
bool operator==(const CECoordinates &lhs, const CECoordinates &rhs)
Compare two coordinate objects.
Definition: CECoordinates.cpp:1751
CECoordinates::xcoord_
CEAngle xcoord_
Definition: CECoordinates.h:385
CECoordinates::GetDMS
static std::vector< double > GetDMS(const double &angle, const CEAngleType &angle_type=CEAngleType::DEGREES)
Convert a given angle into degrees, arcminutes, arcseconds.
Definition: CECoordinates.cpp:1594
CEDate::UTC2TDB
static void UTC2TDB(const double &mjd, double *tdb1, double *tdb2)
Convert the UTC MJD to TDB JD (useful for planet computations)
Definition: CEDate.cpp:429
CECoordinates.h
CEAngle
Definition: CEAngle.h:38
CEDate::ypolar
static double ypolar(const double &date, const CEDateType &date_type=CEDateType::JD)
Polar motion (xy for a given date.
Definition: CEDate.cpp:520
CEAngle::SetAngle
void SetAngle(const double &angle, const CEAngleType &angle_type=CEAngleType::RADIANS)
Set the angle from a double.
Definition: CEAngle.cpp:369
CEObserver::Pressure_hPa
double Pressure_hPa() const
Return atmospheric pressure in units of hPa.
Definition: CEObserver.h:176
CECoordinates::ConvertToCIRS
CECoordinates ConvertToCIRS(double jd=CEDate::CurrentJD(), double longitude=0.0, double latitude=0.0, double elevation_m=0.0, double pressure_hPa=-1.0, double temperature_celsius=-1000, double relative_humidity=0.0, double dut1=0.0, double xp=0.0, double yp=0.0, double wavelength_um=0.5)
Convert these coordinates to CIRS coordinates.
Definition: CECoordinates.cpp:1358
CECoordinates::CECoordinates
CECoordinates()
Default constructor.
Definition: CECoordinates.cpp:38
CEObserver::Wavelength_um
double Wavelength_um() const
Return the wavelength in units of micrometers.
Definition: CEObserver.h:226
CECoordinates::GetCoordSystem
CECoordinateType GetCoordSystem(void) const
Return coordinate system.
Definition: CECoordinates.h:486
CEAngle::Rad
static CEAngle Rad(const double &angle)
Return angle constructed from a radians angle.
Definition: CEAngle.cpp:340
CEAngleType::DEGREES
CECoordinates::ConvertToObserved
CECoordinates ConvertToObserved(double jd=CEDate::CurrentJD(), double longitude=0.0, double latitude=0.0, double elevation_m=0.0, double pressure_hPa=-1.0, double temperature_celsius=-1000, double relative_humidity=0.0, double dut1=0.0, double xp=0.0, double yp=0.0, double wavelength_um=0.5)
Convert these coordinates to observed coordinates.
Definition: CECoordinates.cpp:1522
JD
Julian Date.
Definition: CEDate.h:56
CEDate::GetMJD2JDFactor
static double GetMJD2JDFactor()
Gets the stored SOFA Julian date to Mod Julian date factor 'DJM0'.
Definition: CEDate.h:236
CECoordinates::Galactic2CIRS
static void Galactic2CIRS(double glon, double glat, double *ra, double *dec, const CEDate &date=CEDate(), const CEAngleType &angle_type=CEAngleType::RADIANS)
Galactic -> CIRS coordinate conversion.
Definition: CECoordinates.cpp:441
CECoordinates::CIRS2Observed
static int CIRS2Observed(double ra, double dec, double *az, double *zen, const CEDate &date, const CEObserver &observer, const CEAngleType &angle_type=CEAngleType::RADIANS, double wavelength_um=0.5, double *observed_ra=nullptr, double *observed_dec=nullptr, double *hour_angle=nullptr)
CIRS -> Observed (or observer specific) coordinate conversion This function takes in verious observat...
Definition: CECoordinates.cpp:224
CECoordinates::Galactic2Observed
static int Galactic2Observed(double glon, double glat, double *az, double *zen, const CEDate &date, const CEObserver &observer, const CEAngleType &angle_type=CEAngleType::RADIANS, double wavelength_um=0.5, double *observed_glon=nullptr, double *observed_glat=nullptr, double *hour_angle=nullptr)
Galactic -> Observed (i.e.
Definition: CECoordinates.cpp:508
CECoordinates::HMSToAngle
static double HMSToAngle(const std::vector< double > &angle, const CEAngleType &return_type=CEAngleType::DEGREES)
Convert from {hours, minutes, seconds} to an angle.
Definition: CECoordinates.cpp:1636
CECoordinates::GetHMS
static std::vector< double > GetHMS(const double &angle, const CEAngleType &angle_type=CEAngleType::DEGREES)
Convert a given angle into hours, minutes, seconds.
Definition: CECoordinates.cpp:1613
CECoordinates
Definition: CECoordinates.h:48
CECoordinates::coord_type_
CECoordinateType coord_type_
Definition: CECoordinates.h:387
CEAngleType::RADIANS
operator!=
bool operator!=(const CECoordinates &lhs, const CECoordinates &rhs)
Compare two coordinate objects.
Definition: CECoordinates.cpp:1778
CECoordinates::init_members
void init_members(void)
Set initial values and allocate memory for data members.
Definition: CECoordinates.cpp:1739
CEObserver
Definition: CEObserver.h:28
CEException::invalid_value
Definition: CEException.h:73
CECoordinates::XCoord
virtual CEAngle XCoord(const double &jd=CppEphem::julian_date_J2000()) const
Return x coordinate at given Julian date.
Definition: CECoordinates.h:411
CECoordinateType::CIRS
RA, Dec (referenced at the center of the Earth)
CEException::sofa_exception
Definition: CEException.h:110
CECoordinateType
CECoordinateType
The following enum specifies what coordinates this object represents.
Definition: CECoordinates.h:39
CEDate::MJD
virtual double MJD() const
Get the Modified Julian date represented by this object.
Definition: CEDate.h:160
CEDate::xpolar
static double xpolar(const double &date, const CEDateType &date_type=CEDateType::JD)
Polar motion (x) for a given date.
Definition: CEDate.cpp:494
CECoordinates::ICRS2CIRS
static void ICRS2CIRS(double input_ra, double input_dec, double *return_ra, double *return_dec, const CEDate &date=CEDate(), const CEAngleType &angle_type=CEAngleType::RADIANS)
ICRS -> CIRS coordinate conversion.
Definition: CECoordinates.cpp:287
CEAngle::Hms
static CEAngle Hms(const char *angle_str, const char &delim=0)
Return angle constructed from a string representing hours, minutes, seconds.
Definition: CEAngle.cpp:142
CECoordinates::SetCoordinates
virtual void SetCoordinates(const CEAngle &xcoord, const CEAngle &ycoord, const CECoordinateType &coord_type=CECoordinateType::ICRS)
Set the coordinates of this object.
Definition: CECoordinates.cpp:1682
CppEphem::dut1
double dut1(const double &mjd)
Return dut1 based on a given modified julian date (seconds)
Definition: CENamespace.cpp:111
CECoordinates::YCoordinate_Rad
virtual double YCoordinate_Rad(double jd=CppEphem::julian_date_J2000()) const
Returns y coordinate at given Julian date in radians.
Definition: CECoordinates.h:463
CEDate::JD
virtual double JD() const
Get the Julian date represented by this object.
Definition: CEDate.h:150
CEObserver::Latitude_Rad
double Latitude_Rad() const
Return geographic latitude in radians.
Definition: CEObserver.h:146
CECoordinates::print
std::string print(void) const
Generate a message string that specifies the information about this coordinate.
Definition: CECoordinates.cpp:1705
CECoordinateType::OBSERVED
Azimuth, Zenith (requires additional observer information)
CEAngle::Deg
static CEAngle Deg(const double &angle)
Return angle (radians) constructed from a degree angle.
Definition: CEAngle.cpp:317
CECoordinates::ICRS2Observed
static int ICRS2Observed(double ra, double dec, double *az, double *zen, const CEDate &date, const CEObserver &observer, const CEAngleType &angle_type=CEAngleType::RADIANS, double wavelength_um=0.5, double *observed_ra=nullptr, double *observed_dec=nullptr, double *hour_angle=nullptr)
ICRS -> Observed coordinate conversion.
Definition: CECoordinates.cpp:373
CECoordinates::Galactic2ICRS
static void Galactic2ICRS(double glon, double glat, double *ra, double *dec, const CEAngleType &angle_type=CEAngleType::RADIANS)
Galactic -> ICRS coordinate conversion.
Definition: CECoordinates.cpp:474
CEDate::dut1
static double dut1(const double &date, const CEDateType &date_type=CEDateType::JD)
Return dut1 based on a given modified date.
Definition: CEDate.cpp:447
CppEphem::xp
double xp(const double &mjd)
Polar motion (x) for a given modified julian date (radians)
Definition: CENamespace.cpp:148
CECoordinates::~CECoordinates
virtual ~CECoordinates()
Destructor.
Definition: CECoordinates.cpp:112