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

Package miscs

Miscellaneous classes and functions.


Version: 23.12.31

Submodules

Classes
  ADict
A dict with both key and attribute access to the dict items.
  Band
Named str representing a UTM/UPS band letter, unchecked.
  Bearing
Named float representing a bearing in compass degrees from (true) North.
  Bearing2Tuple
2-Tuple (initial, final) bearings, both in compass degrees360.
  Bearing_
Named float representing a bearing in radians from compass degrees from (true) North.
  Bool
Named bool, a sub-class of int like Python's bool.
  Bounds2Tuple
2-Tuple (latlonSW, latlonNE) with the bounds' lower-left and upper-right corner as LatLon instance.
  Bounds4Tuple
4-Tuple (latS, lonW, latN, lonE) with the bounds' lower-left (LatS, LowW) and upper-right (latN, lonE) corner lat- and longitudes.
  ClipError
Clip box or clip region issue.
  CrossError
Error raised for zero or near-zero vectorial cross products, occurring for coincident or colinear points, lines or bearings.
  Degrees
Named float representing a coordinate in degrees, optionally clipped.
  Degrees2
Named float representing a distance in degrees squared.
  Degrees_
Named Degrees representing a coordinate in degrees with optional limits low and high.
  Destination2Tuple
2-Tuple (destination, final), destination in LatLon and final bearing in compass degrees360.
  Destination3Tuple
3-Tuple (lat, lon, final), destination lat, lon in degrees90 respectively degrees180 and final bearing in compass degrees360.
  Distance
Named float representing a distance, conventionally in meter.
  Distance2Tuple
2-Tuple (distance, initial), distance in meter and initial bearing in compass degrees360.
  Distance3Tuple
3-Tuple (distance, initial, final), distance in meter and initial and final bearing, both in compass degrees360.
  Distance4Tuple
4-Tuple (distance2, delta_lat, delta_lon, unroll_lon2) with the distance in degrees squared, the latitudinal delta_lat = lat2 - lat1, the wrapped, unrolled and adjusted longitudinal delta_lon = lon2 - lon1 and unroll_lon2, the unrolled or original lon2.
  Distance_
Named float with optional low and high limits representing a distance, conventionally in meter.
  EasNor2Tuple
2-Tuple (easting, northing), both in meter, conventionally.
  EasNor3Tuple
3-Tuple (easting, northing, height), all in meter, conventionally.
  Easting
Named float representing an easting, conventionally in meter.
  Epoch
Named epoch with optional low and high limits representing a fractional calendar year.
  FIx
A named Fractional Index, an int or float index into a list or tuple of points, typically.
  Feet
Named float representing a distance or length in feet.
  Float_
Named float with optional low and high limit.
  Forward4Tuple
4-Tuple (easting, northing, gamma, scale) in meter, meter, meridian convergence gamma at point in degrees and the scale of projection at point scalar.
  GeodesicError
Error raised for lack of convergence or other issues in pygeodesy3.geodesic.exact, pygeodesy3.geodesic.wrap or pygeodesy3.Base.karney.
  Height
Named float representing a height, conventionally in meter.
  HeightX
Like Height, used to distinguish the interpolated height from an original Height at a clip intersection.
  Height_
Named float with optional low and high limits representing a height, conventionally in meter.
  Int_
Named int with optional limits low and high.
  Intersection3Tuple
3-Tuple (point, outside1, outside2) of an intersection point and outside1, the position of the point, -1 if before the start, +1 if after the end and 0 if on or between the start and end point of the first line.
  IntersectionError
Error raised for line or circle intersection issues.
  Lam
Named float representing a longitude in radians.
  Lam_
Named float representing a longitude in radians converted from degrees.
  Lat
Named float representing a latitude in degrees.
  LatLon2PsxyIter
Iterate and convert for points with optional loop-back and copies.
  LatLon2Tuple
2-Tuple (lat, lon) in degrees90 and degrees180.
  LatLon3Tuple
3-Tuple (lat, lon, height) in degrees90, degrees180 and meter, conventionally.
  LatLon4Tuple
4-Tuple (lat, lon, height, datum) in degrees90, degrees180, meter and Datum.
  LatLonDatum3Tuple
3-Tuple (lat, lon, datum) in degrees90, degrees180 and Datum.
  LatLonDatum5Tuple
5-Tuple (lat, lon, datum, gamma, scale) in degrees90, degrees180, Datum, degrees and float.
  LatLonPrec3Tuple
3-Tuple (lat, lon, precision) in degrees, degrees and int.
  LatLonPrec5Tuple
5-Tuple (lat, lon, precision, height, radius) in degrees, degrees, int and height or radius in meter (or None if missing).
  Lat_
Named float representing a latitude in degrees within limits low and high.
  LenError
Error raised for mis-matching len values.
  LimitError
Error raised for lat- or longitudinal values or deltas exceeding the given limit in functions pygeodesy3.equirectangular, pygeodesy3.equirectangular_, nearestOn* and simplify* or methods with limit or options keyword arguments.
  Lon
Named float representing a longitude in degrees.
  Lon_
Named float representing a longitude in degrees within limits low and high.
  MGRSError
Military Grid Reference System (MGRS) parse or other Mgrs issue.
  Meter
Named float representing a distance or length in meter.
  Meter2
Named float representing an area in meter squared.
  Meter3
Named float representing a volume in meter cubed.
  Meter_
Named float representing a distance or length in meter.
  NearestOn2Tuple
