LAL  7.5.0.1-08ee4f4

Tests geocentric to geodetic conversion. More...

Detailed Description

Tests geocentric to geodetic conversion.

Author
Creighton, T. D.

Usage

GeocentricGeodeticTest [-x xmin xmax nx] [-y ymin ymax ny]
[-z zmin zmax nz] [-v] [-d debuglevel]

Description

This program converts a point or set of points from geocentric to geodetic coordinates and back, using the routines LALGeocentricToGeodetic() and LALGeodeticToGeocentric(). The reconverted position is compared with the original, and the maximum difference (in metres) reported to stderr. The following option flags are accepted:

  • -x Specifies a range and number of points to span in the geocentric Cartesian \(x\)-coordinate. Range limits are given in Earth radii, and the number of points must be at least 1. If not specified, a single value of 0 is assumed.
  • -y As -x, above, but for the \(y\)-coordinate.
  • -z As -x, above, but for the \(z\)-coordinate.
  • -v Specifies verbosity level. The default is level 0, printing only the maximum difference to stderr. Level 1 in addition prints to stdout the difference measured at each point. Level 2 prints the elevation of the point, followed by the difference, both in metres (this is to facilitate shaded diagrams such as this figure. Level 3 prints the \(x\), \(y\), and \(z\) coordinates of each point followed by the difference measured at that point (all in metres). Level 4 prints the geocentric Cartesian coordinates, above, folowed by the geodetic elevation, latitude and longitude, followed by the difference (in metres or degrees as appropriate).
  • -d Sets the debug level to debuglevel. If not specified, level 0 is assumed.

If neither -x, -y, or -z were specified, then the program will test a single randomly generated position between 0.5 and 2 Earth radii, and return an error if the conversion produces a difference greater than a micron.

Algorithm

Precision of geocentric-geodetic conversion algorithm. Shaded ellipse is the reference ellipsoid. The wedges of (comparatively) lower precision occur near the equator\, where the series expansion in B is required.

See Module TerrestrialCoordinates.c for documentation about the geocentric/geodetic conversion algorithm. Since LALGeodeticToGeocentric() is fairly straightforward and numerically robust, this program is basically a test of the LALGeocentricToGeodetic() algorithm.

Running with verbosity level 2 gives error data that can be used to generate figures such as this figure. First we note that for points near the surface of the Earth, the position error is never greater than a micron, or about one part in \(10^{12}\) — a reasonable expectation for double-precision arithmetic. The largest errors occur near the equator, where the expression for \(v\) experiences loss of precision. In this limit we replace the "exact" expression for \(v\) with a power series, as described in TerrestrialCoordinates.c(). This restores precision near the equatorial plane. The point of transition has been tuned by hand, so that the errors due to series truncation just within the wedge are about the same as the numerical loss of precision just outside of it.

Definition in file GeocentricGeodeticTest.c.

Go to the source code of this file.

Macros

Error Codes
#define GEOCENTRICGEODETICTESTC_ENORM   0
 Normal exit. More...
 
#define GEOCENTRICGEODETICTESTC_ESUB   1
 Subroutine failed. More...
 
#define GEOCENTRICGEODETICTESTC_EARG   2
 Error parsing arguments. More...
 
#define GEOCENTRICGEODETICTESTC_EMEM   3
 Out of memory. More...
 
#define GEOCENTRICGEODETICTESTC_ETEST   4
 Test case failed. More...
 

Macro Definition Documentation

◆ GEOCENTRICGEODETICTESTC_ENORM

#define GEOCENTRICGEODETICTESTC_ENORM   0

Normal exit.

Definition at line 105 of file GeocentricGeodeticTest.c.

◆ GEOCENTRICGEODETICTESTC_ESUB

#define GEOCENTRICGEODETICTESTC_ESUB   1

Subroutine failed.

Definition at line 106 of file GeocentricGeodeticTest.c.

◆ GEOCENTRICGEODETICTESTC_EARG

#define GEOCENTRICGEODETICTESTC_EARG   2

Error parsing arguments.

Definition at line 107 of file GeocentricGeodeticTest.c.

◆ GEOCENTRICGEODETICTESTC_EMEM

#define GEOCENTRICGEODETICTESTC_EMEM   3

Out of memory.

Definition at line 108 of file GeocentricGeodeticTest.c.

◆ GEOCENTRICGEODETICTESTC_ETEST

#define GEOCENTRICGEODETICTESTC_ETEST   4

Test case failed.

Definition at line 109 of file GeocentricGeodeticTest.c.