The provided code calculates the Corrected GeoMagnetic (CGM) coordinates and several other main geomagnetic field parameters for specified points at the Earth's surface (geocentric coordinates) or in near-Earth space (and vice versa). The underlying main geomagnetic field models are the Definite/International Geomagnetic Reference Field (DGRF/IGRF) models for Epoch's years 1900,..1945, 1950, ..., 2005,2010,2015,2020 and the secular variation model for 2020-2025. The CGM coordinates have proven to be excellent tools in organizing geophysical phenomena controlled by the Earth's magnetic field, like auroral boundaries, high and middle latitude ionospheric currents, etc.

Required input parameters are:

- Geocentric or corrected geomagnetic latitude and longitude of a given point (depending on the selection of GEO -> CGM or CGM -> GEO calculations);
- Altitude of the given point above the Earth's surface at 1-Re (40,000 km is an upper limit);
- Year in one year increments.

Computed output parameters for the given point are:

- CGM (in the case of GEO -> CGM) or geocentric coordinates (in case of CGM -> GEO);
- DGRF/IGRF magnetic field components H (nT), D (deg.), and Z (nT);
- Geocentric coordinates of the magnetically conjugate point;
- Geocentric coordinates of the magnetic field line footprint (see also AACGM coordinates of a given point site for definition Web of the Altitude Adjusted CGM coordinates) ;
- Apex of the magnetic field line
- Magnetic local time (MLT) midnight in UT (hh:mm);
- Meridian angle between the azimuths to geographic and CGM poles (both are great-circle arcs): the angle is positive East (West) in the Northern (Southern) hemisphere.
- Oval_angle: the angle between local tangents to the CGM and geographic (geocentric) latitudes; this angle is presented as the azimuth to the local "magnetic north" ("magnetic south") if the eastward (westward) tangent to the CGM latitude points southward (northward) from local East (West); measured positive to East (West)

The DGRF/IGRF model output is presented in the local geomagnetic coordinate system:

- H - total horizontal field vector directed along the local geomagnetic meridian, i.e., H = sqrt( X^2 + Y^2) where X and Y are the geomagnetic field components measured along the geographic meridian (positive - northward) and geographic latitude (positive - eastward);
- D - declination of the geomagnetic field, i.e., D (deg) = tan (Y/X); postive - eastward;
- Z - vertical component, positive direction - downward, towards the Earth's center.

Note that the main geomagnetic field components have the following signs: H is positive everywhere on Earth, D can be eastward (+) or westward (-), Z is positive in the Northern Hemisphere, and negative - in the Southern Hemisphere.

The software package consists of several modules. The DGRF/IGRF field computation subroutine is taken from the GEOPACK-2008 software package developed by Drs. Nikolai Tsyganenko. The field line tracing and original CGM coordinate transformation modules were developed by Drs. Natalia and Vladimir Papitashvili.

By definition, the CGM coordinates (latitude, longitude) of a
point in space are computed by tracing the DGRF/IGRF magnetic
field line through the specified point to the dipole geomagnetic
equator, then returning to the same altitude along the dipole
field line and assigning the obtained dipole latitude and
longitude as the CGM coordinates to the starting point.
At the near-equatorial region, where the magnetic field lines may not
reach the dipole equator and where, therefore, the standard definition
of CGM coordinates is irrelevant. Therefore, the this code is limited
to the areas less then |20| degrees geographic latitudes in both the Northern
and Southern hemispheres *Gustafsson et al.* [1992].

Because the "local" CGM meridian is non-orthogonal to the "local" CGM latitude, we approximate the "local" direction of this meridian.by the great-circle arc, connecting the given point (station) and the corresponding (North or South) CGM pole. Therefore, an azimuth of this arc with respect to the local geographic meridian (which is also the great-circle arc, connecting the station and the corresponding geographic pole) is our "meridian" angle: positive to East from the North geographic meridian and positive to West from the South geographic meridian.

According to the definition of geomagnetic coordinates under
the dipole approximation, the magnetic local time (MLT) is
measured by the flare angle formed by two planes: the dipole
meridional plane, which contains a subsolar point on the Earth's
(or any altitude) surface, and the dipole meridional plane which
contains a given point on the surface (that is, the local dipole
meridian). This definition cannot be applied to the CGM
coordinate system because the latter is non-orthogonal and the
CGM meridians do not cross the magnetic equator elsewhere [cf. *Gustafsson
et al.*, 1992]. Therefore, the dipole-based approximation is
invalid in defining MLT for the CGM coordinate system.

Here we propose to utilize another approach in defining MLT for the CGM coordinate system. Let us assume that the station is located at local midnight, i.e., at some UT instance the local geographic meridian is at 00 LT and the station is "behind" the geographic pole with respect to the Sun. If the Earth rotates through an angle (measured in UT hours and minutes) so that the station's local CGM meridian (approximated by the great-circle arc) is moved to 00 MLT, then the station is "behind" the CGM pole with respect to the Sun. This UT instance (in hours and minutes) would be "a local MLT midnight in UT" which is computed in our algorithm.

Gustafsson, G., N. E. Papitashvili, and V. O. Papitashvili, A
Revised Corrected Geomagnetic Coordinate System for Epochs 1985
and 1990, *J. Atmos. Terr. Phys.*, **54**, 1609-1631,
1992.

Tsyganenko, N. A., A. V. Usmanov, V. O. Papitashvili, N. E.
Papitashvili, and V. A. Popov, *Software for computations of
the geomagnetic field and related coordinate systems*, Soviet
Geophys. Comm., Moscow, 58 pp., 1987.

If you have any questions/comments, contact:

Dr. Natalia Papitashvili, E-mail: Natalia.E.Papitashvili@nasa.gov, NASA/Goddard Spaceflight Center, Greenbelt, MD 20771