2-Tuple (closest, fraction) of the closest point on and fraction along a line (segment) between two points.
  NearestOn3Tuple
3-Tuple (closest, distance, angle) of the closest point on the polygon, either a LatLon instance or a LatLon3Tuple(lat, lon, height) and the distance and angle to the closest point are in meter respectively compass degrees360.
  NearestOn6Tuple
6-Tuple (closest, distance, fi, j, start, end) with the closest point, the distance in meter, conventionally and the start and end point of the path or polygon edge.
  NearestOn8Tuple
8-Tuple (closest, distance, fi, j, start, end, initial, final), like NearestOn6Tuple but extended with the initial and the final bearing at the reference respectively the closest point, both in compass degrees.
  Northing
Named float representing a northing, conventionally in meter.
  NumPyError
Error raised for NumPy issues.
  Number_
Named int representing a non-negative number.
  ParseError
Error parsing degrees, radians or several other formats.
  Phi
Named float representing a latitude in radians.
  PhiLam2Tuple
2-Tuple (phi, lam) with latitude phi in radians[PI_2] and longitude lam in radians[PI].
  PhiLam3Tuple
3-Tuple (phi, lam, height) with latitude phi in radians[PI_2], longitude lam in radians[PI] and height in meter.
  PhiLam4Tuple
4-Tuple (phi, lam, height, datum) with latitude phi in radians[PI_2], longitude lam in radians[PI], height in meter and Datum.
  Phi_
Named float representing a latitude in radians converted from degrees.
  Point3Tuple
3-Tuple (x, y, ll) in meter, meter and LatLon.
  Points2Tuple
2-Tuple (number, points) with the number of points and -possible reduced- list or tuple of points.
  PointsError
Error for an insufficient number of points.
  PointsIter
Iterator for points with optional loop-back and copies.
  Precision_
Named int with optional low and high limits representing a precision.
  Property
  Property_RO
  Radians
Named float representing a coordinate in radians, optionally clipped.
  Radians2
Named float representing a distance in radians squared.
  Radians_
Named float representing a coordinate in radians with optional limits low and high.
  Radius_
Named float with optional low and high limits representing a radius, conventionally in meter.
  RangeError
Error raised for lat- or longitude values outside the clip, clipLat, clipLon in functions pygeodesy3.parse3llh, pygeodesy3.parseDMS, pygeodesy3.parseDMS2 and pygeodesy3.parseRad or the given limit in functions pygeodesy3.clipDegrees and pygeodesy3.clipRadians.
  Reverse4Tuple
4-Tuple (lat, lon, gamma, scale) with lat- and longitude in degrees, meridian convergence gamma at point in degrees and the scale of projection at point scalar.
  RhumbError
Error raised for a pygeodesy3.rhumb.aux_, pygeodesy3.rhumb.solve or pygeodesy3.rhumb.ekx issue.
  Scalar
Named float representing a factor, fraction, scale, etc.
  Scalar_
Named float with optional low and high limits representing a factor, fraction, scale, etc.
  SciPyError
Error raised for SciPy issues.
  SciPyWarning
Error thrown for SciPy warnings.
  TRFError
Terrestrial Reference Frame (TRF), Epoch, RefFrame or RefFrame conversion issue.
  Triangle7Tuple
7-Tuple (A, a, B, b, C, c, area) with interior angles A, B and C in degrees, spherical sides a, b and c in meter conventionally and the area of a (spherical) triangle in square meter conventionally.
  Triangle8Tuple
8-Tuple (A, a, B, b, C, c, D, E) with interior angles A, B and C, spherical sides a, b and c, the spherical deficit D and the spherical excess E of a (spherical) triangle, all in radians.
  TriangleError
Error raised for triangle, inter- or resection issues.
  Trilaterate5Tuple
5-Tuple (min, minPoint, max, maxPoint, n) with min and max in meter, the corresponding trilaterated minPoint and maxPoint as LatLon and the number n.
  UnitError
Default exception for units issues for a value exceeding the low or high limit.
  UtmUps2Tuple
2-Tuple (zone, hemipole) as int and str, where zone is 1..60 for UTM or 0 for UPS and hemipole 'N'|'S' is the UTM hemisphere or the UPS pole.
  UtmUps5Tuple
5-Tuple (zone, hemipole, easting, northing, band) as int, str, meter, meter and band letter, where zone is 1..60 for UTM or 0 for UPS, hemipole 'N'|'S' is the UTM hemisphere or the UPS pole and band is "" or the longitudinal UTM band 'C'|'D'|..|'W'|'X' or polar UPS band 'A'|'B'|'Y'|'Z'.
  UtmUps8Tuple
8-Tuple (zone, hemipole, easting, northing, band, datum, gamma, scale) as int, str, meter, meter, band letter, Datum, degrees and scalar, where zone is 1..60 for UTM or 0 for UPS, hemipole 'N'|'S' is the UTM hemisphere or the UPS pole and band is "" or the longitudinal UTM band 'C'|'D'|..|'W'|'X' or polar UPS band 'A'|'B'|'Y'|'Z'.
  UtmUpsLatLon5Tuple
5-Tuple (zone, band, hemipole, lat, lon) as int, str, str, degrees90 and degrees180, where zone is 1..60 for UTM or 0 for UPS, band is "" or the longitudinal UTM band 'C'|'D'|..|'W'|'X' or polar UPS band 'A'|'B'|'Y'|'Z' and hemipole 'N'|'S' is the UTM hemisphere or the UPS pole.
  Vector2Tuple
