Documentation ¶
Overview ¶
Globe: Chapter 11, The Earth's Globe.
Globe contains functions concerning the surface of the Earth idealized as an ellipsoid of revolution.
Index ¶
- Constants
- Variables
- func ApproxAngularDistance(p1, p2 Coord) float64
- func ApproxLinearDistance(d unit.Angle) float64
- func GeocentricLatitudeDifference(φ unit.Angle) unit.Angle
- func OneDegreeOfLatitude(rm float64) float64
- func OneDegreeOfLongitude(rp float64) float64
- func Rho(φ unit.Angle) float64
- type Coord
- type Ellipsoid
- func (e Ellipsoid) A() float64
- func (e Ellipsoid) B() float64
- func (e Ellipsoid) Distance(c1, c2 Coord) float64
- func (e Ellipsoid) Eccentricity() float64
- func (e Ellipsoid) ParallaxConstants(φ unit.Angle, h float64) (s, c float64)
- func (e Ellipsoid) RadiusAtLatitude(φ unit.Angle) float64
- func (e Ellipsoid) RadiusOfCurvature(φ unit.Angle) float64
Examples ¶
Constants ¶
const RotationRate1996_5 = 7.292114992e-5
RotationRate1996_5 is the rotational angular velocity of the Earth with respect to the stars at the epoch 1996.5.
Unit is radian/second.
Variables ¶
var Earth76 = Ellipsoid{Er: 6378.14, Fl: 1 / 298.257}
IAU 1976 values. Radius in Km.
Functions ¶
func ApproxAngularDistance ¶
ApproxAngularDistance returns the cosine of the angle between two points.
The accuracy deteriorates at small angles.
func ApproxLinearDistance ¶
ApproxLinearDistance computes a distance across the surface of the Earth.
Approximating the Earth as a sphere, the function takes a geocentric angular distance and returns the corresponding linear distance in Km.
func GeocentricLatitudeDifference ¶
GeocentricLatitudeDifference returns geographic latitude - geocentric latitude (φ - φ′) given geographic latitude (φ).
func OneDegreeOfLatitude ¶
OneDegreeOfLatitude returns the length of one degree of latitude.
Argument rm is the radius of curvature along a meridian. (as returned by Ellipsoid.RadiusOfCurvature.) Result is distance in units of rm along one degree of the meridian.
func OneDegreeOfLongitude ¶
OneDegreeOfLongitude returns the length of one degree of longitude.
Argument rp is the radius of a circle that is a parallel of latitude (as returned by Ellipsoid.RadiusAtLatitude.)
Result is distance along one degree of the circle, in same units as rp.
Types ¶
type Coord ¶
Coord represents geographic coordinates on the Earth.
Longitude is measured positively westward from the Greenwich meridian.
type Ellipsoid ¶
Ellipsoid represents an ellipsoid of revolution.
Typical unit for Er is Km.
func (Ellipsoid) A ¶
A returns equatorial radius in units of e.Er.
A is a common identifier for equatorial radius.
func (Ellipsoid) B ¶
B returns polar radius in units of e.ER.
B is a common identifier for polar radius.
func (Ellipsoid) Distance ¶
Distance is distance between two points measured along the surface of an ellipsoid.
Accuracy is much better than that of ApproxAngularDistance or ApproxLinearDistance.
Result unit is units of e.Er, typically Km.
Example ¶
// Example 11.c p 85. c1 := globe.Coord{ unit.NewAngle(' ', 48, 50, 11), // geographic latitude unit.NewAngle('-', 2, 20, 14), // geographic longitude } c2 := globe.Coord{ unit.NewAngle(' ', 38, 55, 17), unit.NewAngle(' ', 77, 3, 56), } fmt.Printf("%.2f km\n", globe.Earth76.Distance(c1, c2)) cos := globe.ApproxAngularDistance(c1, c2) fmt.Printf("cos d = %.6f\n", cos) d := unit.Angle(math.Acos(cos)) fmt.Printf(" d = %.5j\n", sexa.FmtAngle(d)) fmt.Printf(" s = %.0f km\n", globe.ApproxLinearDistance(d))
Output: 6181.63 km cos d = 0.567146 d = 55°.44855 s = 6166 km
func (Ellipsoid) Eccentricity ¶
Eccentricity of a meridian.
func (Ellipsoid) ParallaxConstants ¶
ParallaxConstants computes parallax constants ρ sin φ′ and ρ cos φ′.
Arguments are geographic latitude φ and height h above the ellipsoid. For e.Er in Km, h must be in meters.
Example ¶
package main import ( "fmt" "github.com/soniakeys/meeus/v3/globe" "github.com/soniakeys/unit" ) func main() { // Example 11.a, p 82. // phi = geographic latitude of Palomar φ := unit.NewAngle(' ', 33, 21, 22) s, c := globe.Earth76.ParallaxConstants(φ, 1706) fmt.Printf("ρ sin φ′ = %+.6f\n", s) fmt.Printf("ρ cos φ′ = %+.6f\n", c) }
Output: ρ sin φ′ = +0.546861 ρ cos φ′ = +0.836339
func (Ellipsoid) RadiusAtLatitude ¶
RadiusAtLatitude returns the radius of the circle that is the parallel of latitude φ.
Result unit is same as e.Er (typically Km.)
Example ¶
package main import ( "fmt" "github.com/soniakeys/meeus/v3/globe" "github.com/soniakeys/unit" ) func main() { // Example 11.b p 84. φ := unit.AngleFromDeg(42) rp := globe.Earth76.RadiusAtLatitude(φ) fmt.Printf("Rp = %.3f km\n", rp) fmt.Printf("1° of longitude = %.4f km\n", globe.OneDegreeOfLongitude(rp)) fmt.Printf("linear velocity = ωRp = %.5f km/second\n", rp*globe.RotationRate1996_5) rm := globe.Earth76.RadiusOfCurvature(φ) fmt.Printf("Rm = %.3f km\n", rm) fmt.Printf("1° of latitude = %.4f km\n", globe.OneDegreeOfLatitude(rm)) }
Output: Rp = 4747.001 km 1° of longitude = 82.8508 km linear velocity = ωRp = 0.34616 km/second Rm = 6364.033 km 1° of latitude = 111.0733 km