harmonica.create_ellipsoid

Contents

harmonica.create_ellipsoid#

harmonica.create_ellipsoid(a, b, c, *, center, yaw=0.0, pitch=0.0, roll=0.0, **kwargs)[source]#

Create an ellipsoid given its three semiaxes lenghts.

This function returns an ellipsoid object of the correct type based on the values of the three semiaxes lenghts. Semiaxes lengths can be passed in any order.

Parameters:
a, b, c: float

Semiaxes lenghts in meters. They can be passed in any particular order. They must all be positive values.

centertuple of float

Coordinates of the center of the ellipsoid in the following order: easting, northing, upward.

yawfloat, optional

Rotation angle about the upward axis, in degrees.

pitchfloat, optional

Rotation angle about the northing axis (after yaw rotation), in degrees. A positive pitch angle lifts the side of the ellipsoid pointing in easting direction.

rollfloat, optional

Rotation angle about the easting axis (after yaw and pitch rotation), in degrees.

**kwargsdict

Extra arguments passed to the ellipsoid classes. They can be physical properties like density, susceptibility, and remanent_mag.

Returns:
ellipsoidharmonica.typing.Ellipsoid

Instance of one of the ellipsoid classes: harmonica.OblateEllipsoid, harmonica.ProlateEllipsoid, harmonica.Sphere, or harmonica.TriaxialEllipsoid.

Examples

Define a prolate, oblate, triaxial or spherical ellipsoid by passing its semiaxes in any order:

>>> ellipsoid = create_ellipsoid(1, 1, 2, center=(1., 2., 3.))
>>> print(type(ellipsoid).__name__)
ProlateEllipsoid
>>> ellipsoid.a
2
>>> ellipsoid.b
1
>>> ellipsoid.c
1
>>> ellipsoid = create_ellipsoid(1, 2, 2, center=(1., 2., 3.))
>>> print(type(ellipsoid).__name__)
OblateEllipsoid
>>> ellipsoid.a
1
>>> ellipsoid.b
2
>>> ellipsoid.c
2
>>> ellipsoid = create_ellipsoid(1, 2, 3, center=(1., 2., 3.))
>>> print(type(ellipsoid).__name__)
TriaxialEllipsoid
>>> ellipsoid.a
3
>>> ellipsoid.b
2
>>> ellipsoid.c
1

We can specify rotation angles while creating the ellipsoid:

>>> ellipsoid = create_ellipsoid(1, 1, 2, yaw=85, pitch=32, center=(1., 2., 3.))
>>> ellipsoid.yaw
85
>>> ellipsoid.pitch
32

The function can also take physical properties:

>>> density, susceptibility = -200.0, 0.4
>>> ellipsoid = create_ellipsoid(
...     1, 1, 2, center=(1., 2., 3.),
...     density=density,
...     susceptibility=susceptibility,
... )