2-Tuple (x, y) of (geocentric) components, each in meter or the same units.
  Vector3Tuple
3-Tuple (x, y, z) of (geocentric) components, all in meter or the same units.
  Vector4Tuple
4-Tuple (x, y, z, h) of (geocentric) components, all in meter or the same units.
  VectorError
Vector3d, Cartesian* or *Nvector issues.
  Zone
Named int representing a UTM/UPS zone number.
  property_RO
Functions
 
anstr(name, OKd='._-', sub='_')
Make a valid name of alphanumeric and OKd characters.
 
attrs(inst, *names, **Nones_True__pairs_kwds)
Get instance attributes as name=value strings, with floats formatted by function fstr.
 
bearingDMS(bearing, form='d', prec=None, sep='', **s_D_M_S)
Convert bearing to a string (without compass point suffix).
 
callername(up=1, dflt='', source=False, underOK=False)
Get the name of the invoking callable.
 
classname(inst, prefixed=None)
Return the instance' class name optionally prefixed with the module name.
 
classnaming(prefixed=None)
Get/set the default class naming for [module.]class names.
 
clipDegrees(deg, limit)
Clip a lat- or longitude to the given range.
 
clipRadians(rad, limit)
Clip a lat- or longitude to the given range.
 
compassDMS(bearing, form='d', prec=None, sep='', **s_D_M_S)
Convert bearing to a string suffixed with compass point.
 
compassPoint(bearing, prec=3)
Convert bearing to a compass point.
 
crosserrors(raiser=None)
Report or ignore vectorial cross product errors.
 
degDMS(deg, prec=6, s_D='°', s_M='\xe2\x80\xb2', s_S='', neg='-', pos='')
Convert degrees to a string in degrees, minutes or seconds.
 
deprecated_Property_RO(method)
Decorator for a DEPRECATED Property_RO.
 
deprecated_class(cls_or_class)
Use inside __new__ or __init__ of a DEPRECATED class.
 
deprecated_function(call)
Decorator for a DEPRECATED function.
 
deprecated_method(call)
Decorator for a DEPRECATED method.
 
deprecated_property_RO(method)
Decorator for a DEPRECATED property_RO.
 
enstr2(easting, northing, prec, *extras, **wide_dot)
Return an MGRS/OSGR easting, northing string representations.
 
exception_chaining(error=None)
Get an error's cause or the exception chaining setting.
 
fstr(floats, prec=6, fmt='F', ints=False, sep=', ', strepr=None)
Convert one or more floats to string, optionally stripped of trailing zero decimals.
 
fstrzs(efstr, ap1z=False)
Strip trailing zero decimals from a float string.
 
hstr(height, prec=2, fmt='%+.*f', ints=False, m='')
Return a string for the height value.
 
instr(inst, *args, **kwds)
Return the string representation of an instantiation.
 
isError(exc)
Check a (caught) exception.
 
isNumpy2(obj)
Check for a Numpy2LatLon points wrapper.
 
isPoints2(obj)
Check for a LatLon2psxy points wrapper.
 
isTuple2(obj)
Check for a Tuple2LatLon points wrapper.
 
iterNumpy2(obj)
Iterate over Numpy2 wrappers or other sequences exceeding the threshold.
 
iterNumpy2over(n=None)
Get or set the iterNumpy2 threshold.
 
latDMS(deg, form='dms', prec=None, sep='', **s_D_M_S)
Convert latitude to a string, optionally suffixed with N or S.
 
latlonDMS(lls, **m_form_prec_sep_s_D_M_S)
Convert one or more LatLon instances to strings.
 
latlonDMS_(*lls, **m_form_prec_sep_s_D_M_S)
Convert one or more LatLon instances to strings.
 
limiterrors(raiser=None)
Get/set the throwing of LimitErrors.
 
lonDMS(deg, form='dms', prec=None, sep='', **s_D_M_S)
Convert longitude to a string, optionally suffixed with E or W.
 
lrstrip(txt, lrpairs={'(': ')', '<': '>', '[': ']', '{': '}'})
Left- and right-strip parentheses, brackets, etc.
 
modulename(clas, prefixed=None)
Return the class name optionally prefixed with the module name.
 
nameof(inst)
Get the name of an instance.
 
normDMS(strDMS, norm=None, **s_D_M_S)
Normalize all degrees, minutes and seconds (DMS) symbols in a string to the default symbols S_DEG, S_MIN, S_SEC.
 
notImplemented(inst, *args, **kwds)
Raise a NotImplementedError for a missing instance method or property or for a missing caller feature.
 
notOverloaded(inst, *args, **kwds)
Raise an AssertionError for a method or property not overloaded.
 
pairs(items, prec=6, fmt='F', ints=False, sep='=')
Convert items to name=value strings, with floats handled like fstr.
 
parse3llh(strllh, height=0, sep=',', clipLat=90, clipLon=180, wrap=False, **s_D_M_S)
Parse a string "lat, lon [, h]" representing lat-, longitude in degrees and optional height in meter.
 
parseDDDMMSS(strDDDMMSS, suffix='NSEW', sep='', clip=0, sexagecimal=False)
Parse a lat- or longitude represention forms as [D]DDMMSS in degrees.
 
parseDMS(strDMS, suffix='NSEW', sep='', clip=0, **s_D_M_S)
Parse a lat- or longitude representation in degrees.
 
