Python extension module with tools for easy handling of plate kinematic functions.
numpy = 1.20.1 gsl = 2.7.1
The extension modules are built from setup.py.
For a local rebuild on Windows from the repository root:
python -m pip install -U pip setuptools wheel numpy
python setup.py build_ext --inplaceIf GSL is not installed in the bundled local vcpkg path, point the build at a different GSL library directory first:
set PK_GSL_LIB_DIR=path\to\gsl\lib
python setup.py build_ext --inplaceIn this repository, the default local path expected by setup.py is:
src\vcpkg\installed\x64-windows\lib
The corresponding runtime DLLs are expected under:
src\vcpkg\installed\x64-windows\bin
platekinematics exports these main objects and functions directly:
Covariance(values=None)
valuesmust contain 6 floats ordered as[C11, C12, C13, C22, C23, C33]to_numpy()returns shape(6,)
FiniteRotation(Lon, Lat, Angle, Time, Covariance=None)
to_numpy()returns shape(4,)without covariance or(10,)with covariancebuild_array(n_size)returns sampled rotation matrices with shape(n_size, 3, 3)build_ensemble(n_size)returns a list of sampledFiniteRotationobjects
EulerVector(Lon, Lat, AngVelocity, TimeRange, Covariance=None)
TimeRangemust be a 2-item tuple of floatsto_numpy()returns shape(5,)without covariance or(11,)with covariancebuild_array(n_size, coordinate_system='cartesian')returns shape(3, n_size)build_ensemble(n_size)returns a list of sampledEulerVectorobjectscalculate_surface_velocity(point_lon, point_lat, n_size=100000)returns aSurfaceVelocityobject withStatfields when covariance is nonzero, otherwise float fields
Stat(mean, stdev) or Stat([mean, stdev])
- stores
MeanandStDev - useful for uncertain surface velocity components (see below)
SurfaceVelocity(Lon, Lat, TotalVel)
SurfaceVelocity(Lon, Lat, EastVel, NorthVel[, TotalVel[, Azimuth]])
EastVel,NorthVel,TotalVel, andAzimuthacceptfloat,Stat,None, or a 2-value array-like input interpreted as[Mean, StDev]LonandLatare stored in degrees-East and degrees-NorthEastVel,NorthVel, andTotalVelare conventially stored as cm/yrAzimuthis conventionally stored as clockwise degrees from North
average_fr(fr_ensemble, time=0.0)
- accepts either a list of
FiniteRotationobjects or a NumPy array of rotations matrices with shape(n_size, 3, 3) - returns one
FiniteRotation
average_ev(ev_ensemble, time_range=(0.0, 0.0))
- accepts either a list of
EulerVectorobjects or a NumPy array with shape(3, n_size)with columns longitude, latitude, angular velocity - returns one
EulerVector
calculate_surface_velocity(ev, point_lon, point_lat, n_size=100000)
calculate_surface_velocity(ev_ensemble, point_lon, point_lat)
- accepts either a list of
EulerVectorobjects
platekinematics.spherical_functions also provides:
to_degrees(angle_radians)to_radians(angle_degrees)sph2cart(lon, lat, magnitude)cart2sph(x, y, z)
After rebuilding, a minimal import check is:
python -c "from platekinematics import Covariance, FiniteRotation, EulerVector"