From 9b6a94bd427f36e52e2123a5dc9c3268124f63ec Mon Sep 17 00:00:00 2001 From: Stefan Krebs Date: Tue, 2 Dec 2025 14:37:00 +0100 Subject: [PATCH 1/2] Swap wrong coordinate order from NEU to ENU in topocentric presenter In the output methods `create_geojson_file` and `as_markdown` there is an implicit assumption about the order of coordinates in the structure `self._data["residuals"]`. Proj outputs coordinates in ENU order, hence, the assumption has been changed accordingly. --- src/transformo/presenters/coordinates.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/transformo/presenters/coordinates.py b/src/transformo/presenters/coordinates.py index f0f173b..02c6b13 100644 --- a/src/transformo/presenters/coordinates.py +++ b/src/transformo/presenters/coordinates.py @@ -435,11 +435,11 @@ def create_geojson_file(self) -> None: # prepare data structure for feature in self._geojson_features: key = feature["properties"]["station"] - x, y, z, norm_2d, norm_3d = self._data["residuals"][key] + e, n, u, norm_2d, norm_3d = self._data["residuals"][key] - feature["properties"]["residual_n"] = x - feature["properties"]["residual_e"] = y - feature["properties"]["residual_u"] = z + feature["properties"]["residual_n"] = n + feature["properties"]["residual_e"] = e + feature["properties"]["residual_u"] = u feature["properties"]["residual_planar"] = norm_2d feature["properties"]["residual_total"] = norm_3d @@ -454,7 +454,7 @@ def create_geojson_file(self) -> None: def as_markdown(self) -> str: fmt = "< 10.3g" # three significant figures, could potentially be an option - header = ["Station", "North", "East", "Up", "Planar residual", "Total residual"] + header = ["Station", "East", "North", "Up", "Planar residual", "Total residual"] rows = [] for station, residuals in self._data["residuals"].items(): row = [station, *[format(r, fmt) for r in residuals]] @@ -472,7 +472,7 @@ def as_markdown(self) -> str: text += "\n\n### Residual statistics\n" - header = ["Measure", "North", "East", "Up", "Planar residual", "Total residual"] + header = ["Measure", "East", "North", "Up", "Planar residual", "Total residual"] rows = [] for measure, values in self._data["stats"].items(): row = [measure, *[format(v, fmt) for v in values]] From e75e9ad4df0108d0a04da28f120007e441a3b741 Mon Sep 17 00:00:00 2001 From: Stefan Krebs Date: Tue, 2 Dec 2025 14:52:11 +0100 Subject: [PATCH 2/2] Use `model` as topocentric origin in topocentric presenter This effectively means that ENU-residuals are now computed as residual = target - model which is the usual way, and what is in fact done in the rest of the code base. --- src/transformo/presenters/coordinates.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/transformo/presenters/coordinates.py b/src/transformo/presenters/coordinates.py index 02c6b13..94c2cdf 100644 --- a/src/transformo/presenters/coordinates.py +++ b/src/transformo/presenters/coordinates.py @@ -376,8 +376,8 @@ def evaluate( templist = [] for m, t in zip(model, target): - pipeline = f"+proj=topocentric +ellps=GRS80 +X_0={t[0]} +Y_0={t[1]} +Z_0={t[2]}" - enu_diffs = Transformer.from_projstring(pipeline).transform_one(m) + pipeline = f"+proj=topocentric +ellps=GRS80 +X_0={m[0]} +Y_0={m[1]} +Z_0={m[2]}" + enu_diffs = Transformer.from_projstring(pipeline).transform_one(t) templist.append(np.array(enu_diffs)) residuals = np.array(templist)