parseDMS2(strLat, strLon, sep='', clipLat=90, clipLon=180, wrap=False, **s_D_M_S)
Parse a lat- and a longitude representions "lat, lon" in degrees.
 
parseRad(strRad, suffix='NSEW', clip=0)
Parse a string representing angle in radians.
 
points2(points, closed=True, base=None, Error=<class 'pygeodesy3.miscs.errors.PointsError'>)
Check a path or polygon represented by points.
 
precision(form, prec=None)
Set the default precison for a given F_ form.
 
property_doc_(doc)
Decorator for a standard property with basic documentation.
 
rangerrors(raiser=None)
Get/set the throwing of RangeErrors.
 
reprs(objs, prec=6, fmt='F', ints=False)
Convert objects to repr strings, with floats handled like fstr.
 
strs(objs, prec=6, fmt='F', ints=False)
Convert objects to str strings, with floats handled like fstr.
 
toDMS(deg, form='dms', prec=2, sep='', ddd=2, neg='-', pos='+', **s_D_M_S)
Convert signed degrees to string, without suffix.
 
unstr(where, *args, **kwds)
Return the string representation of an invokation.
Variables
  __getattr__ = _lazy_import_as(__name__)
  DeprecationWarnings = DeprecationWarnings()
  F_D = 'd'
  F_D60 = 'd60'
  F_D60_ = '-d60'
  F_D60__ = '+d60'
  F_DEG = 'deg'
  F_DEG_ = '-deg'
  F_DEG__ = '+deg'
  F_DM = 'dm'
  F_DMS = 'dms'
  F_DMS_ = '-dms'
  F_DMS__ = '+dms'
  F_DM_ = '-dm'
  F_DM__ = '+dm'
  F_D_ = '-d'
  F_D__ = '+d'
  F_MIN = 'min'
  F_MIN_ = '-min'
  F_MIN__ = '+min'
  F_RAD = 'rad'
  F_RAD_ = '-rad'
  F_RAD__ = '+rad'
  F_SEC = 'sec'
  F_SEC_ = '-sec'
  F_SEC__ = '+sec'
  F__E = 'e'
  F__E_ = '-e'
  F__E__ = '+e'
  F__F = 'f'
  F__F_ = '-f'
  F__F__ = '+f'
  F__G = 'g'
  F__G_ = '-g'
  F__G__ = '+g'
  S_DEG = '°'
  S_DMS = True
  S_MIN = '\xe2\x80\xb2'
  S_RAD = ''
  S_SEC = ''
  S_SEP = ''
Function Details

anstr (name, OKd='._-', sub='_')

 

Make a valid name of alphanumeric and OKd characters.

Arguments:
  • name - The original name (str).
  • OKd - Other acceptable characters (str).
  • sub - Substitute for invalid charactes (str).
Returns:
The modified name (str).

Note: Leading and trailing whitespace characters are removed, intermediate whitespace characters are coalesced and substituted.

attrs (inst, *names, **Nones_True__pairs_kwds)

 

Get instance attributes as name=value strings, with floats formatted by function fstr.

Arguments:
  • inst - The instance (any type).
  • names - The attribute names, all other positional (str).
  • Nones_True__pairs_kwds - Keyword argument for function pairs, except Nones=True to in-/exclude missing or None-valued attributes.
Returns:
A tuple(sep.join(t) for t in zip(names, reprs(values, ...))) of strs.

bearingDMS (bearing, form='d', prec=None, sep='', **s_D_M_S)

 

Convert bearing to a string (without compass point suffix).

Arguments:
Returns:
Compass degrees per the specified form (str).

See Also: Function pygeodesy3.toDMS.

callername (up=1, dflt='', source=False, underOK=False)

 

Get the name of the invoking callable.

Arguments:
  • up - Number of call stack frames up (int).
  • dflt - Default return value (any).
  • source - Include source file name and line number (bool).
  • underOK - If True, private, internal callables are OK, otherwise private callables are skipped (bool).
Returns:
The callable name (str) or dflt if none found.

classname (inst, prefixed=None)

 

Return the instance' class name optionally prefixed with the module name.

Arguments:
  • inst - The object (any type).
  • prefixed - Include the module name (bool), see function classnaming.
Returns:
The inst's [module.]class name (str).

classnaming (prefixed=None)

 

Get/set the default class naming for [module.]class names.

Arguments:
  • prefixed - Include the module name (bool).
Returns:
Previous class naming setting (bool).

clipDegrees (deg, limit)

 

Clip a lat- or longitude to the given range.

Arguments:
  • deg - Unclipped lat- or longitude (scalar degrees).
  • limit - Valid -/+limit range (degrees).
Returns:
Clipped value (degrees).
Raises:

clipRadians (rad, limit)

 

Clip a lat- or longitude to the given range.

Arguments:
  • rad - Unclipped lat- or longitude (radians).
  • limit - Valid -/+limit range (radians).
Returns:
Clipped value (radians).
Raises:

compassDMS (bearing, form='d', prec=None, sep='', **s_D_M_S)

 

Convert bearing to a string suffixed with compass point.

Arguments:
Returns:
Compass degrees and point in the specified form (str).

See Also: Function pygeodesy3.toDMS.

compassPoint (bearing, prec=3)

 

Convert bearing to a compass point.

Arguments:
  • bearing - Bearing from North (compass degrees360).
  • prec - Precision, number of compass point characters: 1 for cardinal or basic winds, 2 for intercardinal or ordinal or principal winds, 3 for secondary-intercardinal or half-winds or 4 for quarter-winds).
