CNSG - Calculate the Observer's Position Using Stanley Gery's Method
Description: Stanley Gery's Method uses two sights to calculate the observer's position from two circles of equal altitude. It gives two solutions, the choice of which is made by inspection (or a third sight). The solutions are exact if the sights are simultaneous.
Inputs:
| GHA1 | GHA of the celestial object from sight 1 |
| Dec1 | Declination of the celestial object from sight 1 |
| H1 | Height/Altitude of the celestial object from sight 1 |
| 1st Observation | East (E) or West (W) of the observer's meridian - case insensitive |
| GHA2 | GHA of the celestial object from sight 2 |
| Dec2 | Declination of the celestial object from sight 2 |
| H2 | Height/Altitude of the celestial object from sight 2 |
Outputs:
| Lat1 | The latitude of the first point of intersection of the two circles |
| Lon1 | The longitude of the first point of intersection of the two circles |
| Lat2 | The latitude of the second point of intersection of the two circles |
| Lon2 | The longitude of the second point of intersection of the two circles |
Sample execution:
GHA1? 29,30.4 Dec1? -11,17 H1? 31,19 1st observation E or W? e GHA2? 129,34.6 Dec2? -16,45 H2? 22,48.4 Lat1: 25° 54.7' Lon1: -76° 10.7' Lat2: -66° 38.4' Lon2: -58° 29.2'
(For explanation of notation, conventions etc, see python-programs).
Copyright (C) 2024 Ian Staniforth
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see
https://www.gnu.org/licenses/.
# CNSG - Calculate a fix from 2 Sights using Gery's method
from math import *
from CN_LIB import *
# First sight
gha1 = stod("GHA1? ")
dec1 = stod("Dec1? ")
h1 = stod("H1? ")
ew = input("1st observation E or W? ")
# Second sight
gha2 = stod("GHA2? ")
dec2 = stod("Dec2? ")
h2 = stod("H2? ")
# Polar triangle - calculate z12 and angle A
z12 = aCos(Sin(dec1)*Sin(dec2)+Cos(dec1)*Cos(dec2)*Cos(gha1-gha2))
A = aCos((Sin(dec2)-Cos(z12)*Sin(dec1))/(Cos(dec1)*Sin(z12)))
# Zenith triangle - calculate angle B
B = aCos((Sin(h2)-Sin(h1)*Cos(z12))/(Cos(h1)*Sin(z12)))
# Calculate parallatic angles X1 and X2
X1 = A-B
X2 = A+B
# Calculate latitudes lat1 and lat2 from PZX triangles
lat1 = aSin(Sin(dec1)*Sin(h1)+Cos(dec1)*Cos(h1)*Cos(X1))
lat2 = aSin(Sin(dec1)*Sin(h1)+Cos(dec1)*Cos(h1)*Cos(X2))
# Calculate PZX angles P1 and P2 and hence longitudes lon1 and lon2
p1 = aCos((Sin(h1)-Sin(lat1)*Sin(dec1))/(Cos(lat1)*Cos(dec1)))
if ew.lower().startswith("e"): p1 = 360-p1
lon1 = p1-gha1
if lon1 > 180: lon1-= 360
if lon1 < -180: lon1+= 360
p2 = aCos((Sin(h1)-Sin(lat2)*Sin(dec1))/(Cos(lat2)*Cos(dec1)))
if ew.lower().startswith("e"): p2 = 360-p2
lon2 = p2-gha1
if lon2 > 180: lon2-= 360
if lon2 < -180: lon2+= 360
print("")
print("Lat1: "+dtos(lat1))
print("Lon1: "+dtos(lon1))
print("")
print("Lat2: "+dtos(lat2))
print("Lon2: "+dtos(lon2))