Package pygeodesy3 :: Package maths
[frames] | no frames]

Package maths

Precision mathematical classes and functions.


Version: 23.12.18

Submodules

Classes
  AuxAngle
An accurate representation of angles
  AuxBeta
A Parametric, Auxiliary latitude.
  AuxChi
A Conformal, Auxiliary latitude.
  AuxDLat
Class to compute Divided Differences of Auxiliary latitudes and other Divided Differences needed for RhumbAux and RhumbLineAux calculations.
  AuxDST
Discrete Sine Transforms (DST) for Auxiliary latitudes.
  AuxError
Error raised for an Aux, AuxDLat, AuxLat or rhumb.aux_ issue.
  AuxLat
Base class for accurate conversion between Auxiliary latitudes on an ellipsoid.
  AuxMu
A Rectifying, Auxiliary latitude.
  AuxPhi
A Geodetic or Geographic, Auxiliary latitude.
  AuxTheta
A Geocentric, Auxiliary latitude.
  AuxXi
An Authalic, Auxiliary latitude.
  Circin6Tuple
6-Tuple (radius, center, deltas, cA, cB, cC) with the radius, the trilaterated center and contact points of the inscribed aka In- circle of a triangle.
  Circum3Tuple
3-Tuple (radius, center, deltas) with the circumradius and trilaterated circumcenter of the circumcircle through 3 points (aka {Meeus}' Type II circle) or the radius and center of the smallest Meeus' Type I circle.
  Circum4Tuple
4-Tuple (radius, center, rank, residuals) with radius and center of a sphere least-squares fitted through given points and the rank and residuals -if any- from numpy.linalg.lstsq.
  Elliptic
Elliptic integrals and functions.
  Elliptic3Tuple
3-Tuple (sn, cn, dn) all scalar.
  EllipticError
Elliptic function, integral, convergence or other Elliptic issue.
  Fcbrt
Precision cubic root of summation.
  Fcook
Cook's RunningStats computing the running mean, median and (sample) kurtosis, skewness, variance, standard deviation and Jarque-Bera normality.
  Fdot
Precision dot product.
  Fhorner
Precision polynomial evaluation using the Horner form.
  Fhypot
Precision hypotenuse of summation.
  Flinear
Cook's RunningRegression computing the running slope, intercept and correlation of a linear regression.
  Fn_rt
Precision n-th root of summation.
  Fpolynomial
Precision polynomial evaluation.
  Fpowers
Precision summation or powers, optimized for power=2.
  Fsqrt
Precision square root of summation.
  Fsum
Precision floating point running summation.
  Fsum2Tuple
2-Tuple (fsum, residual) with the precision running fsum and the residual, the sum of the remaining partials.
  Fwelford
Welford's accumulator computing the running mean, (sample) variance and standard deviation.
  Meeus2Tuple
2-Tuple (radius, Type) with radius and Meeus' Type of the smallest circle containing 3 points.
  Radii11Tuple
11-Tuple (rA, rB, rC, cR, rIn, riS, roS, a, b, c, s) with the Tangent circle radii rA, rB and rC, the circumradius cR, the Incircle radius rIn aka inradius, the inner and outer Soddy circle radii riS and roS, the sides a, b and c and semi-perimeter s of a triangle, all in meter conventionally.
  ResidualError
Error raised for an operation involving a pygeodesy3.sums.Fsum instance with a non-zero residual, integer or otherwise.
  Soddy4Tuple
4-Tuple (radius, center, deltas, outer) with radius and (trilaterated) center of the inner Soddy circle and the radius of the outer Soddy circle.
  Vector3d
Extended 3-D vector.
Functions
 
NM2m(nm)
Convert nautical miles to meter (m).
 
SM2m(sm)
Convert statute miles to meter (m).
 
SinCos2(x)
Get sin and cos of typed angle.
 
acos1(x)
Return math.acos(max(-1, min(1, x))).
 
acre2ha(acres)
Convert acres to hectare.
 
acre2m2(acres)
Convert acres to square meter.
 
asin1(x)
Return math.asin(max(-1, min(1, x))).
 
atan1(y, x=1.0)
Return atan(y / x) angle in radians [-PI/2..+PI/2] using atan2 for consistency and to avoid ZeroDivisionError.
 
atan1d(y, x=1.0)
Return atan(y / x) angle in degrees [-90..+90] using atan2d for consistency and to avoid ZeroDivisionError.
 
atan2b(y, x)
Return atan2(y, x) in degrees [0..+360].
 
atan2d(y, x, reverse=False)
Return atan2(y, x) in degrees [-180..+180], optionally reversed (by 180 degrees for azimuths).
 
bqrt(x)
Return the 4-th, bi-quadratic or quartic root, x**(1 / 4).
 
cbrt(x)
Compute the cube root x**(1/3).
 
cbrt2(x)
Compute the cube root squared x**(2/3).
 
chain2m(chains)
Convert UK chains to meter.
 
circin6(point1, point2, point3, eps=8.881784197001252e-16, useZ=True)
Return the radius and center of the inscribed aka Incircle of a (2- or 3-D) triangle.
 
circle4(earth, lat)
Get the equatorial or a parallel circle of latitude.
 
circum3(point1, point2, point3, circum=True, eps=8.881784197001252e-16, useZ=True)
Return the radius and center of the smallest circle through or containing three (2- or 3-D) points.
 
circum4_(*points, **useZ_Vector_and_kwds)
Best-fit a sphere through three or more (3-D) points.
 
cot(rad, **error_kwds)
Return the cotangent of an angle in radians.
 
cot_(*rads, **error_kwds)
Return the cotangent of angle(s) in radiansresection.
 
cotd(deg, **error_kwds)
Return the cotangent of an angle in degrees.
 
cotd_(*degs, **error_kwds)
Return the cotangent of angle(s) in degrees.
 
degrees(x)
Convert angle x from radians to degrees.
 
degrees180(rad)
Convert radians to degrees and wrap [-180..+180).
 
degrees2grades(deg)
Convert degrees to grades (aka gons or gradians).
 
degrees2m(deg, radius=6371008.771415, lat=0)
Convert an angle to a distance along the equator or along the parallel at an other (geodetic) latitude.
 
degrees360(rad)
Convert radians to degrees and wrap [0..+360).
 
degrees90(rad)
Convert radians to degrees and wrap [-90..+90).
 
euclid(x, y)
Appoximate the norm sqrt(x**2 + y**2) by max(abs(x), abs(y)) + min(abs(x), abs(y)) * 0.4142....
 
euclid_(*xs)
Appoximate the norm sqrt(sum(x**2 for x in xs)) by cascaded euclid.
 
facos1(x)
Fast approximation of pygeodesy3.acos1(x).
 
fasin1(x)
Fast approximation of pygeodesy3.asin1(x).
 
fatan(x)
Fast approximation of atan(x).
 
fatan1(x)
Fast approximation of atan(x) for 0 <= x <= 1, unchecked.
 
fatan2(y, x)
Fast approximation of atan2(y, x).
 
fathom2m(fathoms)
Convert Imperial fathom to meter.
 
favg(v1, v2, f=0.5)
Return the average of two values.
 
fdot(a, *b)
Return the precision dot product sum(a[i] * b[i] for i=0..len(a)).
 
fdot3(a, b, c, start=0)
Return the precision dot product start + sum(a[i] * b[i] * c[i] for i=0..len(a)).
 
fhorner(x, *cs)
Evaluate the polynomial sum(cs[i] * x**i for i=0..len(cs)) using the Horner form.
 
fidw(xs, ds, beta=2)
Interpolate using Inverse Distance Weighting (IDW).
 
fmean(xs)
Compute the accurate mean sum(xs[i] for i=0..len(xs)) / len(xs).
 
fmean_(*xs)
Compute the accurate mean sum(xs[i] for i=0..len(xs)) / len(xs).
 
fpolynomial(x, *cs, **over)
Evaluate the polynomial sum(cs[i] * x**i for i=0..len(cs)) [/ over].
 
fpowers(x, n, alts=0)
Return a series of powers [x**i for i=1..n].
 
fprod(xs, start=1)
Iterable product, like math.prod or numpy.prod.
 
frange(start, number, step=1)
Generate a range of floats.
value
freduce(function, sequence, initial=...)
Apply a function of two arguments cumulatively to the items of a sequence, from left to right, so as to reduce the sequence to a single value.
 
fremainder(x, y)
Remainder in range [-y / 2, y / 2].
 
fsum(xs, floats=False)
Precision floating point summation based on or like Python's math.fsum.
 
fsum1(xs, floats=False)
Precision floating point summation of a few arguments, 1-primed.
 
fsum1_(*xs, **floats)
Precision floating point summation of a few arguments, 1-primed.
 
fsum1f_(*xs)
Precision floating point summation fsum1_(*xs, floats=True).
 
fsum_(*xs, **floats)
Precision floating point summation of all positional arguments.
 
fsumf_(*xs)
Precision floating point summation fsum_(*xs, floats=True).
 
ft2m(feet, usurvey=False, pied=False, fuss=False)
Convert International, US Survey, French or German feet to meter.
 
furlong2m(furlongs)
Convert a furlong to meter.
 
grades(rad)
Convert radians to grades (aka gons or gradians).
 
grades2degrees(gon)
Convert grades (aka gons or gradians) to degrees.
 
grades2radians(gon)
Convert grades (aka gons or gradians) to radians.
 
grades400(rad)
Convert radians to grades (aka gons or gradians) and wrap [0..+400).
 
hypot(x, y)
Return the Euclidean distance, sqrt(x*x + y*y).
 
hypot1(x)
Compute the norm sqrt(1 + x**2).
 
hypot2(x, y)
Compute the squared norm x**2 + y**2.
 
hypot2_(*xs)
Compute the squared norm sum(x**2 for x in xs).
 
hypot_(*xs)
Compute the norm sqrt(sum(x**2 for x in xs)).
 
intersection3d3(start1, end1, start2, end2, eps=2.220446049250313e-16, useZ=True, **Vector_and_kwds)
Compute the intersection point of two (2- or 3-D) lines, each defined by two points or by a point and a bearing.
 
iscolinearWith(point, point1, point2, eps=2.220446049250313e-16, useZ=True)
Check whether a point is colinear with two other (2- or 3-D) points.
 
km2m(km)
Convert kilo meter to meter (m).
 
m2NM(meter)
Convert meter to nautical miles (NM).
 
m2SM(meter)
Convert meter to statute miles (SM).
 
m2chain(meter)
Convert meter to UK chains.
 
m2degrees(distance, radius=6371008.771415, lat=0)
Convert a distance to an angle along the equator or along the parallel at an other (geodetic) latitude.
 
m2fathom(meter)
Convert meter to Imperial fathoms.
 
m2ft(meter, usurvey=False, pied=False, fuss=False)
Convert meter to International, US Survey, French or or German feet (ft).
 
m2furlong(meter)
Convert meter to furlongs.
 
m2km(meter)
Convert meter to kilo meter (Km).
 
m2radians(distance, radius=6371008.771415, lat=0)
Convert a distance to an angle along the equator or along the parallel at an other (geodetic) latitude.
 
m2toise(meter)
Convert meter to French toises.
 
m2yard(meter)
Convert meter to UK yards.
 
meeus2(point1, point2, point3, circum=False, useZ=True)
Return the radius and Meeus' Type of the smallest circle through or containing three (2- or 3-D) points.
 
nearestOn(point, point1, point2, within=True, useZ=True, Vector=None, **Vector_kwds)
Locate the point between two points closest to a reference (2- or 3-D).
 
nearestOn6(point, points, closed=False, useZ=True, **Vector_and_kwds)
Locate the point on a path or polygon closest to a reference point.
 
norm2(x, y)
Normalize a 2-dimensional vector.
 
norm_(*xs)
Normalize all n-dimensional vector components.
 
parse3d(str3d, sep=',', Vector=<class 'pygeodesy3.maths.vector3d.Vector3d'>, **Vector_kwds)
Parse an "x, y, z" string.
 
radians(x)
Convert angle x from degrees to radians.
 
radians2m(rad, radius=6371008.771415, lat=0)
Convert an angle to a distance along the equator or along the parallel at an other (geodetic) latitude.
 
radiansPI(deg)
Convert and wrap degrees to radians [-PI..+PI].
 
radiansPI2(deg)
Convert and wrap degrees to radians [0..+2PI).
 
radiansPI_2(deg)
Convert and wrap degrees to radians [-3PI/2..+PI/2].
 
radii11(point1, point2, point3, useZ=True)
Return the radii of the In-, Soddy and Tangent circles of a (2- or 3-D) triangle.
 
sincos2(rad)
Return the sine and cosine of an angle in radians.
 
sincos2_(*rads)
Return the sine and cosine of angle(s) in radians.
 
sincos2d(deg, **adeg)
Return the sine and cosine of an angle in degrees.
 
sincos2d_(*degs)
Return the sine and cosine of angle(s) in degrees.
 
sincostan3(rad)
Return the sine, cosine and tangent of an angle in radians.
 
soddy4(point1, point2, point3, eps=8.881784197001252e-16, useZ=True)
Return the radius and center of the inner Soddy circle of a (2- or 3-D) triangle.
 
sqrt0(x, Error=None)
Return the square root iff x > EPS02.
 
sqrt3(x)
Return the square root, cubed sqrt(x)**3 or sqrt(x**3).
 
sqrt_a(h, b)
Compute a side of a right-angled triangle from sqrt(h**2 - b**2).
 
tanPI_2_2(rad)
Compute the tangent of half angle, 90 degrees rotated.
 
tan_2(rad, **semi)
Compute the tangent of half angle.
 
tand(deg, **error_kwds)
Return the tangent of an angle in degrees.
 
tand_(*degs, **error_kwds)
Return the tangent of angle(s) in degrees.
 
toise2m(toises)
Convert French toises to meter.
 
trilaterate2d2(x1, y1, radius1, x2, y2, radius2, x3, y3, radius3, eps=None, **Vector_and_kwds)
Trilaterate three circles, each given as a (2-D) center and a radius.
 
trilaterate3d2(center1, radius1, center2, radius2, center3, radius3, eps=2.220446049250313e-16, **Vector_and_kwds)
Trilaterate three spheres, each given as a (3-D) center and a radius.
 
truncate(x, ndigits=None)
Truncate to the given number of digits.
 
unroll180(lon1, lon2, wrap=True)
Unroll longitudinal delta and wrap longitude in degrees.
 
unrollPI(rad1, rad2, wrap=True)
Unroll longitudinal delta and wrap longitude in radians.
 
wrap180(deg)
Wrap degrees to [-180..+180].
 
wrap360(deg)
Wrap degrees to [0..+360).
 
wrap90(deg)
Wrap degrees to [-90..+90].
 
wrapPI(rad)
Wrap radians to [-PI..+PI].
 
wrapPI2(rad)
Wrap radians to [0..+2PI).
 
wrapPI_2(rad)
Wrap radians to [-PI/2..+PI/2].
 
wrap_normal(*normal)
Define the operation for the keyword argument wrap=True, across pygeodesy3: wrap, normalize or no-op.
 
yard2m(yards)
Convert UK yards to meter.
 
zcrt(x)
Return the 6-th, zenzi-cubic root, x**(1 / 6).
 
zqrt(x)
Return the 8-th, zenzi-quartic or squared-quartic root, x**(1 / 8).
Variables
  __getattr__ = _lazy_import_as(__name__)
  Aux = Aux()
Function Details

NM2m (nm)

 

Convert nautical miles to meter (m).

Arguments:
  • nm - Value in nautical miles (scalar).
Returns:
Value in meter (float).
Raises:
  • ValueError - Invalid nm.

SM2m (sm)

 

Convert statute miles to meter (m).

Arguments:
  • sm - Value in statute miles (scalar).
Returns:
Value in meter (float).
Raises:
  • ValueError - Invalid sm.

SinCos2 (x)

 

Get sin and cos of typed angle.

Arguments:
Returns:
2-Tuple (sin(x), cos(x)).

acre2ha (acres)

 

Convert acres to hectare.

Arguments:
  • acres - Value in acres (scalar).
Returns:
Value in hectare (float).
Raises:
  • ValueError - Invalid acres.

acre2m2 (acres)

 

Convert acres to square meter.

Arguments:
  • acres - Value in acres (scalar).
Returns:
Value in meter^2 (float).
Raises:
  • ValueError - Invalid acres.

atan1d (y, x=1.0)

 

Return atan(y / x) angle in degrees [-90..+90] using atan2d for consistency and to avoid ZeroDivisionError.

See Also: Function pygeodesy3.atan2d.

atan2b (y, x)

 

Return atan2(y, x) in degrees [0..+360].

See Also: Function pygeodesy3.atan2d.

atan2d (y, x, reverse=False)

 

Return atan2(y, x) in degrees [-180..+180], optionally reversed (by 180 degrees for azimuths).

See Also: Karney's C++ function Math.atan2d.

bqrt (x)

 

Return the 4-th, bi-quadratic or quartic root, x**(1 / 4).

Arguments:
  • x - Value (scalar).
Returns:
Quartic root (float).
Raises:
  • ValueError - Negative x.

See Also: Functions zcrt and zqrt.

cbrt (x)

 

Compute the cube root x**(1/3).

Arguments:
  • x - Value (scalar).
Returns:
Cubic root (float).

See Also: Functions cbrt2 and sqrt3.

cbrt2 (x)

 

Compute the cube root squared x**(2/3).

Arguments:
  • x - Value (scalar).
Returns:
Cube root squared (float).

See Also: Functions cbrt and sqrt3.

chain2m (chains)

 

Convert UK chains to meter.

Arguments:
  • chains - Value in chains (scalar).
Returns:
Value in meter (float).
Raises:
  • ValueError - Invalid chains.

circin6 (point1, point2, point3, eps=8.881784197001252e-16, useZ=True)

 

Return the radius and center of the inscribed aka Incircle of a (2- or 3-D) triangle.

Arguments:
  • point1 - First point (Cartesian, Vector3d, Vector3Tuple, Vector4Tuple or Vector2Tuple if useZ=False).
  • point2 - Second point (Cartesian, Vector3d, Vector3Tuple, Vector4Tuple or Vector2Tuple if useZ=False).
  • point3 - Third point (Cartesian, Vector3d, Vector3Tuple, Vector4Tuple or Vector2Tuple if useZ=False).
  • eps - Tolerance for function pygeodesy3.trilaterate3d2 if useZ is True else pygeodesy3.trilaterate2d2.
  • useZ - If True, use the Z components, otherwise force z=INT0 (bool).
Returns:
Circin6Tuple(radius, center, deltas, cA, cB, cC). The center and contact points cA, cB and cC, each an instance of point1's (sub-)class, are co-planar with the three given points.
Raises:
  • ImportError - Package numpy not found, not installed or older than version 1.10 and useZ is True.
  • IntersectionError - Near-coincident or -colinear points or a trilateration or numpy issue.
  • TypeError - Invalid point1, point2 or point3.

See Also: Functions radii11 and circum3, Contact Triangle and Incircle.

circle4 (earth, lat)

 

Get the equatorial or a parallel circle of latitude.

Arguments:
Returns:
A Circle4Tuple(radius, height, lat, beta) instance.
Raises:

circum3 (point1, point2, point3, circum=True, eps=8.881784197001252e-16, useZ=True)

 

Return the radius and center of the smallest circle through or containing three (2- or 3-D) points.

Arguments:
  • point1 - First point (Cartesian, Vector3d, Vector3Tuple or Vector4Tuple).
  • point2 - Second point (Cartesian, Vector3d, Vector3Tuple or Vector4Tuple).
  • point3 - Third point (Cartesian, Vector3d, Vector3Tuple or Vector4Tuple).
  • circum - If True return the circumradius and circumcenter always, ignoring the Meeus' Type I case (bool).
  • eps - Tolerance for function pygeodesy3.trilaterate3d2 if useZ is True else pygeodesy3.trilaterate2d2.
  • useZ - If True, use the Z components, otherwise force z=INT0 (bool).
Returns:
A Circum3Tuple(radius, center, deltas). The center, an instance of point1's (sub-)class, is co-planar with the three given points.
Raises:
  • ImportError - Package numpy not found, not installed or older than version 1.10 and useZ is True.
  • IntersectionError - Near-coincident or -colinear points or a trilateration or numpy issue.
  • TypeError - Invalid point1, point2 or point3.

See Also: Functions pygeodesy3.circum4_ and pygeodesy3.meeus2 and Meeus, J. Astronomical Algorithms, 2nd Ed. 1998, page 127ff, circumradius and circumcircle.

circum4_ (*points, **useZ_Vector_and_kwds)

 

Best-fit a sphere through three or more (3-D) points.

Arguments:
  • points - The points (each a Cartesian, Vector3d, Vector3Tuple, or Vector4Tuple).
  • useZ_Vector_and_kwds - Keyword arguments useZ=True (bool) to use the Z components, otherwise force all z=INT0, class Vector=None to return the center point with optionally, additional nVector keyword arguments, otherwise the first points' (sub-)class is used.
Returns:
Circum4Tuple(radius, center, rank, residuals) with center an instance of points[0]' (sub-)class or Vector if specified.
Raises:
  • ImportError - Package numpy not found, not installed or older than version 1.10.
  • NumPyError - Some numpy issue.
  • PointsError - Too few points.
  • TypeError - One of the points is invalid.

See Also: Functions pygeodesy3.circum3 and pygeodesy3.meeus2, Jekel, Charles F. Least Squares Sphere Fit Sep 13, 2015, Appendix A, numpy.linalg.lstsq and Eberly 6.

cot (rad, **error_kwds)

 

Return the cotangent of an angle in radians.

Arguments:
  • rad - Angle (radians).
  • error_kwds - Error to raise (ValueError).
Returns:
cot(rad).
Raises:

cot_ (*rads, **error_kwds)

 

Return the cotangent of angle(s) in radiansresection.

Arguments:
  • rads - One or more angles (radians).
  • error_kwds - Error to raise (ValueError).
Returns:
Yield the cot(rad) for each angle.
Raises:

cotd (deg, **error_kwds)

 

Return the cotangent of an angle in degrees.

Arguments:
  • deg - Angle (degrees).
  • error_kwds - Error to raise (ValueError).
Returns:
cot(deg).
Raises:

cotd_ (*degs, **error_kwds)

 

Return the cotangent of angle(s) in degrees.

Arguments:
  • degs - One or more angles (degrees).
  • error_kwds - Error to raise (ValueError).
Returns:
Yield the cot(deg) for each angle.
Raises:

degrees180 (rad)

 

Convert radians to degrees and wrap [-180..+180).

Arguments:
  • rad - Angle (radians).
Returns:
Angle, wrapped (degrees180).

degrees2grades (deg)

 

Convert degrees to grades (aka gons or gradians).

Arguments:
  • deg - Angle (degrees).
Returns:
Angle (grades).

degrees2m (deg, radius=6371008.771415, lat=0)

 

Convert an angle to a distance along the equator or along the parallel at an other (geodetic) latitude.

Arguments:
  • deg - The angle (degrees).
  • radius - Mean earth radius, ellipsoid or datum (meter, Ellipsoid, Ellipsoid2, Datum or a_f2Tuple).
  • lat - Parallel latitude (degrees90, str).
Returns:
Distance (meter, same units as radius or equatorial and polar radii) or 0.0 for near-polar lat.
Raises:
  • RangeError - Latitude lat outside valid range and pygeodesy3.rangerrors set to True.
  • TypeError - Invalid radius.
  • ValueError - Invalid deg, radius or lat.

See Also: Function radians2m and m2degrees.

degrees360 (rad)

 

Convert radians to degrees and wrap [0..+360).

Arguments:
  • rad - Angle (radians).
Returns:
Angle, wrapped (degrees360).

degrees90 (rad)

 

Convert radians to degrees and wrap [-90..+90).

Arguments:
  • rad - Angle (radians).
Returns:
Angle, wrapped (degrees90).

euclid (x, y)

 

Appoximate the norm sqrt(x**2 + y**2) by max(abs(x), abs(y)) + min(abs(x), abs(y)) * 0.4142....

Arguments:
  • x - X component (scalar).
  • y - Y component (scalar).
Returns:
Appoximate norm (float).

See Also: Function euclid_.

euclid_ (*xs)

 

Appoximate the norm sqrt(sum(x**2 for x in xs)) by cascaded euclid.

Arguments:
  • xs - X arguments, positional (scalars).
Returns:
Appoximate norm (float).

See Also: Function euclid.

facos1 (x)

 

Fast approximation of pygeodesy3.acos1(x).

See Also: ShaderFastLibs.h.

fasin1 (x)

 

Fast approximation of pygeodesy3.asin1(x).

See Also: facos1.

fatan1 (x)

 

Fast approximation of atan(x) for 0 <= x <= 1, unchecked.

See Also: ShaderFastLibs.h and Efficient approximations for the arctangent function, IEEE Signal Processing Magazine, 111, May 2006.

fatan2 (y, x)

 

Fast approximation of atan2(y, x).

fathom2m (fathoms)

 

Convert Imperial fathom to meter.

Arguments:
  • fathoms - Value in fathoms (scalar).
Returns:
Value in meter (float).
Raises:
  • ValueError - Invalid fathoms.

See Also: Function toise2m, Fathom and Klafter.

favg (v1, v2, f=0.5)

 

Return the average of two values.

Arguments:
  • v1 - One value (scalar).
  • v2 - Other value (scalar).
  • f - Optional fraction (float).
Returns:
v1 + f * (v2 - v1) (float).

fdot (a, *b)

 

Return the precision dot product sum(a[i] * b[i] for i=0..len(a)).

Arguments:
  • a - Iterable, list, tuple, etc. (scalars).
  • b - All positional arguments (scalars).
Returns:
Dot product (float).
Raises:

See Also: Class Fdot and Algorithm 5.10 DotK.

fdot3 (a, b, c, start=0)

 

Return the precision dot product start + sum(a[i] * b[i] * c[i] for i=0..len(a)).

Arguments:
  • a - Iterable, list, tuple, etc. (scalars).
  • b - Iterable, list, tuple, etc. (scalars).
  • c - Iterable, list, tuple, etc. (scalars).
  • start - Optional bias (scalar).
Returns:
Dot product (float).
Raises:
  • LenError - Unequal len(a), len(b) and/or len(c).
  • OverflowError - Partial 2sum overflow.

fhorner (x, *cs)

 

Evaluate the polynomial sum(cs[i] * x**i for i=0..len(cs)) using the Horner form.

Arguments:
  • x - Polynomial argument (scalar).
  • cs - Polynomial coeffients (scalars).
Returns:
Horner value (float).
Raises:
  • OverflowError - Partial 2sum overflow.
  • TypeError - Non-scalar x.
  • ValueError - No cs coefficients or x is not finite.

See Also: Function fpolynomial and class Fhorner.

fidw (xs, ds, beta=2)

 

Interpolate using Inverse Distance Weighting (IDW).

Arguments:
  • xs - Known values (scalars).
  • ds - Non-negative distances (scalars).
  • beta - Inverse distance power (int, 0, 1, 2, or 3).
Returns:
Interpolated value x (float).
Raises:
  • LenError - Unequal or zero len(ds) and len(xs).
  • ValueError - Invalid beta, negative ds value, weighted ds below EPS.

Note: Using beta=0 returns the mean of xs.

fmean (xs)

 

Compute the accurate mean sum(xs[i] for i=0..len(xs)) / len(xs).

Arguments:
  • xs - Values (scalar or Fsum instances).
Returns:
Mean value (float).
Raises:
  • OverflowError - Partial 2sum overflow.
  • ValueError - No xs values.

fmean_ (*xs)

 

Compute the accurate mean sum(xs[i] for i=0..len(xs)) / len(xs).

Arguments:
  • xs - Values (scalar or Fsum instances).
Returns:
Mean value (float).
Raises:
  • OverflowError - Partial 2sum overflow.
  • ValueError - No xs values.

fpolynomial (x, *cs, **over)

 

Evaluate the polynomial sum(cs[i] * x**i for i=0..len(cs)) [/ over].

Arguments:
  • x - Polynomial argument (scalar).
  • cs - Polynomial coeffients (scalars), all positional.
  • over - Optional, final divisor (scalar
Returns:
Polynomial value (float).
Raises:
  • OverflowError - Partial 2sum overflow.
  • TypeError - Non-scalar x.
  • ValueError - No cs coefficients or x is not finite.

See Also: Function fhorner and class Fpolynomial.

fpowers (x, n, alts=0)

 

Return a series of powers [x**i for i=1..n].

Arguments:
  • x - Value (scalar).
  • n - Highest exponent (int).
  • alts - Only alternating powers, starting with this exponent (int).
Returns:
Powers of x (floats or ints).
Raises:
  • TypeError - Non-scalar x or n not int.
  • ValueError - Non-finite x or non-positive n.

fprod (xs, start=1)

 

Iterable product, like math.prod or numpy.prod.

Arguments:
  • xs - Terms to be multiplied, an iterable, list, tuple, etc. (scalars).
  • start - Initial term, also the value returned for an empty xs (scalar).
Returns:
The product (float).

See Also: NumPy.prod.

frange (start, number, step=1)

 

Generate a range of floats.

Arguments:
  • start - First value (float).
  • number - The number of floats to generate (int).
  • step - Increment value (float).
Returns:
A generator (floats).

See Also: NumPy.prod.

freduce (function, sequence, initial=...)

 

Apply a function of two arguments cumulatively to the items of a sequence, from left to right, so as to reduce the sequence to a single value. For example, reduce(lambda x, y: x+y, [1, 2, 3, 4, 5]) calculates ((((1+2)+3)+4)+5). If initial is present, it is placed before the items of the sequence in the calculation, and serves as a default when the sequence is empty.

Returns: value

fremainder (x, y)

 

Remainder in range [-y / 2, y / 2].

Arguments:
  • x - Numerator (scalar).
  • y - Modulus, denominator (scalar).
Returns:
Remainder (scalar, preserving signed 0.0) or NAN for any non-finite x.
Raises:
  • ValueError - Infinite or near-zero y.

See Also: Karney's Math.remainder and Python 3.7+ math.remainder.

fsum (xs, floats=False)

 

Precision floating point summation based on or like Python's math.fsum.

Arguments:
  • xs - Iterable, list, tuple, etc. of values (scalar or Fsum instances).
  • floats - Optionally, use floats=True iff all xs are known to be float.
Returns:
Precision fsum (float).
Raises:
  • OverflowError - Partial 2sum overflow.
  • TypeError - Non-scalar xs value.
  • ValueError - Invalid or non-finite xs value.

Note: Exceptions and non-finite handling may differ if not based on Python's math.fsum.

See Also: Class Fsum and methods Fsum.fsum and Fsum.fadd.

fsum1 (xs, floats=False)

 

Precision floating point summation of a few arguments, 1-primed.

Arguments:
  • xs - Iterable, list, tuple, etc. of values (scalar or Fsum instances).
  • floats - Optionally, use floats=True iff all xs are known to be float.
Returns:
Precision fsum (float).

See Also: Function fsum.

fsum1_ (*xs, **floats)

 

Precision floating point summation of a few arguments, 1-primed.

Arguments:
  • xs - Values to be added (scalar or Fsum instances), all positional.
  • floats - Optionally, use floats=True iff all xs are known to be float.
Returns:
Precision fsum (float).

See Also: Function fsum

fsum_ (*xs, **floats)

 

Precision floating point summation of all positional arguments.

Arguments:
  • xs - Values to be added (scalar or Fsum instances), all positional.
  • floats - Optionally, use floats=True iff all xs are known to be float.
Returns:
Precision fsum (float).

See Also: Function fsum.

ft2m (feet, usurvey=False, pied=False, fuss=False)

 

Convert International, US Survey, French or German feet to meter.

Arguments:
  • feet - Value in feet (scalar).
  • usurvey - If True, convert US Survey foot else ...
  • pied - If True, convert French pied-du-Roi else ...
  • fuss - If True, convert German Fuss, otherwise International foot to meter.
Returns:
Value in meter (float).
Raises:
  • ValueError - Invalid feet.

furlong2m (furlongs)

 

Convert a furlong to meter.

Arguments:
  • furlongs - Value in furlongs (scalar).
Returns:
Value in meter (float).
Raises:
  • ValueError - Invalid furlongs.

grades (rad)

 

Convert radians to grades (aka gons or gradians).

Arguments:
  • rad - Angle (radians).
Returns:
Angle (grades).

grades2degrees (gon)

 

Convert grades (aka gons or gradians) to degrees.

Arguments:
  • gon - Angle (grades).
Returns:
Angle (degrees).

grades2radians (gon)

 

Convert grades (aka gons or gradians) to radians.

Arguments:
  • gon - Angle (grades).
Returns:
Angle (radians).

grades400 (rad)

 

Convert radians to grades (aka gons or gradians) and wrap [0..+400).

Arguments:
  • rad - Angle (radians).
Returns:
Angle, wrapped (grades).

hypot1 (x)

 

Compute the norm sqrt(1 + x**2).

Arguments:
  • x - Argument (scalar).
Returns:
Norm (float).

hypot2 (x, y)

 

Compute the squared norm x**2 + y**2.

Arguments:
  • x - X argument (scalar).
  • y - Y argument (scalar).
Returns:
x**2 + y**2 (float).

hypot2_ (*xs)

 

Compute the squared norm sum(x**2 for x in xs).

Arguments:
  • xs - X arguments (scalars), all positional.
Returns:
Squared norm (float).
Raises:
  • OverflowError - Partial 2sum overflow.
  • ValueError - Invalid or no xs value.

See Also: Function hypot_.

hypot_ (*xs)

 

Compute the norm sqrt(sum(x**2 for x in xs)).

Similar to Python 3.8+ n-dimension math.hypot, but exceptions, nan and infinite values are handled differently.

Arguments:
  • xs - X arguments (scalars), all positional.
Returns:
Norm (float).
Raises:
  • OverflowError - Partial 2sum overflow.
  • ValueError - Invalid or no xs values.

Note: The Python 3.8+ Euclidian distance math.dist between 2 n-dimensional points p1 and p2 can be computed as hypot_(*((c1 - c2) for c1, c2 in zip(p1, p2))), provided p1 and p2 have the same, non-zero length n.

intersection3d3 (start1, end1, start2, end2, eps=2.220446049250313e-16, useZ=True, **Vector_and_kwds)

 

Compute the intersection point of two (2- or 3-D) lines, each defined by two points or by a point and a bearing.

Arguments:
  • start1 - Start point of the first line (Cartesian, Vector3d, Vector3Tuple or Vector4Tuple).
  • end1 - End point of the first line (Cartesian, Vector3d, Vector3Tuple or Vector4Tuple) or the bearing at start1 (compass degrees).
  • start2 - Start point of the second line (Cartesian, Vector3d, Vector3Tuple or Vector4Tuple).
  • end2 - End point of the second line (Cartesian, Vector3d, Vector3Tuple or Vector4Tuple) or the bearing at start2 (Ccompass degrees).
  • eps - Tolerance for skew line distance and length (EPS).
  • useZ - If True, use the Z components, otherwise force z=INT0 (bool).
  • Vector_and_kwds - Optional class Vector=None to return the intersection points and optional, additional Vector keyword arguments, otherwise start1's (sub-)class.
Returns:
An Intersection3Tuple(point, outside1, outside2) with point an instance of Vector or start1's (sub-)class.
Raises:
  • IntersectionError - Invalid, skew, non-co-planar or otherwise non-intersecting lines.

Note: The outside values is 0 for lines specified by point and bearing.

See Also: Line-line intersection and line-line distance, skew lines and point-line distance.

iscolinearWith (point, point1, point2, eps=2.220446049250313e-16, useZ=True)

 

Check whether a point is colinear with two other (2- or 3-D) points.

Arguments:
  • point - The point (Vector3d, Vector3Tuple or Vector4Tuple).
  • point1 - First point (Vector3d, Vector3Tuple or Vector4Tuple).
  • point2 - Second point (Vector3d, Vector3Tuple or Vector4Tuple).
  • eps - Tolerance (scalar), same units as x, y and z.
  • useZ - If True, use the Z components, otherwise force z=INT0 (bool).
Returns:
True if point is colinear point1 and point2, False otherwise.
Raises:
  • TypeError - Invalid point, point1 or point2.

See Also: Function nearestOn.

km2m (km)

 

Convert kilo meter to meter (m).

Arguments:
  • km - Value in kilo meter (scalar).
Returns:
Value in meter (float).
Raises:
  • ValueError - Invalid km.

m2NM (meter)

 

Convert meter to nautical miles (NM).

Arguments:
  • meter - Value in meter (scalar).
Returns:
Value in NM (float).
Raises:
  • ValueError - Invalid meter.

m2SM (meter)

 

Convert meter to statute miles (SM).

Arguments:
  • meter - Value in meter (scalar).
Returns:
Value in SM (float).
Raises:
  • ValueError - Invalid meter.

m2chain (meter)

 

Convert meter to UK chains.

Arguments:
  • meter - Value in meter (scalar).
Returns:
Value in chains (float).
Raises:
  • ValueError - Invalid meter.

m2degrees (distance, radius=6371008.771415, lat=0)

 

Convert a distance to an angle along the equator or along the parallel at an other (geodetic) latitude.

Arguments:
  • distance - Distance (meter, same units as radius).
  • radius - Mean earth radius, ellipsoid or datum (meter, an Ellipsoid, Ellipsoid2, Datum or a_f2Tuple).
  • lat - Parallel latitude (degrees90, str).
Returns:
Angle (degrees) or INF for near-polar lat.
Raises:
  • RangeError - Latitude lat outside valid range and pygeodesy3.rangerrors set to True.
  • TypeError - Invalid radius.
  • ValueError - Invalid distance, radius or lat.

See Also: Function m2radians and degrees2m.

m2fathom (meter)

 

Convert meter to Imperial fathoms.

Arguments:
  • meter - Value in meter (scalar).
Returns:
Value in fathoms (float).
Raises:
  • ValueError - Invalid meter.

See Also: Function m2toise, Fathom and Klafter.

m2ft (meter, usurvey=False, pied=False, fuss=False)

 

Convert meter to International, US Survey, French or or German feet (ft).

Arguments:
  • meter - Value in meter (scalar).
  • usurvey - If True, convert to US Survey foot else ...
  • pied - If True, convert to French pied-du-Roi else ...
  • fuss - If True, convert to German Fuss, otherwise to International foot.
Returns:
Value in feet (float).
Raises:
  • ValueError - Invalid meter.

m2furlong (meter)

 

Convert meter to furlongs.

Arguments:
  • meter - Value in meter (scalar).
Returns:
Value in furlongs (float).
Raises:
  • ValueError - Invalid meter.

m2km (meter)

 

Convert meter to kilo meter (Km).

Arguments:
  • meter - Value in meter (scalar).
Returns:
Value in Km (float).
Raises:
  • ValueError - Invalid meter.

m2radians (distance, radius=6371008.771415, lat=0)

 

Convert a distance to an angle along the equator or along the parallel at an other (geodetic) latitude.

Arguments:
  • distance - Distance (meter, same units as radius).
  • radius - Mean earth radius, ellipsoid or datum (meter, an Ellipsoid, Ellipsoid2, Datum or a_f2Tuple).
  • lat - Parallel latitude (degrees90, str).
Returns:
Angle (radians) or INF for near-polar lat.
Raises:
  • RangeError - Latitude lat outside valid range and pygeodesy3.rangerrors set to True.
  • TypeError - Invalid radius.
  • ValueError - Invalid distance, radius or lat.

See Also: Function m2degrees and radians2m.

m2toise (meter)

 

Convert meter to French toises.

Arguments:
  • meter - Value in meter (scalar).
Returns:
Value in toises (float).
Raises:
  • ValueError - Invalid meter.

See Also: Function m2fathom.

m2yard (meter)

 

Convert meter to UK yards.

Arguments:
  • meter - Value in meter (scalar).
Returns:
Value in yards (float).
Raises:
  • ValueError - Invalid meter.

meeus2 (point1, point2, point3, circum=False, useZ=True)

 

Return the radius and Meeus' Type of the smallest circle through or containing three (2- or 3-D) points.

Arguments:
  • point1 - First point (Cartesian, Vector3d, Vector3Tuple, Vector4Tuple or Vector2Tuple if useZ=False).
  • point2 - Second point (Cartesian, Vector3d, Vector3Tuple, Vector4Tuple or Vector2Tuple if useZ=False).
  • point3 - Third point (Cartesian, Vector3d, Vector3Tuple, Vector4Tuple or Vector2Tuple if useZ=False).
  • circum - If True return the circumradius and circumcenter always, overriding Meeus' Type II case (bool).
  • useZ - If True, use the Z components, otherwise force z=INT0 (bool).
Returns:
Meeus2Tuple(radius, Type), with Type the circumcenter iff circum=True.
Raises:
  • IntersectionError - Near-coincident or -colinear points, iff circum=True.
  • TypeError - Invalid point1, point2 or point3.

See Also: Functions pygeodesy3.circum3 and pygeodesy3.circum4_ and Meeus, J. Astronomical Algorithms, 2nd Ed. 1998, page 127ff, circumradius and circumcircle.

nearestOn (point, point1, point2, within=True, useZ=True, Vector=None, **Vector_kwds)

 

Locate the point between two points closest to a reference (2- or 3-D).

Arguments:
  • point - Reference point (Cartesian, Vector3d, Vector3Tuple or Vector4Tuple).
  • point1 - Start point (Cartesian, Vector3d, Vector3Tuple or Vector4Tuple).
  • point2 - End point (Cartesian, Vector3d, Vector3Tuple or Vector4Tuple).
  • within - If True return the closest point between both given points, otherwise the closest point on the extended line through both points (bool).
  • useZ - If True, use the Z components, otherwise force z=INT0 (bool).
  • Vector - Class to return closest point (Cartesian, Vector3d or Vector3Tuple) or None.
  • Vector_kwds - Optional, additional Vector keyword arguments, ignored if Vector is None.
Returns:
Closest point, either point1 or point2 or an instance of the point's (sub-)class or Vector if not None.
Raises:
  • TypeError - Invalid point, point1 or point2.

See Also: 3-D Point-Line Distance, Cartesian and LatLon methods nearestOn, method spherical.trigonometry.LatLon.nearestOn3 and function spherical.trigonometry.nearestOn3.

nearestOn6 (point, points, closed=False, useZ=True, **Vector_and_kwds)

 

Locate the point on a path or polygon closest to a reference point.

The closest point on each polygon edge is either the nearest of that edge's end points or a point in between.

Arguments:
  • point - Reference point (Cartesian, Vector3d, Vector3Tuple or Vector4Tuple).
  • points - The path or polygon points (Cartesian, Vector3d, Vector3Tuple or Vector4Tuple[]).
  • closed - Optionally, close the path or polygon (bool).
  • useZ - If True, use the Z components, otherwise force z=INT0 (bool).
  • Vector_and_kwds - Optional class Vector=None to return the closest point and optional, additional Vector keyword arguments, otherwise point's (sub-)class.
Returns:
A NearestOn6Tuple(closest, distance, fi, j, start, end) with the closest, the start and the end point each an instance of the Vector keyword argument of if {Vector=None} or not specified, an instance of the reference point's (sub-)class.
Raises:
  • PointsError - Insufficient number of points
  • TypeError - Non-cartesian point and points.

Note: Distances measured with method Vector3d.equirectangular. For geodetic distances use function nearestOn5 or one of the LatLon.nearestOn6 methods.

norm2 (x, y)

 

Normalize a 2-dimensional vector.

Arguments:
  • x - X component (scalar).
  • y - Y component (scalar).
Returns:
2-Tuple (x, y), normalized.
Raises:
  • ValueError - Invalid x or y or zero norm.

norm_ (*xs)

 

Normalize all n-dimensional vector components.

Arguments:
  • xs - Components (scalars), all positional.
Returns:
Yield each component, normalized.
Raises:
  • ValueError - Invalid or insufficent xs or zero norm.

parse3d (str3d, sep=',', Vector=<class 'pygeodesy3.maths.vector3d.Vector3d'>, **Vector_kwds)

 

Parse an "x, y, z" string.

Arguments:
  • str3d - X, y and z values (str).
  • sep - Optional separator (str).
  • Vector - Optional class (Vector3d).
  • Vector_kwds - Optional Vector keyword arguments, ignored if Vector is None.
Returns:
A Vector instance or if Vector is None, a named Vector3Tuple(x, y, z).
Raises:

radians2m (rad, radius=6371008.771415, lat=0)

 

Convert an angle to a distance along the equator or along the parallel at an other (geodetic) latitude.

Arguments:
  • rad - The angle (radians).
  • radius - Mean earth radius, ellipsoid or datum (meter, Ellipsoid, Ellipsoid2, Datum or a_f2Tuple).
  • lat - Parallel latitude (degrees90, str).
Returns:
Distance (meter, same units as radius or equatorial and polar radii) or 0.0 for near-polar lat.
Raises:
  • RangeError - Latitude lat outside valid range and pygeodesy3.rangerrors set to True.
  • TypeError - Invalid radius.
  • ValueError - Invalid rad, radius or lat.

See Also: Function degrees2m and m2radians.

radiansPI (deg)

 

Convert and wrap degrees to radians [-PI..+PI].

Arguments:
  • deg - Angle (degrees).
Returns:
Radians, wrapped (radiansPI)

radiansPI2 (deg)

 

Convert and wrap degrees to radians [0..+2PI).

Arguments:
  • deg - Angle (degrees).
Returns:
Radians, wrapped (radiansPI2)

radiansPI_2 (deg)

 

Convert and wrap degrees to radians [-3PI/2..+PI/2].

Arguments:
  • deg - Angle (degrees).
Returns:
Radians, wrapped (radiansPI_2)

radii11 (point1, point2, point3, useZ=True)

 

Return the radii of the In-, Soddy and Tangent circles of a (2- or 3-D) triangle.

Arguments:
  • point1 - First point (Cartesian, Vector3d, Vector3Tuple, Vector4Tuple or Vector2Tuple if useZ=False).
  • point2 - Second point (Cartesian, Vector3d, Vector3Tuple, Vector4Tuple or Vector2Tuple if useZ=False).
  • point3 - Third point (Cartesian, Vector3d, Vector3Tuple, Vector4Tuple or Vector2Tuple if useZ=False).
  • useZ - If True, use the Z components, otherwise force z=INT0 (bool).
Returns:
Radii11Tuple(rA, rB, rC, cR, rIn, riS, roS, a, b, c, s).
Raises:
  • TriangleError - Near-coincident or -colinear points.
  • TypeError - Invalid point1, point2 or point3.

sincos2 (rad)

 

Return the sine and cosine of an angle in radians.

Arguments:
  • rad - Angle (radians).
Returns:
2-Tuple (sin(rad), cos(rad)).

See Also: GeographicLib function sincosd and C++ sincosd.

sincos2_ (*rads)

 

Return the sine and cosine of angle(s) in radians.

Arguments:
  • rads - One or more angles (radians).
Returns:
Yield the sin(rad) and cos(rad) for each angle.

See Also: function sincos2.

sincos2d (deg, **adeg)

 

Return the sine and cosine of an angle in degrees.

Arguments:
  • deg - Angle (degrees).
  • adeg - Optional correction (degrees).
Returns:
2-Tuple (sin(deg_), cos(deg_), deg_ = deg + adeg).

See Also: GeographicLib function sincosd and C++ sincosd.

sincos2d_ (*degs)

 

Return the sine and cosine of angle(s) in degrees.

Arguments:
  • degs - One or more angles (degrees).
Returns:
Yield the sin(deg) and cos(deg) for each angle.

See Also: Function sincos2d.

sincostan3 (rad)

 

Return the sine, cosine and tangent of an angle in radians.

Arguments:
  • rad - Angle (radians).
Returns:
3-Tuple (sin(rad), cos(rad), tan(rad)).

See Also: Function sincos2.

soddy4 (point1, point2, point3, eps=8.881784197001252e-16, useZ=True)

 

Return the radius and center of the inner Soddy circle of a (2- or 3-D) triangle.

Arguments:
  • point1 - First point (Cartesian, Vector3d, Vector3Tuple, Vector4Tuple or Vector2Tuple if useZ=False).
  • point2 - Second point (Cartesian, Vector3d, Vector3Tuple, Vector4Tuple or Vector2Tuple if useZ=False).
  • point3 - Third point (Cartesian, Vector3d, Vector3Tuple, Vector4Tuple or Vector2Tuple if useZ=False).
  • eps - Tolerance for function pygeodesy3.trilaterate3d2 if useZ is True otherwise pygeodesy3.trilaterate2d2.
  • useZ - If True, use the Z components, otherwise force z=INT0 (bool).
Returns:
Soddy4Tuple(radius, center, deltas, outer). The center, an instance of point1's (sub-)class, is co-planar with the three given points. The outer Soddy radius may be INF.
Raises:
  • ImportError - Package numpy not found, not installed or older than version 1.10 and useZ is True.
  • IntersectionError - Near-coincident or -colinear points or a trilateration or numpy issue.
  • TypeError - Invalid point1, point2 or point3.

See Also: Functions radii11 and circum3 and Soddy Circles.

sqrt0 (x, Error=None)

 

Return the square root iff x > EPS02.

Arguments:
  • x - Value (scalar).
  • Error - Error to raise for negative x.
Returns:
Square root (float) or 0.0.

Note: Any x < EPS02 including x < 0 returns 0.0.

sqrt3 (x)

 

Return the square root, cubed sqrt(x)**3 or sqrt(x**3).

Arguments:
  • x - Value (scalar).
Returns:
Square root cubed (float).
Raises:
  • ValueError - Negative x.

See Also: Functions cbrt and cbrt2.

sqrt_a (h, b)

 

Compute a side of a right-angled triangle from sqrt(h**2 - b**2).

Arguments:
  • h - Hypotenuse or outer annulus radius (scalar).
  • b - Triangle side or inner annulus radius (scalar).
Returns:
copysign(a, h) or unsigned 0.0 (float).
Raises:
  • TypeError - Non-scalar h or b.
  • ValueError - If abs(h) < abs(b).

See Also: Inner tangent chord d of an annulus and function annulus_area.

tanPI_2_2 (rad)

 

Compute the tangent of half angle, 90 degrees rotated.

Arguments:
  • rad - Angle (radians).
Returns:
tan((rad + PI/2) / 2) (float).

tan_2 (rad, **semi)

 

Compute the tangent of half angle.

Arguments:
  • rad - Angle (radians).
  • semi - Angle or edge name and index for semi-circular error.
Returns:
tan(rad / 2) (float).
Raises:
  • ValueError - If rad is semi-circular and semi is given.

tand (deg, **error_kwds)

 

Return the tangent of an angle in degrees.

Arguments:
  • deg - Angle (degrees).
  • error_kwds - Error to raise (ValueError).
Returns:
tan(deg).
Raises:

tand_ (*degs, **error_kwds)

 

Return the tangent of angle(s) in degrees.

Arguments:
  • degs - One or more angles (degrees).
  • error_kwds - Error to raise (ValueError).
Returns:
Yield the tan(deg) for each angle.
Raises:

toise2m (toises)

 

Convert French toises to meter.

Arguments:
  • toises - Value in toises (scalar).
Returns:
Value in meter (float).
Raises:
  • ValueError - Invalid toises.

See Also: Function fathom2m.

trilaterate2d2 (x1, y1, radius1, x2, y2, radius2, x3, y3, radius3, eps=None, **Vector_and_kwds)

 

Trilaterate three circles, each given as a (2-D) center and a radius.

Arguments:
  • x1 - Center x coordinate of the 1st circle (scalar).
  • y1 - Center y coordinate of the 1st circle (scalar).
  • radius1 - Radius of the 1st circle (scalar).
  • x2 - Center x coordinate of the 2nd circle (scalar).
  • y2 - Center y coordinate of the 2nd circle (scalar).
  • radius2 - Radius of the 2nd circle (scalar).
  • x3 - Center x coordinate of the 3rd circle (scalar).
  • y3 - Center y coordinate of the 3rd circle (scalar).
  • radius3 - Radius of the 3rd circle (scalar).
  • eps - Tolerance to check the trilaterated point delta on all 3 circles (scalar) or None for no checking.
  • Vector_and_kwds - Optional class Vector=None to return the trilateration and optional, additional Vector keyword arguments, otherwise (Vector3d).
Returns:
Trilaterated point as Vector(x, y, **Vector_kwds) or Vector2Tuple(x, y) if Vector is None..
Raises:
  • IntersectionError - No intersection, near-concentric or -colinear centers, trilateration failed some other way or the trilaterated point is off one circle by more than eps.
  • UnitError - Invalid radius1, radius2 or radius3.

trilaterate3d2 (center1, radius1, center2, radius2, center3, radius3, eps=2.220446049250313e-16, **Vector_and_kwds)

 

Trilaterate three spheres, each given as a (3-D) center and a radius.

Arguments:
  • center1 - Center of the 1st sphere (Cartesian, Vector3d, Vector3Tuple or Vector4Tuple).
  • radius1 - Radius of the 1st sphere (same units as x, y and z).
  • center2 - Center of the 2nd sphere (Cartesian, Vector3d, Vector3Tuple or Vector4Tuple).
  • radius2 - Radius of this sphere (same units as x, y and z).
  • center3 - Center of the 3rd sphere (Cartesian, Vector3d, Vector3Tuple or Vector4Tuple).
  • radius3 - Radius of the 3rd sphere (same units as x, y and z).
  • eps - Pertubation tolerance (scalar), same units as x, y and z or None for no pertubations.
  • Vector_and_kwds - Optional class Vector=None to return the trilateration and optional, additional Vector keyword arguments, otherwise center1's (sub-)class.
Returns:
2-Tuple with two trilaterated points, each a Vector instance. Both points are the same instance if all three spheres abut/intersect in a single point.
Raises:
  • ImportError - Package numpy not found, not installed or older than version 1.10.
  • IntersectionError - Near-concentric, -colinear, too distant or non-intersecting spheres.
  • NumPyError - Some numpy issue.
  • TypeError - Invalid center1, center2 or center3.
  • UnitError - Invalid radius1, radius2 or radius3.

truncate (x, ndigits=None)

 

Truncate to the given number of digits.

Arguments:
  • x - Value to truncate (scalar).
  • ndigits - Number of digits (int), aka precision.
Returns:
Truncated x (float).

See Also: Python function round.

unroll180 (lon1, lon2, wrap=True)

 

Unroll longitudinal delta and wrap longitude in degrees.

Arguments:
  • lon1 - Start longitude (degrees).
  • lon2 - End longitude (degrees).
  • wrap - If True, wrap and unroll to the (-180..+180] range (bool).
Returns:
2-Tuple (lon2-lon1, lon2) unrolled (degrees, degrees).

See Also: Capability LONG_UNROLL in GeographicLib.

unrollPI (rad1, rad2, wrap=True)

 

Unroll longitudinal delta and wrap longitude in radians.

Arguments:
  • rad1 - Start longitude (radians).
  • rad2 - End longitude (radians).
  • wrap - If True, wrap and unroll to the (-PI..+PI] range (bool).
Returns:
2-Tuple (rad2-rad1, rad2) unrolled (radians, radians).

See Also: Capability LONG_UNROLL in GeographicLib.

wrap180 (deg)

 

Wrap degrees to [-180..+180].

Arguments:
  • deg - Angle (degrees).
Returns:
Degrees, wrapped (degrees180).

wrap360 (deg)

 

Wrap degrees to [0..+360).

Arguments:
  • deg - Angle (degrees).
Returns:
Degrees, wrapped (degrees360).

wrap90 (deg)

 

Wrap degrees to [-90..+90].

Arguments:
  • deg - Angle (degrees).
Returns:
Degrees, wrapped (degrees90).

wrapPI (rad)

 

Wrap radians to [-PI..+PI].

Arguments:
  • rad - Angle (radians).
Returns:
Radians, wrapped (radiansPI).

wrapPI2 (rad)

 

Wrap radians to [0..+2PI).

Arguments:
  • rad - Angle (radians).
Returns:
Radians, wrapped (radiansPI2).

wrapPI_2 (rad)

 

Wrap radians to [-PI/2..+PI/2].

Arguments:
  • rad - Angle (radians).
Returns:
Radians, wrapped (radiansPI_2).

wrap_normal (*normal)

 

Define the operation for the keyword argument wrap=True, across pygeodesy3: wrap, normalize or no-op. For backward compatibility, the default is wrap.

Arguments:
  • normal - If True, normalize lat- and longitude using normal or normal_, if False, wrap the lat- and longitude individually by wrap90 or wrapPI_2 respectively wrap180, wrapPI or if None, leave lat- and longitude unchanged. Do not supply any value to get the current setting.
Returns:
The previous wrap_normal setting (bool or None).

yard2m (yards)

 

Convert UK yards to meter.

Arguments:
  • yards - Value in yards (scalar).
Returns:
Value in meter (float).
Raises:
  • ValueError - Invalid yards.

zcrt (x)

 

Return the 6-th, zenzi-cubic root, x**(1 / 6).

Arguments:
  • x - Value (scalar).
Returns:
Zenzi-cubic root (float).
Raises:
  • ValueError - Negative x.

See Also: Functions bqrt and zqrt.

zqrt (x)

 

Return the 8-th, zenzi-quartic or squared-quartic root, x**(1 / 8).

Arguments:
  • x - Value (scalar).
Returns:
Zenzi-quartic root (float).
Raises:
  • ValueError - Negative x.

See Also: Functions bqrt and zcrt.