Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions geodepy/tests/test_transform.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import unittest

import numpy as np

from geodepy.transform import (
conform7,
conform14,
Expand Down Expand Up @@ -30,6 +32,19 @@ def test_conform7(self):
assert abs(alic_gda1994_comp[1] - alic_gda1994[1]) < 5e-5
assert abs(alic_gda1994_comp[2] - alic_gda1994[2]) < 5e-5

def test_conform7_covariance(self):
# ALIC coordinates from the GDA2020 Technical Manual, section 3.1.1.
alic_gda1994 = (-4052051.7643, 4212836.2017, -2545106.0245)
_, _, _, covariance = conform7(
*alic_gda1994, gda94_to_gda2020, vcv=np.eye(3) * 1e-4
)
expected = [
[1.007199e-4, -1.221569e-7, 7.888910e-8],
[-1.221569e-7, 1.006026e-4, -7.672700e-8],
[7.888910e-8, -7.672700e-8, 1.006438e-4],
]
np.testing.assert_allclose(covariance, expected, rtol=1e-6, atol=0)

def test_conform14(self):
# Replication of tests in GDA2020 Tech Manual v1.2 - Sect 3.3.1
alic_gda2020 = (-4052052.7373, 4212835.9835, -2545104.5867)
Expand Down
16 changes: 7 additions & 9 deletions geodepy/transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,17 +95,15 @@ def conform7(x, y, z, trans, vcv=None):
j_mat[2, 2] = scale

# XYZ rotated
j_mat[0, 3] = rot_xyz[0]
j_mat[1, 3] = rot_xyz[1]
j_mat[2, 3] = rot_xyz[2]
j_mat[:, 3] = rot_xyz[:, 0]

# scaled XYZ
j_mat[0, 5] = -scale * xyz_before[2]
j_mat[0, 6] = scale * xyz_before[1]
j_mat[1, 4] = scale * xyz_before[2]
j_mat[1, 6] = -scale * xyz_before[0]
j_mat[2, 4] = -scale * xyz_before[1]
j_mat[2, 5] = scale * xyz_before[0]
j_mat[0, 5] = -scale * xyz_before[2, 0]
j_mat[0, 6] = scale * xyz_before[1, 0]
j_mat[1, 4] = scale * xyz_before[2, 0]
j_mat[1, 6] = -scale * xyz_before[0, 0]
j_mat[2, 4] = -scale * xyz_before[1, 0]
j_mat[2, 5] = scale * xyz_before[0, 0]

# Identity
j_mat[0, 7] = 1
Expand Down