Peano
Loading...
Searching...
No Matches
TestEllipsoidProjectionInverse.py
Go to the documentation of this file.
1import Wrapper
2import numpy as np
3from pyproj import Transformer
4import MyAssert
5
6# 1. Gitter in lon/lat erzeugen
7lons = np.linspace(-98, -70, 1000)
8lats = np.linspace(15, 35, 1000)
9LON, LAT = np.meshgrid(lons, lats)
10
11# 2. Albers-Projektion (WGS84 → AEA)
12proj_str = "+proj=aea +lon_0=-84 +lat_1=18.3333333 +lat_2=31.6666667 +lat_0=25 +datum=WGS84 +units=m +no_defs"
13transformer = Transformer.from_crs("EPSG:4326", proj_str, always_xy=True)
14X, Y = transformer.transform(LON, LAT) # in Meter
15
16# 3. Inverse Projektion mit deiner Funktion `Z(x, y)` → gibt vermutlich (lon, lat)
17# Wenn Z nur `lat` zurückgibt, dann:
18lon_reconstructed = np.vectorize(
19 lambda x, y: Wrapper.ellipsoidTransformInverse(x, y).first
20)(X, Y)
21
22lon_diff = lon_reconstructed - LON
24
25lat_reconstructed = np.vectorize(
26 lambda x, y: Wrapper.ellipsoidTransformInverse(x, y).second
27)(X, Y)
28
29lat_diff = lat_reconstructed - LAT
test_array_within_threshold(arr, lower_threshold=-1e-8, upper_threshold=1e-8)
Definition MyAssert.py:1
ellipsoidTransformInverse
Definition Wrapper.py:35