Skip to content

Commit 7991dc3

Browse files
authored
Merge pull request #162 from GeoscienceAustralia/plate_motion_func
Added plate motion transformation function
2 parents 82e877a + 154efab commit 7991dc3

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

geodepy/transform.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,38 @@ def conform14(x, y, z, to_epoch, trans, vcv=None):
146146
xtrans, ytrans, ztrans, trans_vcv = conform7(x, y, z, timetrans, vcv=vcv)
147147
return xtrans, ytrans, ztrans, trans_vcv
148148

149+
def plate_motion_transformation(x, y, z, from_epoch, to_epoch, plate_motion, vcv=None):
150+
"""
151+
Preforms plate motion transformations using a helmert 14 conformal transformation.
152+
153+
:param x: Cartesian X (m)
154+
:param y: Cartesian Y (m)
155+
:param z: Cartesian Z (m)
156+
:param from_epoch: Epoch the co-ordinate transformation is from (datetime.date Object)
157+
:param to_epoch: Epoch the co-ordinate transformation is to (datetime.date Object)
158+
:param plate_motion: Plate motion model for transformation
159+
:param vcv: Optional 3*3 numpy array in Cartesian units to propagate tf uncertainty
160+
:return: Cartesian X, Y, Z co-ordinates and vcv matrix transformed using plate motion to desired epoch
161+
"""
162+
if type(to_epoch) != datetime.date:
163+
raise ValueError("to_epoch must be a datetime.date Object")
164+
if type(from_epoch) != datetime.date:
165+
raise ValueError("from_epoch must be a datetime.date Object")
166+
if type(plate_motion) != Transformation:
167+
raise ValueError("plate_motion must be a Transformation Object")
168+
169+
#calculate number of years to be moved
170+
timediff= to_epoch - from_epoch
171+
172+
#calculate epoch needed for plate motion
173+
change_epoch = plate_motion.ref_epoch - timediff
174+
175+
# Calculate 7 Parameters from 14 Parameter Transformation Object
176+
timetrans = plate_motion + change_epoch
177+
178+
# Perform Transformation
179+
xtrans, ytrans, ztrans, trans_vcv = conform7(x, y, z, timetrans, vcv=vcv)
180+
return xtrans, ytrans, ztrans, trans_vcv
149181

150182
def transform_mga94_to_mga2020(zone, east, north, ell_ht=False, vcv=None):
151183
"""

0 commit comments

Comments
 (0)