Returns:
Compass point (1-, 2-, 3- or 4-letter str).
Raises:
  • ValueError - Invalid prec.

See Also: Dms.compassPoint and Compass rose.

Example:

>>> p = compassPoint(24, 1)  # 'N'
>>> p = compassPoint(24, 2)  # 'NE'
>>> p = compassPoint(24, 3)  # 'NNE'
>>> p = compassPoint(24)     # 'NNE'
>>> p = compassPoint(11, 4)  # 'NbE'
>>> p = compassPoint(30, 4)  # 'NEbN'
>>> p = compassPoint(11.249)  # 'N'
>>> p = compassPoint(11.25)   # 'NNE'
>>> p = compassPoint(-11.25)  # 'N'
>>> p = compassPoint(348.749) # 'NNW'

crosserrors (raiser=None)

 

Report or ignore vectorial cross product errors.

Arguments:
  • raiser - Use True to throw or False to ignore CrossError exceptions. Use None to leave the setting unchanged.
Returns:
Previous setting (bool).

See Also: Property Vector3d[Base].crosserrors.

degDMS (deg, prec=6, s_D='°', s_M='\xe2\x80\xb2', s_S='', neg='-', pos='')

 

Convert degrees to a string in degrees, minutes or seconds.

Arguments:
  • deg - Value in degrees (scalar degrees).
  • prec - Number of decimal digits (0..9 or None for default). Trailing zero decimals are stripped for prec values of 1 and above, but kept for negative prec.
  • s_D - D symbol for degrees (str).
  • s_M - M symbol for minutes (str) or "".
  • s_S - S symbol for seconds (str) or "".
  • neg - Optional sign for negative ('-').
  • pos - Optional sign for positive ('').
Returns:
Either degrees, minutes or seconds (str).

See Also: Function pygeodesy3.toDMS.

deprecated_Property_RO (method)

 

Decorator for a DEPRECATED Property_RO.

Arguments:
  • method - The Property_RO.fget method (callable).
Returns:
The method DEPRECATED.

deprecated_class (cls_or_class)

 

Use inside __new__ or __init__ of a DEPRECATED class.

Arguments:
  • cls_or_class - The class (cls or Class).

Note: NOT a decorator!

deprecated_function (call)

 

Decorator for a DEPRECATED function.

Arguments:
  • call - The deprecated function (callable).
Returns:
The call DEPRECATED.

deprecated_method (call)

 

Decorator for a DEPRECATED method.

Arguments:
  • call - The deprecated method (callable).
Returns:
The call DEPRECATED.

deprecated_property_RO (method)

 

Decorator for a DEPRECATED property_RO.

Arguments:
  • method - The property_RO.fget method (callable).
Returns:
The method DEPRECATED.

enstr2 (easting, northing, prec, *extras, **wide_dot)

 

Return an MGRS/OSGR easting, northing string representations.

Arguments:
  • easting - Easting from false easting (meter).
  • northing - Northing from from false northing (meter).
  • prec - Precision, the number of decimal digits (int) or if negative, the number of units to drop, like MGRS PRECISION.
  • extras - Optional leading items (strs).
  • wide_dot - Optional keword argument wide=5 for the number of unit digits (int) and dot=False (bool) to insert a decimal point.
Returns:
extras + 2-tuple (str(easting), str(northing)) or + 2-tuple ("", "") for prec <= -wide.
Raises:
  • ValueError - Invalid easting, northing or prec.

Note: The easting and northing values are truncated, not rounded.

exception_chaining (error=None)

 

Get an error's cause or the exception chaining setting.

Arguments:
  • error - An error instance (Exception) or None.
Returns:
If error is None, return True if exception chaining is enabled for PyGeodesy3 errors, False if turned off and None if not available. If error is not None, return it's error cause or None.

Note: To enable exception chaining for pygeodesy3 errors, set env var PYGEODESY3_EXCEPTION_CHAINING to any non-empty value prior to import pygeodesy3.

fstr (floats, prec=6, fmt='F', ints=False, sep=', ', strepr=None)

 

Convert one or more floats to string, optionally stripped of trailing zero decimals.

Arguments:
  • floats - Single or a list, sequence, tuple, etc. (scalars).
  • prec - The float precision, number of decimal digits (0..9). Trailing zero decimals are stripped if prec is positive, but kept for negative prec values. In addition, trailing decimal zeros are stripped for alternate, form '#'.
  • fmt - Optional, float format (str).
  • ints - Optionally, remove the decimal dot for int values (bool).
  • sep - Separator joining the floats (str).
  • strepr - Optional callable to format non-floats (typically repr, str) or None to raise a TypeError.
