Abgabe fertig
This commit is contained in:
0
nicht abgeben/GHA_biaxial/__init__.py
Normal file
0
nicht abgeben/GHA_biaxial/__init__.py
Normal file
36
nicht abgeben/GHA_biaxial/bessel.py
Normal file
36
nicht abgeben/GHA_biaxial/bessel.py
Normal file
@@ -0,0 +1,36 @@
|
||||
from typing import Tuple
|
||||
|
||||
import scipy as sp
|
||||
from ellipsoid_biaxial import EllipsoidBiaxial
|
||||
from numpy import *
|
||||
|
||||
|
||||
def gha1(re: EllipsoidBiaxial, phi0: float, lamb0: float, alpha0:float, s: float) -> Tuple[float, float, float]:
|
||||
"""
|
||||
Berechnung der 1.GHA auf einem Rotationsellipsoid nach Bessel
|
||||
:param re:
|
||||
:param phi0:
|
||||
:param lamb0:
|
||||
:param alpha0:
|
||||
:param s:
|
||||
:return:
|
||||
"""
|
||||
psi0 = re.phi2psi(phi0)
|
||||
clairant = arcsin(cos(psi0) * sin(alpha0))
|
||||
sigma0 = arcsin(sin(psi0) / cos(clairant))
|
||||
|
||||
sqrt_sigma = lambda sigma: sqrt(1 + re.e_ ** 2 * cos(clairant) ** 2 * sin(sigma) ** 2)
|
||||
int_sqrt_sigma = lambda sigma: sp.integrate.quad(sqrt_sigma, sigma0, sigma)[0]
|
||||
|
||||
f_sigma1_i = lambda sigma1_i: (int_sqrt_sigma(sigma1_i) - s / re.b)
|
||||
|
||||
sigma1_0 = sigma0 + s / re.a
|
||||
sigma1 = sp.optimize.newton(f_sigma1_i, sigma1_0)
|
||||
psi1 = arcsin(cos(clairant) * sin(sigma1))
|
||||
phi1 = re.psi2phi(psi1)
|
||||
alpha1 = arcsin(sin(clairant) / cos(psi1))
|
||||
|
||||
f_d_lambda = lambda sigma: sin(clairant) * sqrt_sigma(sigma) / (1 - cos(clairant) ** 2 * sin(sigma) ** 2)
|
||||
d_lambda = sqrt(1-re.e**2) * sp.integrate.quad(f_d_lambda, sigma0, sigma1)[0]
|
||||
lamb1 = lamb0 + d_lambda
|
||||
return phi1, lamb1, alpha1
|
||||
101
nicht abgeben/GHA_biaxial/gauss.py
Normal file
101
nicht abgeben/GHA_biaxial/gauss.py
Normal file
@@ -0,0 +1,101 @@
|
||||
from typing import Tuple
|
||||
|
||||
from ellipsoid_biaxial import EllipsoidBiaxial
|
||||
from numpy import arctan, cos, sin, sqrt, tan
|
||||
|
||||
|
||||
def gha1(re: EllipsoidBiaxial, phi0: float, lamb0: float, alpha0: float, s: float, eps: float = 1e-12) -> Tuple[float, float, float]:
|
||||
"""
|
||||
Berechnung der 1. Geodätische Hauptaufgabe nach Gauß´schen Mittelbreitenformeln
|
||||
:param re: Klasse Ellipsoid
|
||||
:param phi0: Breite Punkt 0
|
||||
:param lamb0: Länge Punkt 0
|
||||
:param alpha0: Azimut der geodätischen Linie in Punkt 1
|
||||
:param s: Strecke zu Punkt 1
|
||||
:param eps: Abbruchkriterium für Winkelgrößen
|
||||
:return: Breite, Länge, Azimut von Punkt 21
|
||||
"""
|
||||
t = lambda phi: tan(phi)
|
||||
eta = lambda phi: sqrt(re.e_ ** 2 * cos(phi) ** 2)
|
||||
|
||||
F1 = lambda alpha, phi, s: 1 + (2 + 3 * t(phi) ** 2 + 2 * eta(phi) ** 2) / (24 * re.N(phi) ** 2) * sin(alpha) ** 2 * s ** 2 \
|
||||
+ (t(phi)**2 - 1) * eta(phi) ** 2 / (8 * re.N(phi) ** 2) * cos(alpha) ** 2 * s ** 2
|
||||
|
||||
F2 = lambda alpha, phi, s: 1 + t(phi) ** 2 / (24 * re.N(phi) ** 2) * sin(alpha) ** 2 * s ** 2 \
|
||||
- (1 + eta(phi)**2 - 9 * eta(phi)**2 * t(phi)**2) / (24 * re.N(phi) ** 2) * cos(alpha) ** 2 * s ** 2
|
||||
|
||||
F3 = lambda alpha, phi, s: 1 + (1 + eta(phi) ** 2) / (12 * re.N(phi) ** 2) * sin(alpha) ** 2 * s ** 2 \
|
||||
+ (3 + 8 * eta(phi)**2) / (24 * re.N(phi) ** 2) * cos(alpha) ** 2 * s ** 2
|
||||
|
||||
phi1_i = lambda alpha, phi: phi0 + cos(alpha) / re.M(phi) * s * F1(alpha, phi, s)
|
||||
lamb1_i = lambda alpha, phi: lamb0 + sin(alpha) / (re.N(phi) * cos(phi)) * s * F2(alpha, phi, s)
|
||||
alpha1_i = lambda alpha, phi: alpha0 + sin(alpha) * tan(phi) / re.N(phi) * s * F3(alpha, phi, s)
|
||||
|
||||
phi_m_i = lambda phi1: (phi0 + phi1) / 2
|
||||
alpha_m_i = lambda alpha1: (alpha0 + alpha1) / 2
|
||||
|
||||
phi_m = []
|
||||
alpha_m = []
|
||||
phi1 = []
|
||||
lamb1 = []
|
||||
alpha1 = []
|
||||
|
||||
# 1. Näherung für P1
|
||||
phi1.append(phi0 + cos(alpha0) / re.M(phi0) * s)
|
||||
lamb1.append(lamb0 + sin(alpha0) / (re.N(phi0) * cos(phi0)) * s)
|
||||
alpha1.append(alpha0 + sin(alpha0) * tan(phi0) / re.N(phi0) * s)
|
||||
|
||||
while True:
|
||||
# Berechnug P_m durch Mittelbildung
|
||||
phi_m.append(phi_m_i(phi1[-1]))
|
||||
alpha_m.append(alpha_m_i(alpha1[-1]))
|
||||
# Berechnung P1
|
||||
phi1.append(phi1_i(alpha_m[-1], phi_m[-1]))
|
||||
lamb1.append(lamb1_i(alpha_m[-1], phi_m[-1]))
|
||||
alpha1.append(alpha1_i(alpha_m[-1], phi_m[-1]))
|
||||
|
||||
# Abbruchkriterium
|
||||
if abs(phi1[-2] - phi1[-1]) < eps and \
|
||||
abs(lamb1[-2] - lamb1[-1]) < eps and \
|
||||
abs(alpha1[-2] - alpha1[-1]) < eps:
|
||||
break
|
||||
return phi1[-1], lamb1[-1], alpha1[-1]
|
||||
|
||||
|
||||
def gha2(re: EllipsoidBiaxial, phi0: float, lamb0: float, phi1: float, lamb1: float):
|
||||
"""
|
||||
Berechnung der 2. Geodätische Hauptaufgabe nach Gauß´schen Mittelbreitenformeln
|
||||
:param re: Klasse Ellipsoid
|
||||
:param phi0: Breite Punkt 1
|
||||
:param lamb0: Länge Punkt 1
|
||||
:param phi1: Breite Punkt 2
|
||||
:param lamb1: Länge Punkt 2
|
||||
:return: Länge der geodätischen Linie, Azimut von P1 nach P2, Azimut von P2 nach P1
|
||||
"""
|
||||
|
||||
t = lambda phi: tan(phi)
|
||||
eta = lambda phi: sqrt(re.e_ ** 2 * cos(phi) ** 2)
|
||||
|
||||
phi_0 = (phi0 + phi1) / 2
|
||||
d_phi = phi1 - phi0
|
||||
d_lambda = lamb1 - lamb0
|
||||
|
||||
f_A = lambda phi: (2 + 3*t(phi)**2 + 2*eta(phi)**2) / 24
|
||||
f_B = lambda phi: ((t(phi)**2 - 1) * eta(phi)**2) / 8
|
||||
# f_C = lambda phi: (t(phi)**2) / 24
|
||||
f_D = lambda phi: (1 + eta(phi)**2 - 9 * eta(phi)**2 * t(phi)**2) / 24
|
||||
|
||||
F1 = lambda phi: d_phi * re.M(phi) * (1 - f_A(phi) * d_lambda ** 2 * cos(phi) ** 2 -
|
||||
f_B(phi) * d_phi ** 2 / re.V(phi) ** 4)
|
||||
F2 = lambda phi: d_lambda * re.N(phi) * cos(phi) * (1 - 1 / 24 * d_lambda ** 2 * sin(phi) ** 2 +
|
||||
f_D(phi) * d_phi ** 2 / re.V(phi) ** 4)
|
||||
|
||||
s = sqrt(F1(phi_0) ** 2 + F2(phi_0) ** 2)
|
||||
A_0 = arctan(F2(phi_0) / F1(phi_0))
|
||||
d_A = d_lambda * sin(phi_0) * (1 + (1 + eta(phi_0) ** 2) / 12 * s ** 2 * sin(A_0) ** 2 / re.N(phi_0) ** 2 +
|
||||
(3 + 8 * eta(phi_0) ** 2) / 24 * s ** 2 * cos(A_0) ** 2 / re.N(phi_0) ** 2)
|
||||
|
||||
alpha0 = A_0 - d_A / 2
|
||||
alpha1 = A_0 + d_A / 2
|
||||
|
||||
return alpha0, alpha1, s
|
||||
33
nicht abgeben/GHA_biaxial/rk.py
Normal file
33
nicht abgeben/GHA_biaxial/rk.py
Normal file
@@ -0,0 +1,33 @@
|
||||
from typing import Tuple
|
||||
|
||||
import numpy as np
|
||||
from ellipsoid_biaxial import EllipsoidBiaxial
|
||||
from numpy import cos, sin, tan
|
||||
from numpy.typing import NDArray
|
||||
|
||||
import runge_kutta as rk
|
||||
|
||||
|
||||
def gha1(re: EllipsoidBiaxial, phi0: float, lamb0: float, alpha0: float, s: float, num: int) -> Tuple[float, float, float]:
|
||||
"""
|
||||
Berechnung der 1. GHA auf einem Rotationsellipsoid mittels RK4
|
||||
:param re:
|
||||
:param phi0:
|
||||
:param lamb0:
|
||||
:param alpha0:
|
||||
:param s:
|
||||
:param num:
|
||||
:return:
|
||||
"""
|
||||
def buildODE():
|
||||
def ODE(s: float, v: NDArray):
|
||||
phi, lam, A = v
|
||||
V = re.V(phi)
|
||||
dphi = cos(A) * V ** 3 / re.c
|
||||
dlam = sin(A) * V / (cos(phi) * re.c)
|
||||
dA = tan(phi) * sin(A) * V / re.c
|
||||
return np.array([dphi, dlam, dA])
|
||||
return ODE
|
||||
|
||||
_, funktionswerte = rk.rk4(buildODE(), 0, np.array([phi0, lamb0, alpha0]), s, num)
|
||||
return funktionswerte[-1][0], funktionswerte[-1][1], funktionswerte[-1][2]
|
||||
0
nicht abgeben/Tests/__init__.py
Normal file
0
nicht abgeben/Tests/__init__.py
Normal file
9253
nicht abgeben/Tests/algorithms_test.ipynb
Normal file
9253
nicht abgeben/Tests/algorithms_test.ipynb
Normal file
File diff suppressed because it is too large
Load Diff
101
nicht abgeben/Tests/alpha_conversion_test.ipynb
Normal file
101
nicht abgeben/Tests/alpha_conversion_test.ipynb
Normal file
@@ -0,0 +1,101 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"metadata": {},
|
||||
"cell_type": "code",
|
||||
"source": [
|
||||
"%load_ext autoreload\n",
|
||||
"%autoreload 2"
|
||||
],
|
||||
"id": "a78faf7f4883772f",
|
||||
"outputs": [],
|
||||
"execution_count": null
|
||||
},
|
||||
{
|
||||
"metadata": {},
|
||||
"cell_type": "code",
|
||||
"source": [
|
||||
"%reload_ext autoreload\n",
|
||||
"%autoreload 2\n",
|
||||
"import numpy as np\n",
|
||||
"\n",
|
||||
"import winkelumrechnungen as wu\n",
|
||||
"from GHA_triaxial.utils import alpha_ell2para, alpha_para2ell\n",
|
||||
"from ellipsoid_triaxial import EllipsoidTriaxial"
|
||||
],
|
||||
"id": "46aa84a937fea491",
|
||||
"outputs": [],
|
||||
"execution_count": null
|
||||
},
|
||||
{
|
||||
"metadata": {},
|
||||
"cell_type": "code",
|
||||
"source": [
|
||||
"ell = EllipsoidTriaxial.init_name(\"KarneyTest2024\")\n",
|
||||
"diffs = []\n",
|
||||
"for beta_deg in range(-90, 91, 15):\n",
|
||||
" for lamb_deg in range(-180, 180, 15):\n",
|
||||
" for alpha_deg in range(0, 360, 15):\n",
|
||||
" beta = wu.deg2rad(beta_deg)\n",
|
||||
" lamb = wu.deg2rad(lamb_deg)\n",
|
||||
" u, v = ell.ell2para(beta, lamb)\n",
|
||||
" alpha = wu.deg2rad(alpha_deg)\n",
|
||||
"\n",
|
||||
" alpha_para_1, *_ = alpha_ell2para(ell, beta, lamb, alpha)\n",
|
||||
" alpha_ell_1, *_ = alpha_para2ell(ell, u, v, alpha_para_1)\n",
|
||||
" diff_1 = wu.deg2rad(abs(alpha_ell_1 - alpha))/3600\n",
|
||||
"\n",
|
||||
" alpha_ell_2, *_ = alpha_para2ell(ell, u, v, alpha)\n",
|
||||
" alpha_para_2, *_ = alpha_ell2para(ell, beta, lamb, alpha_ell_2)\n",
|
||||
" diff_2 = wu.deg2rad(abs(alpha_para_2 - alpha))/3600\n",
|
||||
"\n",
|
||||
" diffs.append((beta_deg, lamb_deg, alpha_deg, diff_1, diff_2))\n",
|
||||
"diffs = np.array(diffs)"
|
||||
],
|
||||
"id": "82fc6cbbe7d5abcb",
|
||||
"outputs": [],
|
||||
"execution_count": null
|
||||
},
|
||||
{
|
||||
"metadata": {},
|
||||
"cell_type": "code",
|
||||
"source": [
|
||||
"i_max_ell = np.argmax(diffs[:, 3])\n",
|
||||
"max_ell = diffs[i_max_ell, 3]\n",
|
||||
"point_max_ell = diffs[i_max_ell, :3]\n",
|
||||
"\n",
|
||||
"i_max_para = np.argmax(diffs[:, 4])\n",
|
||||
"max_para = diffs[i_max_para, 4]\n",
|
||||
"point_max_para = diffs[i_max_para, :4]\n",
|
||||
"\n",
|
||||
"print(f'Für elliptisches Alpha = {point_max_ell[2]}° und beta = {point_max_ell[0]}°, lamb = {point_max_ell[1]}°: diff = {max_ell}\"')\n",
|
||||
"print(f'Für parametrisches Alpha = {point_max_para[2]}° und beta = {point_max_para[0]}°, lamb = {point_max_para[1]}°: diff = {max_ell}\"')\n",
|
||||
"pass"
|
||||
],
|
||||
"id": "97b5b8c9ca5377ab",
|
||||
"outputs": [],
|
||||
"execution_count": null
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Python 3",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
"language_info": {
|
||||
"codemirror_mode": {
|
||||
"name": "ipython",
|
||||
"version": 2
|
||||
},
|
||||
"file_extension": ".py",
|
||||
"mimetype": "text/x-python",
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython2",
|
||||
"version": "2.7.6"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 5
|
||||
}
|
||||
246
nicht abgeben/Tests/conversions_test.ipynb
Normal file
246
nicht abgeben/Tests/conversions_test.ipynb
Normal file
@@ -0,0 +1,246 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"metadata": {},
|
||||
"cell_type": "code",
|
||||
"source": [
|
||||
"%load_ext autoreload\n",
|
||||
"%autoreload 2"
|
||||
],
|
||||
"id": "746c5b9e4c0226e7",
|
||||
"outputs": [],
|
||||
"execution_count": null
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"id": "initial_id",
|
||||
"metadata": {
|
||||
"collapsed": true
|
||||
},
|
||||
"source": [
|
||||
"%reload_ext autoreload\n",
|
||||
"%autoreload 2\n",
|
||||
"from itertools import product\n",
|
||||
"\n",
|
||||
"import numpy as np\n",
|
||||
"import pandas as pd\n",
|
||||
"import plotly.graph_objects as go\n",
|
||||
"\n",
|
||||
"import winkelumrechnungen as wu\n",
|
||||
"from ellipsoid_triaxial import EllipsoidTriaxial"
|
||||
],
|
||||
"outputs": [],
|
||||
"execution_count": null
|
||||
},
|
||||
{
|
||||
"metadata": {},
|
||||
"cell_type": "code",
|
||||
"source": [
|
||||
"# ellips = \"KarneyTest2024\"\n",
|
||||
"ellips = \"BursaSima1980\"\n",
|
||||
"# ellips = \"Fiction\"\n",
|
||||
"ell: EllipsoidTriaxial = EllipsoidTriaxial.init_name(ellips)"
|
||||
],
|
||||
"id": "7b05ca89fcd7b331",
|
||||
"outputs": [],
|
||||
"execution_count": null
|
||||
},
|
||||
{
|
||||
"metadata": {},
|
||||
"cell_type": "code",
|
||||
"source": [
|
||||
"def deg_range(start, stop, step):\n",
|
||||
" return [float(x) for x in range(start, stop + step, step)]\n",
|
||||
"\n",
|
||||
"def asymptotic_range(start, direction=\"up\", max_decimals=4):\n",
|
||||
" values = []\n",
|
||||
" for d in range(0, max_decimals + 1):\n",
|
||||
" step = 10 ** -d\n",
|
||||
" if direction == \"up\":\n",
|
||||
" values.append(start + (1 - step))\n",
|
||||
" else:\n",
|
||||
" values.append(start - (1 - step))\n",
|
||||
" return values"
|
||||
],
|
||||
"id": "61a6b14fef0180ad",
|
||||
"outputs": [],
|
||||
"execution_count": null
|
||||
},
|
||||
{
|
||||
"metadata": {},
|
||||
"cell_type": "code",
|
||||
"source": [
|
||||
"beta_5_85 = deg_range(5, 85, 5)\n",
|
||||
"lambda_5_85 = deg_range(5, 85, 5)\n",
|
||||
"beta_5_90 = deg_range(5, 90, 5)\n",
|
||||
"lambda_5_90 = deg_range(5, 90, 5)\n",
|
||||
"beta_0_90 = deg_range(0, 90, 5)\n",
|
||||
"lambda_0_90 = deg_range(0, 90, 5)\n",
|
||||
"beta_90 = [90.0]\n",
|
||||
"lambda_90 = [90.0]\n",
|
||||
"beta_0 = [0.0]\n",
|
||||
"lambda_0 = [0.0]\n",
|
||||
"beta_asym_89 = asymptotic_range(89.0, direction=\"up\")\n",
|
||||
"lambda_asym_0 = asymptotic_range(1.0, direction=\"down\")"
|
||||
],
|
||||
"id": "f7184980a4b930b7",
|
||||
"outputs": [],
|
||||
"execution_count": null
|
||||
},
|
||||
{
|
||||
"metadata": {},
|
||||
"cell_type": "code",
|
||||
"source": [
|
||||
"groups = {\n",
|
||||
" 1: list(product(beta_5_85, lambda_5_85)),\n",
|
||||
" 2: list(product(beta_0, lambda_0_90)),\n",
|
||||
" 3: list(product(beta_5_85, lambda_0)),\n",
|
||||
" 4: list(product(beta_90, lambda_5_90)),\n",
|
||||
" 5: list(product(beta_asym_89, lambda_asym_0)),\n",
|
||||
" 6: list(product(beta_5_85, lambda_90)),\n",
|
||||
" 7: list(product(lambda_asym_0, lambda_0_90)),\n",
|
||||
" 8: list(product(beta_0_90, lambda_asym_0)),\n",
|
||||
" 9: list(product(beta_asym_89, lambda_0_90)),\n",
|
||||
" 10: list(product(beta_0_90, beta_asym_89)),\n",
|
||||
"}"
|
||||
],
|
||||
"id": "cea9fd9cce6a4fd1",
|
||||
"outputs": [],
|
||||
"execution_count": null
|
||||
},
|
||||
{
|
||||
"metadata": {},
|
||||
"cell_type": "code",
|
||||
"source": [
|
||||
"for nr, points in groups.items():\n",
|
||||
" points_cart = []\n",
|
||||
" for point in points:\n",
|
||||
" beta, lamb = point\n",
|
||||
" cart = ell.ell2cart(wu.deg2rad(beta), wu.deg2rad(lamb))\n",
|
||||
" points_cart.append(cart)\n",
|
||||
" groups[nr] = points_cart"
|
||||
],
|
||||
"id": "17a6a130782a89ce",
|
||||
"outputs": [],
|
||||
"execution_count": null
|
||||
},
|
||||
{
|
||||
"metadata": {},
|
||||
"cell_type": "code",
|
||||
"source": [
|
||||
"results = {}\n",
|
||||
"\n",
|
||||
"for nr, points in groups.items():\n",
|
||||
" group_results = {\"ell\": [],\n",
|
||||
" \"para\": [],\n",
|
||||
" \"geod\": []}\n",
|
||||
" for point in points:\n",
|
||||
" elli = ell.cart2ell(point)\n",
|
||||
" cart_elli = ell.ell2cart(elli[0], elli[1])\n",
|
||||
" group_results[\"ell\"].append(np.linalg.norm(point - cart_elli, axis=-1))\n",
|
||||
"\n",
|
||||
" para = ell.cart2para(point)\n",
|
||||
" cart_para = ell.para2cart(para[0], para[1])\n",
|
||||
" group_results[\"para\"].append(np.linalg.norm(point - cart_para, axis=-1))\n",
|
||||
"\n",
|
||||
" geod = ell.cart2geod(point, \"ligas3\")\n",
|
||||
" cart_geod = ell.geod2cart(geod[0], geod[1], geod[2])\n",
|
||||
" group_results[\"geod\"].append(np.linalg.norm(point - cart_geod, axis=-1))\n",
|
||||
"\n",
|
||||
" group_results[\"ell\"] = np.array(group_results[\"ell\"])\n",
|
||||
" group_results[\"para\"] = np.array(group_results[\"para\"])\n",
|
||||
" group_results[\"geod\"] = np.array(group_results[\"geod\"])\n",
|
||||
" results[nr] = group_results"
|
||||
],
|
||||
"id": "c3298ea233bca274",
|
||||
"outputs": [],
|
||||
"execution_count": null
|
||||
},
|
||||
{
|
||||
"metadata": {},
|
||||
"cell_type": "code",
|
||||
"source": [
|
||||
"# with open(f\"conversion_results_{ellips}.pkl\", \"wb\") as f:\n",
|
||||
"# pickle.dump(results, f)"
|
||||
],
|
||||
"id": "e1285860be416ad3",
|
||||
"outputs": [],
|
||||
"execution_count": null
|
||||
},
|
||||
{
|
||||
"metadata": {},
|
||||
"cell_type": "code",
|
||||
"source": [
|
||||
"# with open(f\"conversion_results_{ellips}.pkl\", \"rb\") as f:\n",
|
||||
"# results = pickle.load(f)"
|
||||
],
|
||||
"id": "d26720e34595ccbc",
|
||||
"outputs": [],
|
||||
"execution_count": null
|
||||
},
|
||||
{
|
||||
"metadata": {},
|
||||
"cell_type": "code",
|
||||
"source": [
|
||||
"df = pd.DataFrame({\n",
|
||||
" \"Gruppe\": [nr for nr in results.keys()],\n",
|
||||
" \"max_Δr_ell\": [f\"{max(result[\"ell\"]):.3g}\" for result in results.values()],\n",
|
||||
" \"max_Δr_para\": [f\"{max(result[\"para\"]):.3g}\" for result in results.values()],\n",
|
||||
" \"max_Δr_geod\": [f\"{max(result[\"geod\"]):.3g}\" for result in results.values()]\n",
|
||||
"})"
|
||||
],
|
||||
"id": "4e2e55e4699ec81e",
|
||||
"outputs": [],
|
||||
"execution_count": null
|
||||
},
|
||||
{
|
||||
"metadata": {},
|
||||
"cell_type": "code",
|
||||
"source": [
|
||||
"fig = go.Figure(data=[go.Table(\n",
|
||||
" header=dict(\n",
|
||||
" values=list(df.columns),\n",
|
||||
" fill_color=\"lightgrey\",\n",
|
||||
" align=\"left\"\n",
|
||||
" ),\n",
|
||||
" cells=dict(\n",
|
||||
" values=[df[col] for col in df.columns],\n",
|
||||
" align=\"left\"\n",
|
||||
" )\n",
|
||||
")])\n",
|
||||
"fig.update_layout(\n",
|
||||
" template=\"simple_white\",\n",
|
||||
" width=650,\n",
|
||||
" height=len(groups)*20+80,\n",
|
||||
" margin=dict(l=20, r=20, t=20, b=20))\n",
|
||||
"\n",
|
||||
"fig.show()\n",
|
||||
"# fig.write_image(f\"conversion_results_{ellips}.png\", width=650, height=len(groups)*20+80, scale=2)"
|
||||
],
|
||||
"id": "c2fa82afef2d6e0e",
|
||||
"outputs": [],
|
||||
"execution_count": null
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Python 3",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
"language_info": {
|
||||
"codemirror_mode": {
|
||||
"name": "ipython",
|
||||
"version": 2
|
||||
},
|
||||
"file_extension": ".py",
|
||||
"mimetype": "text/x-python",
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython2",
|
||||
"version": "2.7.6"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 5
|
||||
}
|
||||
BIN
nicht abgeben/Tests/gha_resultsKarney.pkl
Normal file
BIN
nicht abgeben/Tests/gha_resultsKarney.pkl
Normal file
Binary file not shown.
BIN
nicht abgeben/Tests/gha_resultsPanou.pkl
Normal file
BIN
nicht abgeben/Tests/gha_resultsPanou.pkl
Normal file
Binary file not shown.
BIN
nicht abgeben/Tests/gha_resultsRandom.pkl
Normal file
BIN
nicht abgeben/Tests/gha_resultsRandom.pkl
Normal file
Binary file not shown.
BIN
nicht abgeben/Tests/gha_resultsRandom_num.pkl
Normal file
BIN
nicht abgeben/Tests/gha_resultsRandom_num.pkl
Normal file
Binary file not shown.
0
nicht abgeben/__init__.py
Normal file
0
nicht abgeben/__init__.py
Normal file
126
nicht abgeben/ellipsoid_biaxial.py
Normal file
126
nicht abgeben/ellipsoid_biaxial.py
Normal file
@@ -0,0 +1,126 @@
|
||||
from typing import Tuple
|
||||
|
||||
import numpy as np
|
||||
from numpy import arctan2, cos, sin, sqrt
|
||||
from numpy.typing import NDArray
|
||||
|
||||
import winkelumrechnungen as wu
|
||||
|
||||
|
||||
class EllipsoidBiaxial:
|
||||
"""
|
||||
Klasse für Rotationsellipdoide
|
||||
"""
|
||||
def __init__(self, a: float, b: float):
|
||||
self.a = a
|
||||
self.b = b
|
||||
self.c = a ** 2 / b
|
||||
self.e = sqrt(a ** 2 - b ** 2) / a
|
||||
self.e_ = sqrt(a ** 2 - b ** 2) / b
|
||||
|
||||
@classmethod
|
||||
def init_name(cls, name: str) -> EllipsoidBiaxial:
|
||||
"""
|
||||
Erstellen eines Rotationsellipdoids nach Namen
|
||||
:param name: Name des Rotationsellipsoids
|
||||
:return: Rotationsellipsoid
|
||||
"""
|
||||
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)
|
||||
else:
|
||||
raise Exception(f"EllipsoidBiaxial.init_name: Name {name} unbekannt")
|
||||
|
||||
@classmethod
|
||||
def init_af(cls, a: float, f: float) -> EllipsoidBiaxial:
|
||||
"""
|
||||
Erstellen eines Rotationsellipdoids aus der großen Halbachse und der Abplattung
|
||||
:param a: große Halbachse
|
||||
:param f: großen Halbachse
|
||||
:return: Rotationsellipsoid
|
||||
"""
|
||||
b = a - a * f
|
||||
return cls(a, b)
|
||||
|
||||
V = lambda self, phi: sqrt(1 + self.e_ ** 2 * 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: arctan2(self.a * sin(beta), self.b * cos(beta))
|
||||
beta2phi = lambda self, beta: arctan2(self.a ** 2 * sin(beta), self.b ** 2 * cos(beta))
|
||||
|
||||
psi2beta = lambda self, psi: arctan2(self.b * sin(psi), self.a * cos(psi))
|
||||
psi2phi = lambda self, psi: arctan2(self.a * sin(psi), self.b * cos(psi))
|
||||
|
||||
phi2beta = lambda self, phi: arctan2(self.b**2 * sin(phi), self.a**2 * cos(phi))
|
||||
phi2psi = lambda self, phi: arctan2(self.b * sin(phi), self.a * cos(phi))
|
||||
|
||||
phi2p = lambda self, phi: self.N(phi) * cos(phi)
|
||||
|
||||
def bi_cart2ell(self, point: NDArray, Eh: float = 0.001, Ephi: float = wu.gms2rad([0, 0, 0.001])) -> Tuple[float, float, float]:
|
||||
"""
|
||||
Umrechnung von kartesischen in ellipsoidische Koordinaten auf einem Rotationsellipsoid
|
||||
# TODO: Quelle
|
||||
:param point: Punkt in kartesischen Koordinaten
|
||||
:param Eh: Grenzwert für die Höhe
|
||||
:param Ephi: Grenzwert für die Breite
|
||||
:return: ellipsoidische Breite, Länge, geodätische Höhe
|
||||
"""
|
||||
x, y, z = point
|
||||
|
||||
lamb = arctan2(y, x)
|
||||
|
||||
p = sqrt(x**2+y**2)
|
||||
|
||||
phi_null = arctan2(z, p*(1 - self.e**2))
|
||||
|
||||
hi = [0]
|
||||
phii = [phi_null]
|
||||
|
||||
i = 0
|
||||
|
||||
while True:
|
||||
N = self.a / sqrt(1 - self.e**2 * sin(phii[i])**2)
|
||||
h = p / cos(phii[i]) - N
|
||||
phi = arctan2(z, p * (1-(self.e**2*N) / (N+h)))
|
||||
hi.append(h)
|
||||
phii.append(phi)
|
||||
dh = abs(hi[i]-h)
|
||||
dphi = abs(phii[i]-phi)
|
||||
i += 1
|
||||
if dh < Eh:
|
||||
if dphi < Ephi:
|
||||
break
|
||||
return phi, lamb, h
|
||||
|
||||
def bi_ell2cart(self, phi: float, lamb: float, h: float) -> NDArray:
|
||||
"""
|
||||
Umrechnung von ellipsoidischen in kartesische Koordinaten auf einem Rotationsellipsoid
|
||||
# TODO: Quelle
|
||||
:param phi: ellipsoidische Breite
|
||||
:param lamb: ellipsoidische Länge
|
||||
:param h: geodätische Höhe
|
||||
:return: Punkt in kartesischen Koordinaten
|
||||
"""
|
||||
W = sqrt(1 - self.e**2 * sin(phi)**2)
|
||||
N = self.a / W
|
||||
x = (N+h) * cos(phi) * cos(lamb)
|
||||
y = (N+h) * cos(phi) * sin(lamb)
|
||||
z = (N * (1-self.e**2) + h) * sin(phi)
|
||||
return np.array([x, y, z])
|
||||
100
nicht abgeben/kugel.py
Normal file
100
nicht abgeben/kugel.py
Normal file
@@ -0,0 +1,100 @@
|
||||
from typing import Tuple
|
||||
|
||||
import numpy as np
|
||||
from numpy import arccos, arcsin, arctan2, cos, pi, sin, sqrt
|
||||
from numpy.typing import NDArray
|
||||
|
||||
import winkelumrechnungen as wu
|
||||
|
||||
|
||||
def cart2sph(point: NDArray) -> Tuple[float, float, float]:
|
||||
"""
|
||||
Umrechnung von kartesischen in sphärische Koordinaten
|
||||
# TODO: Quelle
|
||||
:param point: Punkt in kartesischen Koordinaten
|
||||
:return: Radius, Breite, Länge
|
||||
"""
|
||||
x, y, z = point
|
||||
r = sqrt(x**2 + y**2 + z**2)
|
||||
phi = arctan2(z, sqrt(x**2 + y**2))
|
||||
lamb = arctan2(y, x)
|
||||
|
||||
return r, phi, lamb
|
||||
|
||||
|
||||
def sph2cart(r: float, phi: float, lamb: float) -> NDArray:
|
||||
"""
|
||||
Umrechnung von sphärischen in kartesische Koordinaten
|
||||
# TODO: Quelle
|
||||
:param r: Radius
|
||||
:param phi: Breite
|
||||
:param lamb: Länge
|
||||
:return: Punkt in kartesischen Koordinaten
|
||||
"""
|
||||
x = r * cos(phi) * cos(lamb)
|
||||
y = r * cos(phi) * sin(lamb)
|
||||
z = r * sin(phi)
|
||||
|
||||
return np.array([x, y, z])
|
||||
|
||||
|
||||
def gha1(R: float, phi0: float, lamb0: float, s: float, alpha0: float) -> Tuple[float, float]:
|
||||
"""
|
||||
Berechnung der 1. GHA auf der Kugel
|
||||
# TODO: Quelle
|
||||
:param R: Radius
|
||||
:param phi0: Breite des Startpunktes
|
||||
:param lamb0: Länge des Startpunktes
|
||||
:param s: Strecke
|
||||
:param alpha0: Azimut
|
||||
:return: Breite, Länge des Zielpunktes
|
||||
"""
|
||||
s_ = s / R
|
||||
|
||||
lamb1 = lamb0 + arctan2(sin(s_) * sin(alpha0),
|
||||
cos(phi0) * cos(s_) - sin(phi0) * sin(s_) * cos(alpha0))
|
||||
|
||||
phi1 = arcsin(sin(phi0) * cos(s_) + cos(phi0) * sin(s_) * cos(alpha0))
|
||||
|
||||
return phi1, lamb1
|
||||
|
||||
|
||||
def gha2(R: float, phi0: float, lamb0: float, phi1: float, lamb1: float) -> Tuple[float, float, float]:
|
||||
"""
|
||||
Berechnung der 2. GHA auf der Kugel
|
||||
# TODO: Quelle
|
||||
:param R: Radius
|
||||
:param phi0: Breite des Startpunktes
|
||||
:param lamb0: Länge des Startpunktes
|
||||
:param phi1: Breite des Zielpunktes
|
||||
:param lamb1: Länge des Zielpunktes
|
||||
:return: Azimut im Startpunkt, Azimut im Zielpunkt, Strecke
|
||||
"""
|
||||
s_ = arccos(sin(phi0) * sin(phi1) + cos(phi0) * cos(phi1) * cos(lamb1 - lamb0))
|
||||
s = R * s_
|
||||
|
||||
alpha0 = arctan2(cos(phi1) * sin(lamb1 - lamb0),
|
||||
cos(phi0) * sin(phi1) - sin(phi0) * cos(phi1) * cos(lamb1 - lamb0))
|
||||
|
||||
alpha1 = arctan2(-cos(phi0) * sin(lamb1 - lamb0),
|
||||
cos(phi1) * sin(phi0) - sin(phi1) * cos(phi0) * cos(lamb1 - lamb0))
|
||||
if alpha1 < 0:
|
||||
alpha1 += 2 * pi
|
||||
|
||||
return alpha0, alpha1, s
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
R = 6378815.904 # Bern
|
||||
phi0 = wu.deg2rad(10)
|
||||
lamb0 = wu.deg2rad(40)
|
||||
alpha0 = wu.deg2rad(100)
|
||||
s = 10000
|
||||
phi1, lamb1 = gha1(R, phi0, lamb0, s, alpha0)
|
||||
alpha0_g, alpha1, s_g = gha2(R, phi0, lamb0, phi1, lamb1)
|
||||
phi1 = wu.rad2deg(phi1)
|
||||
lamb1 = wu.rad2deg(lamb1)
|
||||
alpha0_g = wu.rad2deg(alpha0_g)
|
||||
alpha1 = wu.rad2deg(alpha1)
|
||||
|
||||
pass
|
||||
3654
nicht abgeben/plots.ipynb
Normal file
3654
nicht abgeben/plots.ipynb
Normal file
File diff suppressed because one or more lines are too long
8
nicht abgeben/test.py
Normal file
8
nicht abgeben/test.py
Normal file
@@ -0,0 +1,8 @@
|
||||
import numpy as np
|
||||
|
||||
import ellipsoid_triaxial
|
||||
|
||||
ell = ellipsoid_triaxial.EllipsoidTriaxial.init_name("KarneyTest2024")
|
||||
|
||||
cart = ell.para2cart(0, np.pi/2)
|
||||
print(cart)
|
||||
Reference in New Issue
Block a user