chi and h site logo

{ Practical astronomy | Computing | Coordinate calculations }

Coordinate calculations

Here we combine the computing environment, the software design principles and the insights about coordinate systems into software to do some calculations for us. The result is the Coords module.

For distances we use Gigametre (Gm) throughout, except for elevation above the ellipsoid, which is required and returned in metre. For angles we use degrees, unless it is expedient to use radian internally. Coordinates are Cartesian internally and converted from/to degrees for the user interface. We aspire to an accuracy of 0.01° within ±100 years from the present and 1° within ±1000 years.

The principal coordinate system is RA/Dec for J2000. Supported systems are the seven listed systems and transforms between successive list entries (not between random pairs of systems):

  1. galactic lII,bII
  2. B1950 geocentric RA/Dec
  3. J2000 geocentric RA/Dec
  4. EOD geocentric ecliptic λ,β
  5. EOD geocentric RA/Dec
  6. EOD topocentric HA/Dec
  7. topocentric horizontal A,h

We do not support atmospheric refraction, which causes objects to appear a little higher above the horizon than they mathematically are. The user is encouraged to account for this in the calculation of the rise or set time of an object. This is done by specifying the criterion as the altitude being not zero, but −0.6°.

We use two hidden files to keep information about our location on the Earth (our "observatory") and about the object in the sky.

Stores the geographic longitude in degrees, the geodetic (geographic) latitude in degrees, the elevation above sea level in Gm, a name for the observatory.
Stores the right ascension and declination for equinox J2000 in degrees, the distance in Gm, a name for the object.

The object is specifically a "fixed object", i.e. an object in the Galaxy or an external galaxy, but not a body in orbit around the Sun or Earth. That said, it may make sense for the user to calculate the position of such a body for a specific time and then treat that like a fixed object over a short time interval.

We have these user utilities to set the principal data. They require Python scripts to invoke from the Bash shell and to convert input parameters, and Python functions to do the work: long lat elev name
LocSet(long, lat, elev, name)
Store the given data as the observatory location. Enter geographic (not geocentric) longitude and latitude in degrees and elevation in metres. sys angle1 angle2 distance name
FixSet(sys, angle1, angle2, distance, name)
Store the given data as the fixed sky position. Enter the system code as
1: galactic lII, bII;
2: B1950 RA, Dec;
3: J2000 RA, Dec;
4: EOD ecliptic λ, β;
5: EOD geocentric RA, Dec;
6: topocentric HA, Dec;
7: horizontal A, h.
The two angles are then interpreted in that system. Enter the angles in degrees, the distance in Gm.

We have these user utilities to show the principal data and data derived from it. They require Python scripts to invoke from the Bash shell and to convert input parameters, and Python functions to do the work:
Show the observatory location, also sidereal time.
Show the fixed sky object, in all coordinate systems. alt
Show the next rise and set times for the fixed sky object. The given parameter is the altitude in degrees that defines the "rise" or "set". Give 0 for the mathematical horizon, −0.6° to compensate for average atmospheric refraction. To calculate twilight, give −6° for civil twilight, −12° for nautical twilight, or −18° for astronomical twilight.

Here is an example use from the Bash shell. The time is set from the computer's clock, then the observatory and object selected. Four output routines show time, observatory, position of the object, and finally, when the object will rise above 20° altitude. (Although we have entered the distance of the object accurately, for objects beyond the Solar System one can just use something like 1e30 as a quasi-infinite distance.)

$   -70.417 -24.667 2635 "Cerro Paranal"
$ 1  59.02   40.91  2.1e7 M13


                     JD [d]  2459020.343923
      Gregorian Date and UT  2020-06-19T20:15:15.0
         Julian Date and UT  2020-06-06T20:15:15.0
                TT - UT [s]  70.46637624534196
              TAI - UTC [s]  38.282376245341965


                Observatory  Cerro Paranal
 Geographic longitude [deg]  -70.417
  Geographic latitude [deg]  -24.667
  Geocentric latitude [deg]  -24.52155560529307
              Elevation [m]  2635.0
        Sidereal time [deg]  141.90911509974632


        Object  M13
       lII,bII  59.01999999999999 40.91000000000005 21000000.000000007
  RA,Dec B1950  249.98002234659745 36.56332777058926 21000000.000000007
  RA,Dec J2000  250.42731700715416 36.46922883313028 21000000.0
   lam,bet EOD  239.86226790495692 57.859090057014505 21000000.000000004
    RA,Dec EOD  250.61044103566365 36.43130091775591 21000000.000000007
   HA,Dec topo  251.2986740454466 36.43130092055172 21000000.003068514
      A,h topo  60.45248793247757 -28.834145445519216 21000000.003068514

$ 20

      next rise  2020-06-20T01:04:23.1
       next set  2020-06-20T05:53:21.0
 altitude [deg]  20.0