Returns:
The sep.join(strs(floats, ...) joined (str) or single strs((floats,), ...) (str) if floats is scalar.

fstrzs (efstr, ap1z=False)

 

Strip trailing zero decimals from a float string.

Arguments:
  • efstr - Float with or without exponent (str).
  • ap1z - Append the decimal point and one zero decimal if the efstr is all digits (bool).
Returns:
Float (str).

hstr (height, prec=2, fmt='%+.*f', ints=False, m='')

 

Return a string for the height value.

Arguments:
  • height - Height value (float).
  • prec - The float precision, number of decimal digits (0..9). Trailing zero decimals are stripped if prec is positive, but kept for negative prec values.
  • fmt - Optional, float format (str).
  • ints - Optionally, remove the decimal dot for int values (bool).
  • m - Optional unit of the height (str).

instr (inst, *args, **kwds)

 

Return the string representation of an instantiation.

Arguments:
  • inst - The instance (any type).
  • args - Optional positional arguments.
  • kwds - Optional keyword arguments.
Returns:
Representation (str).

isError (exc)

 

Check a (caught) exception.

Arguments:
  • exc - The exception C({Exception}).
Returns:
True if exc is a pygeodesy3 error, False if exc is a standard Python error of None if neither.

isNumpy2 (obj)

 

Check for a Numpy2LatLon points wrapper.

Arguments:
  • obj - The object (any type).
Returns:
True if obj is a Numpy2LatLon instance, False otherwise.

isPoints2 (obj)

 

Check for a LatLon2psxy points wrapper.

Arguments:
  • obj - The object (any type).
Returns:
True if obj is a LatLon2psxy instance, False otherwise.

isTuple2 (obj)

 

Check for a Tuple2LatLon points wrapper.

Arguments:
  • obj - The object (any).
Returns:
True if obj is a Tuple2LatLon instance, False otherwise.

iterNumpy2 (obj)

 

Iterate over Numpy2 wrappers or other sequences exceeding the threshold.

Arguments:
  • obj - Points array, list, sequence, set, etc. (any).
Returns:
True do, False don't iterate.

iterNumpy2over (n=None)

 

Get or set the iterNumpy2 threshold.

Arguments:
  • n - Optional, new threshold (int).
Returns:
Previous threshold (int).
Raises:
  • ValueError - Invalid n.

latDMS (deg, form='dms', prec=None, sep='', **s_D_M_S)

 

Convert latitude to a string, optionally suffixed with N or S.

Arguments:
Returns:
Degrees in the specified form (str).

See Also: Functions pygeodesy3.toDMS and pygeodesy3.lonDMS.

latlonDMS (lls, **m_form_prec_sep_s_D_M_S)

 

Convert one or more LatLon instances to strings.

Arguments:
  • lls - Single or list, sequence, tuple, etc. (LatLons).
  • m_form_prec_sep_s_D_M_S - Optional meter, format, precision, DEPRECATED sep, s_D, s_M, s_S and s_DMS keyword arguments, see method LatLon.toStr and functions pygeodesy3.latDMS and pygeodesy3.lonDMS.
Returns:
A tuple of strs if lls is a list, sequence, tuple, etc. of LatLon instances or a single str if lls is a single LatLon.

See Also: Functions pygeodesy3.latDMS, pygeodesy3.latlonDMS_, pygeodesy3.lonDMS and pygeodesy3.toDMS and method LatLon.toStr.

Note: Keyword argument sep=None to return a string instead of the tuple, has been DEPRECATED, use sep.join(latlonDMS_(...)).

latlonDMS_ (*lls, **m_form_prec_sep_s_D_M_S)

 

Convert one or more LatLon instances to strings.

Arguments:
  • lls - The instances, all positional arguments (LatLons).
  • m_form_prec_sep_s_D_M_S - Optional meter, format, precision, DEPRECATED sep, s_D, s_M, s_S and s_DMS keyword arguments, see method LatLon.toStr and functions pygeodesy3.latDMS and pygeodesy3.lonDMS.
Returns:
A tuple of strs if 2 or more LatLon instances or a single str if only a single LatLon instance is given in lls.

See Also: Function pygeodesy3.latlonDMS.

Note: Keyword argument sep=None to return a string instead of the tuple, has been DEPRECATED, use sep.join(latlonDMS_(...)).

limiterrors (raiser=None)

 

Get/set the throwing of LimitErrors.

Arguments:
  • raiser - Choose True to raise or False to ignore LimitError exceptions. Use None to leave the setting unchanged.
Returns:
Previous setting (bool).

lonDMS (deg, form='dms', prec=None, sep='', **s_D_M_S)

 

Convert longitude to a string, optionally suffixed with E or W.

Arguments:
Returns:
Degrees in the specified form (str).

See Also: Functions pygeodesy3.toDMS and pygeodesy3.latDMS.

lrstrip (txt, lrpairs={'(': ')', '<': '>', '[': ']', '{': '}'})

 

Left- and right-strip parentheses, brackets, etc. from a string.

Arguments:
  • txt - String to be stripped (str).
  • lrpairs - Parentheses, etc. to remove (dict of one or several (Left, Right) pairs).
Returns:
Stripped txt (str).

modulename (clas, prefixed=None)

 

Return the class name optionally prefixed with the module name.

Arguments:
  • clas - The class (any class).
  • prefixed - Include the module name (bool), see function classnaming.
Returns:
The class's [module.]class name (str).

nameof (inst)

 

Get the name of an instance.

Arguments:
  • inst - The object (any type).
Returns:
The instance' name (str) or "".

normDMS (strDMS, norm=None, **s_D_M_S)

 

Normalize all degrees, minutes and seconds (DMS) symbols in a string to the default symbols S_DEG, S_MIN, S_SEC.

Arguments:
  • strDMS - Original DMS string (str).
  • norm - Optional replacement symbol (str) or None for the default DMS symbols). Use norm="" to remove all DMS symbols.
  • s_D_M_S - Optional, alternate DMS symbols s_D=str, s_M=str, s_S=str and/or s_R=str for radians, each to be replaced by norm.
Returns:
Normalized DMS (str).

notImplemented (inst, *args, **kwds)

 

