Meine alten Sachen aus RALV
This commit is contained in:
83
ellipsoide.py
Normal file
83
ellipsoide.py
Normal file
@@ -0,0 +1,83 @@
|
||||
import numpy as np
|
||||
import winkelumrechnungen as wu
|
||||
import ausgaben as aus
|
||||
|
||||
|
||||
class Ellipsoid:
|
||||
def __init__(self, a: float, b: float):
|
||||
self.a = a
|
||||
self.b = b
|
||||
self.c = a ** 2 / b
|
||||
self.e = np.sqrt(a ** 2 - b ** 2) / a
|
||||
self.e_ = np.sqrt(a ** 2 - b ** 2) / b
|
||||
|
||||
@classmethod
|
||||
def init_name(cls, name: str):
|
||||
if name == "Bessel":
|
||||
a = 6377397.15508
|
||||
b = 6356078.96290
|
||||
return cls(a, b)
|
||||
elif name == "Hayford":
|
||||
a = 6378388
|
||||
f = 1/297
|
||||
b = a - a * f
|
||||
return cls(a, b)
|
||||
elif name == "Krassowski":
|
||||
a = 6378245
|
||||
f = 298.3
|
||||
b = a - a * f
|
||||
return cls(a, b)
|
||||
elif name == "WGS84":
|
||||
a = 6378137
|
||||
f = 298.257223563
|
||||
b = a - a * f
|
||||
return cls(a, b)
|
||||
|
||||
@classmethod
|
||||
def init_af(cls, a: float, f: float):
|
||||
b = a - a * f
|
||||
return cls(a, b)
|
||||
|
||||
V = lambda self, phi: np.sqrt(1 + self.e_ ** 2 * np.cos(phi) ** 2)
|
||||
M = lambda self, phi: self.c / self.V(phi) ** 3
|
||||
N = lambda self, phi: self.c / self.V(phi)
|
||||
|
||||
beta2psi = lambda self, beta: np.arctan(self.a / self.b * np.tan(beta))
|
||||
beta2phi = lambda self, beta: np.arctan(self.a ** 2 / self.b ** 2 * np.tan(beta))
|
||||
|
||||
psi2beta = lambda self, psi: np.arctan(self.b / self.a * np.tan(psi))
|
||||
psi2phi = lambda self, psi: np.arctan(self.a / self.b * np.tan(psi))
|
||||
|
||||
phi2beta = lambda self, phi: np.arctan(self.b ** 2 / self.a ** 2 * np.tan(phi))
|
||||
phi2psi = lambda self, phi: np.arctan(self.b / self.a * np.tan(phi))
|
||||
|
||||
phi2p = lambda self, phi: self.N(phi) * np.cos(phi)
|
||||
|
||||
def ellipsoidische_Koords (self, Eh, Ephi, x, y, z):
|
||||
p = np.sqrt(x**2+y**2)
|
||||
print(f"p = {round(p, 5)} m")
|
||||
|
||||
lamb = np.arctan(y/x)
|
||||
|
||||
phi_null = np.arctan(z/p*(1-self.e**2)**-1)
|
||||
|
||||
hi = [0]
|
||||
phii = [phi_null]
|
||||
|
||||
i = 0
|
||||
|
||||
while True:
|
||||
N = self.a*(1-self.e**2*np.sin(phii[i])**2)**(-1/2)
|
||||
h = p/np.cos(phii[i])-N
|
||||
phi = np.arctan(z/p*(1-(self.e**2*N)/(N+h))**(-1))
|
||||
hi.append(h)
|
||||
phii.append(phi)
|
||||
dh = abs(hi[i]-h)
|
||||
dphi = abs(phii[i]-phi)
|
||||
i = i+1
|
||||
if dh < Eh:
|
||||
if dphi < Ephi:
|
||||
break
|
||||
for i in range(len(phii)):
|
||||
print(f"P3[{i}]: {aus.gms('phi', phii[i], 5)}\th = {round(hi[i], 5)} m")
|
||||
return phi, lamb, h
|
||||
Reference in New Issue
Block a user