Coordinate Handling Library

Table of Contents

General Description

This library provides all the functionality needed to transform coordinate (in decimal degrees or sexigesimal notation) between any astronomical coordinate system at any epoch (including between Julian and Besselian with or without proper motion).


Sexigesimal Coordinate String Handling

One subset of coord library routines is focussed on the task of converting readable text representations of coordinates to internal binary (decimal degrees). These routines are as follows:

   int   status = parseCoordinateString (char *cmd, 
					 char *lonstr, char *latstr,
					 char *csys, char *cfmt, 
					 char *epoch)

   int   status = sexToDegree (char *cra, char *cdec, 
			       double *ra, double *dec)

   int   status = degreeToSex (double lon, double lat, 
			       char *lonstr, char *latstr)

   int   status = degreeToHMS (double deg, int prec, 
			       int *neg, int *h, int *m, double *s)

   int   status = degreeToDMS (double deg, int prec, 
			       int *neg, int *d, int *m, double *s)

Function descriptions:


Coordinate System Tranformation

The rest of the coord library routines provide the conversions between the various coordinate systems, as well as precession and Besselian/Julian transformation. They are as follows:


   int   status = convertCoordinates (int      insys, double  inepoch, 
				      double   inlon, double    inlat,
				      int     outsys, double outepoch, 
				      double *outlon, double  *outlat,
				      double obstime )


   int   status = convertBesselianToJulian (double  equinoxin, 
					    double         ra, double     dec,
					    double    obsdate, int      ieflg,
					    double     *raout, double *decout )

   int   status = convertJulianToBesselian (double         ra, double     dec, 
					    double    obsdate, int      ieflg, 
					    double equinoxout,
					    double     *raout, double *decout )


   int   status = convertEquToEcl  ( double     ra, double    dec, 
				     double  *elon, double  *elat,
				     double   date, int besselian )

   int   status = convertEclToEqu  ( double   elon, double   elat, 
				     double    *ra, double   *dec,
				     double   date, int besselian )

   int   status = convertEquToGal  ( double     ra, double    dec, 
				     double  *glon, double  *glat )

   int   status = convertGalToEqu  ( double   glon, double   glat, 
				     double    *ra, double   *dec )

   int   status = convertGalToSgal ( double   glon, double   glat,
				     double *sglon, double *sglat )

   int   status = convertSgalToGal ( double  sglon, double  sglat, 
				     double  *glon, double  *glat )


   int   status = precessBesselian ( double  epochin,  
				     double     rain, double   decin,
				     double epochout, 
				     double   *raout, double *decout )

   int   status = precessBesselianWithProperMotion 
				   ( double  epochin,  
				     double     rain, double   decin,
				     double epochout, 
				     double   *raout, double *decout,
				     double    pmain, double   pmdin, 
				     double      pin, double     vin,
				     double    *rapm, double  *decpm )


   int   status = precessJulian    ( double  epochin,  
				     double     rain, double   decin,
				     double epochout, 
				     double   *raout, double *decout )

   int   status = precessJulianWithProperMotion
				   ( double  epochin,  
				     double     rain, double   decin,
				     double epochout, 
				     double   *raout, double *decout,
				     double    pmain, double   pmdin, 
				     double      pin, double     vin,
				     double    *rapm, double  *decpm )

All of this routines convert coordinates in one system to another. For most users, the convertCoordinates() routine (which is a wrapper around all the others) will suffice. If the user wishes to use the others directly, the parameters are defined as follows:


For basic conversions:

(ra,   dec  )  Coordinate in decimal degrees equatorial
(elat, elon )  Coordinate in decimal degrees ecliptic
(glat, glon )  Coordinate in decimal degrees galactic
(sglat,sglon)  Coordinate in decimal degrees supergalactic

date           Date (in decimal years)
besselian      Flag (TRUE:1 if coordinates are Besselian)


For precession:

(rain,  decin,  epochin,  equinoxin)   Input coordinates, epoch, and equinox
(raout, decout, epochout, equinoxout)  Output coordinates, epoch, and equinox

obsdate    Date (decimal years)
ieflg      Flag allowing removal of E-terms of aberration if any
                                                               
           ieflg = -1 do not remove E-terms (there are none).
           ieflg = +1 any value except -1 indicates E-terms
                      are present and are to be removed.

The input coordinates must be in the correct system (Julian or Besselian) for the conversion being used and are always Equatorial decimal degrees.


For proper motion (not fully tested at this time):

   epochin         epoch of input position (in year - e.g. 1950.0d0)  
   rain,  decin    input position in decimal degrees at epochin       
   pmain, pmdin    proper motion in ra,dec in seconds of time         
                   per Tropical century.                              
                                                                      
   pin             parallax in arc seconds (0.0d0 if none)            
   vin             radial velocity in km/sec (0.0d0 if none)          
   epochout        epoch of output position (in year - e.g. 1992.0d0) 
   raout, decout   position in decimal degrees at epochout            
   rapm, decpm     proper motion in ra,dec in seconds of time         
                   per Tropical century for epochout                  

In these coordinate transformation routines, the coordinate system identifiers are in the include file coord.h:

      #define EQUJ      0
      #define EQUB      1
      #define ECLJ      2
      #define ECLB      3
      #define GAL       4
      #define SGAL      5

      #define JULIAN    0
      #define BESSELIAN 1


Author: John Good
Address: jcg@ipac.caltech.edu
Last update: 16-Dec-99