Raise a NotImplementedError for a missing instance method or property or for a missing caller feature.

Arguments:
  • inst - Instance (any) or None for caller.
  • args - Method or property positional arguments (any types).
  • kwds - Method or property keyword arguments (any types), except callername=NN, underOK=False and up=2.

notOverloaded (inst, *args, **kwds)

 

Raise an AssertionError for a method or property not overloaded.

Arguments:
  • inst - Instance (any).
  • args - Method or property positional arguments (any types).
  • kwds - Method or property keyword arguments (any types), except callername=NN, underOK=False and up=2.

pairs (items, prec=6, fmt='F', ints=False, sep='=')

 

Convert items to name=value strings, with floats handled like fstr.

Arguments:
  • items - Name-value pairs (dict or 2-{tuple}s of any types).
  • prec - The float precision, number of decimal digits (0..9). Trailing zero decimals are stripped if prec is positive, but kept for negative prec values.
  • fmt - Optional, float format (str).
  • ints - Optionally, remove the decimal dot for int values (bool).
  • sep - Separator joining names and values (str).
Returns:
A tuple(sep.join(t) for t in items)) of strs.

parse3llh (strllh, height=0, sep=',', clipLat=90, clipLon=180, wrap=False, **s_D_M_S)

 

Parse a string "lat, lon [, h]" representing lat-, longitude in degrees and optional height in meter.

The lat- and longitude value must be separated by a separator character. If height is present it must follow, separated by another separator.

The lat- and longitude values may be swapped, provided at least one ends with the proper compass point.

Arguments:
  • strllh - Latitude, longitude[, height] (str, ...).
  • height - Optional, default height (meter) or None.
  • sep - Optional separator between "lat lon [h] suffix" (str).
  • clipLat - Limit latitude to range -/+clipLat (degrees).
  • clipLon - Limit longitude to range -/+clipLon (degrees).
  • wrap - If True, wrap or normalize the lat- and longitude, overriding clipLat and clipLon (bool).
  • s_D_M_S - Optional, alternate symbol for degrees s_D=str, minutes s_M=str and/or seconds s_S=str.
Returns:
A LatLon3Tuple(lat, lon, height) in degrees, degrees and float.
Raises:
  • RangeError - Lat- or longitude value of strllh outside the valid -/+clipLat or -/+clipLon range and pygeodesy3.rangerrors set to True.
  • ValueError - Invalid strllh or height.

Note: See the Notes at function parseDMS.

See Also: Functions pygeodesy3.parseDDDMMSS, pygeodesy3.parseDMS, pygeodesy3.parseDMS2 and pygeodesy3.toDMS.

parseDDDMMSS (strDDDMMSS, suffix='NSEW', sep='', clip=0, sexagecimal=False)

 

Parse a lat- or longitude represention forms as [D]DDMMSS in degrees.

Arguments:
  • strDDDMMSS - Degrees in any of several forms (str) and types (float, int, other).
  • suffix - Optional, valid compass points (str, tuple).
  • sep - Optional separator between "[D]DD", "MM", "SS", suffix (S_SEP).
  • clip - Optionally, limit value to range -/+clip (degrees).
  • sexagecimal - If True, convert "D.MMSS" or float(D.MMSS) to base-60 "MM" and "SS" digits. See forms F_D60, F_D60_ and F_D60__.
Returns:
Degrees (float).
Raises:
  • ParseError - Invalid strDDDMMSS or clip or the form of strDDDMMSS is incompatible with the suffixed or suffix compass point.
  • RangeError - Value of strDDDMMSS outside the valid -/+clip range and pygeodesy3.rangerrors set to True.
Notes:
  • Type str values "[D]DD", "[D]DDMM", "[D]DDMMSS" and "[D]DD.MMSS" for strDDDMMSS are parsed properly only if either unsigned and suffixed with a valid, compatible, cardinal compassPoint or signed or unsigned, unsuffixed and with keyword argument suffix="NS", suffix="EW" or a compatible compassPoint.
  • Unlike function parseDMS, type float, int and other non-str strDDDMMSS values are interpreted as form [D]DDMMSS or [D]DD.MMSS. For example, int(1230) is returned as 12.5 and not 1230.0 degrees. However, int(345) is considered form "DDD" 345 and not "DDMM" 0345, unless suffix specifies the compass point. Also, float(15.0523) is returned as 15.0523 decimal degrees and not 15°5′23″ sexagecimal. To consider the latter, use float(15.0523) or "15.0523" and specify the keyword argument sexagecimal=True.

See Also: Functions pygeodesy3.parseDMS, pygeodesy3.parseDMS2 and pygeodesy3.parse3llh.

parseDMS (strDMS, suffix='NSEW', sep='', clip=0, **s_D_M_S)

 

Parse a lat- or longitude representation in degrees.

This is very flexible on formats, allowing signed decimal degrees, degrees and minutes or degrees minutes and seconds optionally suffixed by a cardinal compass point.

A variety of symbols, separators and suffixes are accepted, for example "3°37′09″W". Minutes and seconds may be omitted.

Arguments:
  • strDMS - Degrees in any of several forms (str) and types (float, int, other).
  • suffix - Optional, valid compass points (str, tuple).
  • sep - Optional separator between deg°, min′, sec″, suffix ('').
  • clip - Optionally, limit value to range -/+clip (degrees).
  • s_D_M_S - Optional, alternate symbol for degrees s_D=str, minutes s_M=str and/or seconds s_S=str.
Returns:
Degrees (float).
Raises:

