# Paleocurrent/dip direction reconstruction

**URL:** https://discourse.gplates.org/t/paleocurrent-dip-direction-reconstruction/417
**Category:** Misc
**Created:** [21 October 2021 12:27 UTC](https://discourse.gplates.org/t/paleocurrent-dip-direction-reconstruction/417 "2021-10-21T12:27:08Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![john.cannon](https://discourse.gplates.org/letter_avatar_proxy/v4/letter/j/3e96dc/32.png) [@john.cannon](https://discourse.gplates.org/u/john.cannon)
#### Post date: [22 October 2021 01:11 UTC](https://discourse.gplates.org/t/paleocurrent-dip-direction-reconstruction/417/2 "2021-10-22T01:11:16Z")

</div>

That’s a pretty inventive solution for using GPlates 👍

For pyGPlates users out there this could be done with something like…

Use [pygplates.LocalCartesian](https://protect-au.mimecast.com/s/Ku0cCjZ1N7inz0A60Fjx8wr?domain=gplates.org) to convert your direction into a [pygplates.Vector3D](https://protect-au.mimecast.com/s/iPBUCk81N9tODv4LvsN-4K3?domain=gplates.org) - for example to convert an azimuth direction at a specific latitude/longitude location to its equivalent 3D vector (in global x/y/z space). Then rotate that 3D vector using the reconstruction rotation in the form of a [pygplates.FiniteRotation](https://protect-au.mimecast.com/s/4Sp0Clx1Nji2Wlk9lSj6cN0?domain=gplates.org) (obtained from a [pygplates.RotationModel](https://protect-au.mimecast.com/s/jf8XCmO5glujVq60qhLvpSv?domain=gplates.org)). Then convert back again to a paleo-direction using pygplates.LocalCartesian to convert the rotated 3D vector and the rotated location back to a paleo-azimuth.

The following example shows how to do this:

```python
import math
import pygplates

# Initial location.
lat, lon = 10, 20
# Initial direction - azimuth is angle clockwise (East-wise) from North
direction_azimuth = 90 # East
# Plate ID to reconstruct with (or assign plate ID using pygplates.PlatePartitioner).
plate_id = 701
# Time to reconstruct to.
time = 100

rotation_model = pygplates.RotationModel(...)
rotation = rotation_model.get_rotation(time, plate_id)

# Initial location and direction.
location = pygplates.PointOnSphere(lat, lon)
cartesian = pygplates.LocalCartesian(location)
direction_vector = cartesian.from_magnitude_azimuth_inclination_to_geocentric(
    (1, math.radians(direction_azimuth), 0))

# Paleo location and direction.
paleo_location = rotation * location
paleo_direction_vector = rotation * direction_vector

# Extract paleo direction azimuth from paleo direction vector and location.
paleo_cartesian = pygplates.LocalCartesian(paleo_location)
_, paleo_direction_azimuth, _ = paleo_cartesian.from_geocentric_to_magnitude_azimuth_inclination(
    paleo_direction_vector)
paleo_direction_azimuth = math.degrees(paleo_direction_azimuth)

```

---

_[View the full topic](https://discourse.gplates.org/t/paleocurrent-dip-direction-reconstruction/417)._
