Skip to content

Commit 154efab

Browse files
committed
Added plate motion transformation function
1 parent 4693bd1 commit 154efab

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
@@ -147,6 +147,38 @@ def conform14(x, y, z, to_epoch, trans, vcv=None):
147147
xtrans, ytrans, ztrans, trans_vcv = conform7(x, y, z, timetrans, vcv=vcv)
148148
return xtrans, ytrans, ztrans, trans_vcv
149149

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

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

0 commit comments

Comments
 (0)