Note: Unlike function parseDDDMMSS, type float, int and other non-str strDMS values are considered decimal (and not sexagecimal) degrees. For example, int(1230) is returned as 1230.0 and not as 12.5 degrees and float(345) as 345.0 and not as 3.75 degrees!

See Also: Functions pygeodesy3.parseDDDMMSS, pygeodesy3.parseDMS2, pygeodesy3.parse3llh and pygeodesy3.toDMS.

parseDMS2 (strLat, strLon, sep='', clipLat=90, clipLon=180, wrap=False, **s_D_M_S)

 

Parse a lat- and a longitude representions "lat, lon" in degrees.

Arguments:
  • strLat - Latitude in any of several forms (str or degrees).
  • strLon - Longitude in any of several forms (str or degrees).
  • sep - Optional separator between deg°, min′, sec″, suffix ('').
  • clipLat - Limit latitude to range -/+clipLat (degrees).
  • clipLon - Limit longitude to range -/+clipLon (degrees).
  • wrap - If True, wrap or normalize the lat- and longitude, overriding clipLat and clipLon (bool).
  • s_D_M_S - Optional, alternate symbol for degrees s_D=str, minutes s_M=str and/or seconds s_S=str.
Returns:
A LatLon2Tuple(lat, lon) in degrees.
Raises:

Note: See the Notes at function parseDMS.

See Also: Functions pygeodesy3.parseDDDMMSS, pygeodesy3.parseDMS, pygeodesy3.parse3llh and pygeodesy3.toDMS.

parseRad (strRad, suffix='NSEW', clip=0)

 

Parse a string representing angle in radians.

Arguments:
  • strRad - Degrees in any of several forms (str or radians).
  • suffix - Optional, valid compass points (str, tuple).
  • clip - Optionally, limit value to range -/+clip (radians).
Returns:
Radians (float).
Raises:

points2 (points, closed=True, base=None, Error=<class 'pygeodesy3.miscs.errors.PointsError'>)

 

Check a path or polygon represented by points.

Arguments:
  • points - The path or polygon points (LatLon[])
  • closed - Optionally, consider the polygon closed, ignoring any duplicate or closing final points (bool).
  • base - Optionally, check all points against this base class, if None don't check.
  • Error - Exception to raise (ValueError).
Returns:
A Points2Tuple(number, points) with the number of points and the points list or tuple.
Raises:
  • PointsError - Insufficient number of points.
  • TypeError - Some points are not base compatible or composite points.

precision (form, prec=None)

 

Set the default precison for a given F_ form.

Arguments:
Returns:
Previous precision for the form (int).
Raises:
  • ValueError - Invalid form or prec or prec outside the valid range -/+9.

property_doc_ (doc)

 

Decorator for a standard property with basic documentation.

Arguments:
  • doc - The property documentation (str).

Example:

>>> @property_doc_("documentation text.")
>>> def name(self):
>>>     ...
>>>
>>> @name.setter
>>> def name(self, value):
>>>     ...

rangerrors (raiser=None)

 

Get/set the throwing of RangeErrors.

Arguments:
  • raiser - Choose True to raise or False to ignore RangeError exceptions. Use None to leave the setting unchanged.
Returns:
Previous setting (bool).

reprs (objs, prec=6, fmt='F', ints=False)

 

Convert objects to repr strings, with floats handled like fstr.

Arguments:
  • objs - List, sequence, tuple, etc. (any types).
  • prec - The float precision, number of decimal digits (0..9). Trailing zero decimals are stripped if prec is positive, but kept for negative prec values.
  • fmt - Optional, float format (str).
  • ints - Optionally, remove the decimal dot for int values (bool).
Returns:
A tuple(map(fstr|repr, objs)) of strs.

strs (objs, prec=6, fmt='F', ints=False)

 

Convert objects to str strings, with floats handled like fstr.

Arguments:
  • objs - List, sequence, tuple, etc. (any types).
  • prec - The float precision, number of decimal digits (0..9). Trailing zero decimals are stripped if prec is positive, but kept for negative prec values.
  • fmt - Optional, float format (str).
  • ints - Optionally, remove the decimal dot for int values (bool).
Returns:
A tuple(map(fstr|str, objs)) of strs.

toDMS (deg, form='dms', prec=2, sep='', ddd=2, neg='-', pos='+', **s_D_M_S)

 

Convert signed degrees to string, without suffix.

Arguments:
Returns:
Degrees in the specified form (str).
Notes:
  • The degrees, minutes and seconds (DMS) symbol can be overridden in this and other *DMS functions by using optional keyword argments s_D="d", s_M="'" respectively s_S='"'. Using keyword argument s_DMS=None cancels all DMS symbols to S_NUL=NN.
  • Sexagecimal format F_D60 supports overridable pseudo-DMS symbols positioned at "[D]DD<s_D>MM<s_M>SS<s_S>" with defaults s_D=".", s_M=sep and s_S=pygeodesy3.NN.
  • Formats F__E, F__F and F__G can be extended with a D-only symbol if defined with keyword argument s_D=str. Likewise for F_RAD formats with keyword argument s_R=str.

See Also: Function pygeodesy3.degDMS

unstr (where, *args, **kwds)

 

Return the string representation of an invokation.

Arguments:
  • where - Class, function, method (type) or name (str).
  • args - Optional positional arguments.
  • kwds - Optional keyword arguments, except _ELLIPSIS=False.
Returns:
Representation (str).