Coverage for pygeodesy/heights.py : 95%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
# -*- coding: utf-8 -*-
Classes L{HeightCubic}, L{HeightIDWcosineAndoyerLambert}, L{HeightIDWcosineForsytheAndoyerLambert}, L{HeightIDWcosineLaw}, L{HeightIDWdistanceTo}, L{HeightIDWequirectangular}, L{HeightIDWeuclidean}, L{HeightIDWflatLocal}, L{HeightIDWflatPolar}, L{HeightIDWhaversine}, L{HeightIDWhubeny}, L{HeightIDWkarney}, L{HeightIDWthomas}, L{HeightIDWvincentys}, L{HeightLinear}, L{HeightLSQBiSpline} and L{HeightSmoothBiSpline} to interpolate the height of C{LatLon} locations or separate lat-/longitudes from a set of C{LatLon} points with C{known} heights.
Classes L{HeightCubic} and L{HeightLinear} require package U{numpy <https://PyPI.org/project/numpy>}, classes L{HeightLSQBiSpline} and L{HeightSmoothBiSpline} require package U{scipy<https://SciPy.org>}. Classes L{HeightIDWkarney} and L{HeightIDWdistanceTo} -iff used with L{ellipsoidalKarney.LatLon} points- require I{Karney}'s U{geographiclib <https://PyPI.org/project/geographiclib>} to be installed.
B{Typical usage} is as follows. First, create an interpolator from a given set of C{LatLon} points with C{known} heights, called C{knots}.
C{>>> hinterpolator = HeightXyz(knots, **options)}
Then, get the interpolated height of other C{LatLon} location(s) with
C{>>> h = hinterpolator(ll)}
or
C{>>> h0, h1, h2, ... = hinterpolator(ll0, ll1, ll2, ...)}
or
C{>>> hs = hinterpolator(lls) # list, tuple, generator, ...}
For separate lat- and longitudes invoke the C{.height} method
C{>>> h = hinterpolator.height(lat, lon)}
or
C{>>> h0, h1, h2, ... = hinterpolator.height(lats, lons) # lists, tuples, ...}
The C{knots} do not need to be ordered for any of the height interpolators.
Errors from C{scipy} as raised as L{SciPyError}s. Warnings issued by C{scipy} can be thrown as L{SciPyWarning} exceptions, provided Python C{warnings} are filtered accordingly, see L{SciPyWarning}.
@see: U{SciPy<https://docs.SciPy.org/doc/scipy/reference/interpolate.html>}. ''' # make sure int/int division yields float quotient, see .basics
cosineLaw_, euclidean_, flatPolar_, haversine_, \ _scale_rad, thomas_, vincentys_ _distanceTo_, _knots_, _len_, _linear_, _scipy_, \ _0_0
'''Height interpolator C{Height...} or interpolation issue. '''
# return list of floats, not numpy.float64s
# dtermine return type and convert lli C{LatLon}s to list raise _AssertionError('type(%s): %r' % ('*llis', llis))
else: # of 0, 2 or more llis
raise _insufficientError(m, Error=Error, llis=n)
# return single float, not numpy.float64 raise _AssertionError('%s(%r): %s != 1' % (_len_, ais, len(ais)))
# return tuple of floats, not numpy.float64s
# convert lli C{LatLon}s to tuples or C{NumPy} arrays of # C{SciPy} sphericals and determine the return type
# create an insufficient Error instance t = 'insufficient, need %s' % (need,) return Error(txt=t, **name_value)
# clip, order and remove duplicates
# map (lat, lon, h) to (x, y, h) in radians, offset as # x: 0 <= lon <= PI2, y: 0 <= lat <= PI if off is True # else x: -PI <= lon <= PI, y: -PI_2 <= lat <= PI_2 else: # undo offset (max(0.0, radiansPI( ll.lat + 90.0)) - yf), ll.height raise HeightError(i, ll, txt=str(x))
# convert knot C{LatLon}s to tuples or C{NumPy} arrays and C{SciPy} sphericals raise _insufficientError(m, knots=n)
'''(INTERNAL) Interpolator base class. '''
def __call__(self, *args): # PYCHOK no cover '''(INTERNAL) I{Must be overloaded}, see function C{notOverloaded}. ''' notOverloaded(self, callername='__call__', *args)
'''Get the adjust setting (C{bool} or C{None} if not applicable). '''
'''Get the datum (L{Datum} or C{None} if not applicable). '''
def _ev(self, *args): # PYCHOK no cover '''(INTERNAL) I{Must be overloaded}, see function C{notOverloaded}. ''' notOverloaded(self, *args)
except Exception as x: raise _SciPyIssue(x)
else: # format a LenError, but raise an Error e = LenError(self.__class__, lats=n, lons=m, txt=None) raise e if Error is LenError else Error(str(e))
'''Get the minimum number of knots (C{int}). '''
'''(INTERNAL) Import C{numpy} and C{scipy}, once. ''' if throwarnings: # raise SciPyWarnings, but ... # ... not if scipy has been imported already import sys if _scipy_ not in sys.modules: import warnings warnings.filterwarnings('error')
'''Get the wrap setting (C{bool} or C{None} if not applicable). '''
'''Height interpolator based on C{SciPy} U{interp2d<https://docs.SciPy.org/ doc/scipy/reference/generated/scipy.interpolate.interp2d.html>} C{kind='cubic'}. '''
'''New L{HeightCubic} interpolator.
@arg knots: The points with known height (C{LatLon}s). @kwarg name: Optional name for this height interpolator (C{str}).
@raise HeightError: Insufficient number of B{C{knots}} or invalid B{C{knot}}.
@raise ImportError: Package C{numpy} or C{scipy} not found or not installed.
@raise SciPyError: A C{scipy.interpolate.interp2d} issue.
@raise SciPyWarning: A C{scipy.interpolate.interp2d} warning as exception. '''
except Exception as x: raise _SciPyIssue(x)
self.name = name
'''Interpolate the height for one or several locations.
@arg llis: The location or locations (C{LatLon}, ... or C{LatLon}s).
@return: A single interpolated height (C{float}) or a list or tuple of interpolated heights (C{float}s).
@raise HeightError: Insufficient number of B{C{llis}} or an invalid B{C{lli}}.
@raise SciPyError: A C{scipy.interpolate.interp2d} issue.
@raise SciPyWarning: A C{scipy.interpolate.interp2d} warning as exception. '''
# to make SciPy .interp2d signature(x, y), single (x, y) # match SciPy .ev signature(ys, xs), flipped multiples
'''Interpolate the height for one or several lat-/longitudes.
@arg lats: Latitude or latitudes (C{degrees} or C{degrees}s). @arg lons: Longitude or longitudes (C{degrees} or C{degrees}s).
@return: A single interpolated height (C{float}) or a list of interpolated heights (C{float}s).
@raise HeightError: Insufficient or non-matching number of B{C{lats}} and B{C{lons}}.
@raise SciPyError: A C{scipy.interpolate.interp2d} issue.
@raise SciPyWarning: A C{scipy.interpolate.interp2d} warning as exception. '''
'''Height interpolator based on C{SciPy} U{interp2d<https://docs.SciPy.org/ doc/scipy/reference/generated/scipy.interpolate.interp2d.html>} C{kind='linear'}. '''
'''New L{HeightLinear} interpolator.
@arg knots: The points with known height (C{LatLon}s). @kwarg name: Optional name for this height interpolator (C{str}).
@raise HeightError: Insufficient number of B{C{knots}} or an invalid B{C{knot}}.
@raise ImportError: Package C{numpy} or C{scipy} not found or not installed.
@raise SciPyError: A C{scipy.interpolate.interp2d} issue.
@raise SciPyWarning: A C{scipy.interpolate.interp2d} warning as exception. '''
if _FOR_DOCS: __call__ = HeightCubic.__call__ height = HeightCubic.height
'''(INTERNAL) Base class for U{Inverse Distance Weighting <https://WikiPedia.org/wiki/Inverse_distance_weighting>} (IDW) height interpolators. '''
'''New L{_HeightIDW} interpolator. ''' self.name = name
'''Interpolate the height for one or several locations.
@arg llis: The location or locations (C{LatLon}, ... or C{LatLon}s).
@return: A single interpolated height (C{float}) or a list or tuple of interpolated heights (C{float}s).
@raise HeightError: Insufficient number of B{C{llis}}, an invalid B{C{lli}} or an L{fidw} issue. '''
'''(INTERNAL) Set the datum.
@raise TypeError: Invalid B{C{datum}}. '''
'''(INTERNAL) I{Must be overloaded}, see function C{notOverloaded}. ''' notOverloaded(self, x, y)
# return angular distances from func_
# return angular distances from func_
# interpolate height at (x, y) radians or degrees except (TypeError, ValueError) as x: raise HeightError(str(x))
'''Get the inverse distance power (C{int}). '''
'''Set the inverse distance power.
@arg beta: New inverse distance power (C{int} 1, 2, or 3).
@raise HeightError: Invalid B{C{beta}}. '''
'''Interpolate the height for one or several lat-/longitudes.
@arg lats: Latitude or latitudes (C{degrees} or C{degrees}s). @arg lons: Longitude or longitudes (C{degrees} or C{degrees}s).
@return: A single interpolated height (C{float}) or a list of interpolated heights (C{float}s).
@raise HeightError: Insufficient or non-matching number of B{C{lats}} and B{C{lons}} or an L{fidw} issue. '''
'''Height interpolator using U{Inverse Distance Weighting <https://WikiPedia.org/wiki/Inverse_distance_weighting>} (IDW) and the I{angular} distance in C{radians} from function L{cosineAndoyerLambert_}.
@see: L{HeightIDWcosineForsytheAndoyerLambert}, L{HeightIDWdistanceTo}, L{HeightIDWflatLocal}, L{HeightIDWhubeny}, L{HeightIDWthomas}, U{IDW<https://www.Geo.FU-Berlin.DE/en/v/soga/Geodata-analysis/ geostatistics/Inverse-Distance-Weighting/index.html>} and U{SHEPARD_INTERP_2D<https://People.SC.FSU.edu/~jburkardt/c_src/ shepard_interp_2d/shepard_interp_2d.html>}. '''
'''New L{HeightIDWcosineAndoyerLambert} interpolator.
@arg knots: The points with known height (C{LatLon}s). @kwarg datum: Optional datum overriding the default C{Datums.WGS84} and first B{C{knots}}' datum (L{Datum}, L{Ellipsoid}, L{Ellipsoid2} or L{a_f2Tuple}). @kwarg beta: Inverse distance power (C{int} 1, 2, or 3). @kwarg wrap: Wrap and L{unrollPI} longitudes (C{bool}). @kwarg name: Optional name for this height interpolator (C{str}).
@raise HeightError: Insufficient number of B{C{knots}} or an invalid B{C{knot}} or B{C{beta}}.
@raise TypeError: Invalid B{C{datum}}. '''
if _FOR_DOCS: __call__ = _HeightIDW.__call__ height = _HeightIDW.height
'''Height interpolator using U{Inverse Distance Weighting <https://WikiPedia.org/wiki/Inverse_distance_weighting>} (IDW) and the I{angular} distance in C{radians} from function L{cosineForsytheAndoyerLambert_}.
@see: L{HeightIDWcosineAndoyerLambert}, L{HeightIDWdistanceTo}, L{HeightIDWflatLocal}, L{HeightIDWhubeny}, L{HeightIDWthomas}, U{IDW<https://www.Geo.FU-Berlin.DE/en/v/soga/Geodata-analysis/ geostatistics/Inverse-Distance-Weighting/index.html>} and U{SHEPARD_INTERP_2D<https://People.SC.FSU.edu/~jburkardt/c_src/ shepard_interp_2d/shepard_interp_2d.html>}. '''
'''New L{HeightIDWcosineForsytheAndoyerLambert} interpolator.
@arg knots: The points with known height (C{LatLon}s). @kwarg datum: Optional datum overriding the default C{Datums.WGS84} and first B{C{knots}}' datum (L{Datum}, L{Ellipsoid}, L{Ellipsoid2} or L{a_f2Tuple}). @kwarg beta: Inverse distance power (C{int} 1, 2, or 3). @kwarg wrap: Wrap and L{unrollPI} longitudes (C{bool}). @kwarg name: Optional name for this height interpolator (C{str}).
@raise HeightError: Insufficient number of B{C{knots}} or an invalid B{C{knot}} or B{C{beta}}.
@raise TypeError: Invalid B{C{datum}}. '''
if _FOR_DOCS: __call__ = _HeightIDW.__call__ height = _HeightIDW.height
'''Height interpolator using U{Inverse Distance Weighting <https://WikiPedia.org/wiki/Inverse_distance_weighting>} (IDW) and the I{angular} distance in C{radians} from function L{cosineLaw_}.
@see: L{HeightIDWequirectangular}, L{HeightIDWeuclidean}, L{HeightIDWflatPolar}, L{HeightIDWhaversine}, L{HeightIDWvincentys}, U{IDW<https://www.Geo.FU-Berlin.DE/en/v/soga/Geodata-analysis/ geostatistics/Inverse-Distance-Weighting/index.html>} and U{SHEPARD_INTERP_2D<https://People.SC.FSU.edu/~jburkardt/c_src/ shepard_interp_2d/shepard_interp_2d.html>}.
@note: See note at function L{vincentys_}. '''
'''New L{HeightIDWcosineLaw} interpolator.
@arg knots: The points with known height (C{LatLon}s). @kwarg beta: Inverse distance power (C{int} 1, 2, or 3). @kwarg wrap: Wrap and L{unrollPI} longitudes (C{bool}). @kwarg name: Optional name for this height interpolator (C{str}).
@raise HeightError: Insufficient number of B{C{knots}} or an invalid B{C{knot}} or B{C{beta}}. '''
if _FOR_DOCS: __call__ = _HeightIDW.__call__ height = _HeightIDW.height
'''Height interpolator using U{Inverse Distance Weighting <https://WikiPedia.org/wiki/Inverse_distance_weighting>} (IDW) and the distance from the points' C{LatLon.distanceTo} method, conventionally in C{meter}.
@see: L{HeightIDWcosineAndoyerLambert}, L{HeightIDWcosineForsytheAndoyerLambert}, L{HeightIDWflatPolar}, L{HeightIDWkarney}, L{HeightIDWthomas}, U{IDW<https://www.Geo.FU-Berlin.DE/en/v/soga/Geodata-analysis/ geostatistics/Inverse-Distance-Weighting/index.html>} and U{SHEPARD_INTERP_2D<https://People.SC.FSU.edu/~jburkardt/c_src/ shepard_interp_2d/shepard_interp_2d.html>}. '''
'''New L{HeightIDWdistanceTo} interpolator.
@arg knots: The points with known height (C{LatLon}s). @kwarg beta: Inverse distance power (C{int} 1, 2, or 3). @kwarg name: Optional name for this height interpolator (C{str}). @kwarg distanceTo_kwds: Optional keyword arguments for the B{C{points}}' C{LatLon.distanceTo} method.
@raise HeightError: Insufficient number of B{C{knots}} or an invalid B{C{knot}} or B{C{beta}}.
@raise ImportError: Package U{geographiclib <https://PyPI.org/project/geographiclib>} missing iff B{C{points}} are L{ellipsoidalKarney.LatLon}s.
@note: All B{C{points}} I{must} be instances of the same ellipsoidal or spherical C{LatLon} class, I{not checked however}. ''' raise _insufficientError(self._kmin, knots=n) i = Fmt.SQUARE(_knots_, i) raise HeightError(i, k, txt=_distanceTo_)
# use knots[0] class and datum to create # compatible points in _HeightBase._height # instead of class LatLon_ and datum None
self.name = name self._distanceTo_kwds = distanceTo_kwds
'''Interpolate the height for one or several locations.
@arg llis: The location or locations (C{LatLon}, ... or C{LatLon}s).
@return: A single interpolated height (C{float}) or a list or tuple of interpolated heights (C{float}s).
@raise HeightError: Insufficient number of B{C{llis}}, an invalid B{C{lli}} or an L{fidw} issue. '''
if _FOR_DOCS: height = _HeightIDW.height
# interpolate height at point lli raise HeightError(str(x))
'''Height interpolator using U{Inverse Distance Weighting <https://WikiPedia.org/wiki/Inverse_distance_weighting>} (IDW) and the I{angular} distance in C{radians squared} like function L{equirectangular_}.
@see: L{HeightIDWeuclidean}, L{HeightIDWflatPolar}, L{HeightIDWhaversine}, L{HeightIDWvincentys}, U{IDW<https://www.Geo.FU-Berlin.DE/en/v/soga/Geodata-analysis/ geostatistics/Inverse-Distance-Weighting/index.html>} and U{SHEPARD_INTERP_2D<https://People.SC.FSU.edu/~jburkardt/c_src/ shepard_interp_2d/shepard_interp_2d.html>}. '''
'''New L{HeightIDWequirectangular} interpolator.
@arg knots: The points with known height (C{LatLon}s). @kwarg adjust: Adjust the wrapped, unrolled longitudinal delta by the cosine of the mean latitude (C{bool}). @kwarg wrap: Wrap and L{unrollPI} longitudes (C{bool}). @kwarg name: Optional name for this height interpolator (C{str}).
@raise HeightError: Insufficient number of B{C{knots}} or an invalid B{C{knot}}. ''' adjust=adjust)
if _FOR_DOCS: __call__ = _HeightIDW.__call__ height = _HeightIDW.height
'''Height interpolator using U{Inverse Distance Weighting <https://WikiPedia.org/wiki/Inverse_distance_weighting>} (IDW) and the I{angular} distance in C{radians} from function L{euclidean_}.
@see: L{HeightIDWcosineLaw}, L{HeightIDWequirectangular}, L{HeightIDWhaversine}, L{HeightIDWvincentys}, U{IDW<https://www.Geo.FU-Berlin.DE/en/v/soga/Geodata-analysis/ geostatistics/Inverse-Distance-Weighting/index.html>} and U{SHEPARD_INTERP_2D<https://People.SC.FSU.edu/~jburkardt/c_src/ shepard_interp_2d/shepard_interp_2d.html>}. '''
'''New L{HeightIDWeuclidean} interpolator.
@arg knots: The points with known height (C{LatLon}s). @kwarg adjust: Adjust the longitudinal delta by the cosine of the mean latitude for B{C{adjust}}=C{True}. @kwarg beta: Inverse distance power (C{int} 1, 2, or 3). @kwarg name: Optional name for this height interpolator (C{str}).
@raise HeightError: Insufficient number of B{C{knots}} or an invalid B{C{knot}} or B{C{beta}}. '''
if _FOR_DOCS: __call__ = _HeightIDW.__call__ height = _HeightIDW.height
'''Height interpolator using U{Inverse Distance Weighting <https://WikiPedia.org/wiki/Inverse_distance_weighting>} (IDW) and the I{angular} distance in C{radians squared} like function L{flatLocal_}/L{hubeny_}.
@see: L{HeightIDWcosineAndoyerLambert}, L{HeightIDWcosineForsytheAndoyerLambert}, L{HeightIDWdistanceTo}, L{HeightIDWhubeny}, L{HeightIDWthomas}, U{IDW<https://www.Geo.FU-Berlin.DE/en/v/soga/Geodata-analysis/ geostatistics/Inverse-Distance-Weighting/index.html>} and U{SHEPARD_INTERP_2D<https://People.SC.FSU.edu/~jburkardt/c_src/ shepard_interp_2d/shepard_interp_2d.html>}. '''
'''New L{HeightIDWflatLocal}/L{HeightIDWhubeny} interpolator.
@arg knots: The points with known height (C{LatLon}s). @kwarg datum: Optional datum overriding the default C{Datums.WGS84} and first B{C{knots}}' datum (L{Datum}, L{Ellipsoid}, L{Ellipsoid2} or L{a_f2Tuple}). @kwarg beta: Inverse distance power (C{int} 1, 2, or 3). @kwarg wrap: Wrap and L{unrollPI} longitudes (C{bool}). @kwarg name: Optional name for this height interpolator (C{str}).
@raise HeightError: Insufficient number of B{C{knots}} or an invalid B{C{knot}} or B{C{beta}}.
@raise TypeError: Invalid B{C{datum}}. '''
if _FOR_DOCS: __call__ = _HeightIDW.__call__ height = _HeightIDW.height
'''Height interpolator using U{Inverse Distance Weighting <https://WikiPedia.org/wiki/Inverse_distance_weighting>} (IDW) and the I{angular} distance in C{radians} from function L{flatPolar_}.
@see: L{HeightIDWcosineLaw}, L{HeightIDWequirectangular}, L{HeightIDWeuclidean}, L{HeightIDWhaversine}, L{HeightIDWvincentys}, U{IDW<https://www.Geo.FU-Berlin.DE/en/v/soga/Geodata-analysis/ geostatistics/Inverse-Distance-Weighting/index.html>} and U{SHEPARD_INTERP_2D<https://People.SC.FSU.edu/~jburkardt/c_src/ shepard_interp_2d/shepard_interp_2d.html>}. '''
'''New L{HeightIDWflatPolar} interpolator.
@arg knots: The points with known height (C{LatLon}s). @kwarg beta: Inverse distance power (C{int} 1, 2, or 3). @kwarg wrap: Wrap and L{unrollPI} longitudes (C{bool}). @kwarg name: Optional name for this height interpolator (C{str}).
@raise HeightError: Insufficient number of B{C{knots}} or an invalid B{C{knot}} or B{C{beta}}. '''
if _FOR_DOCS: __call__ = _HeightIDW.__call__ height = _HeightIDW.height
'''Height interpolator using U{Inverse Distance Weighting <https://WikiPedia.org/wiki/Inverse_distance_weighting>} (IDW) and the I{angular} distance in C{radians} from function L{haversine_}.
@see: L{HeightIDWcosineLaw}, L{HeightIDWequirectangular}, L{HeightIDWeuclidean}, L{HeightIDWflatPolar}, L{HeightIDWvincentys}, U{IDW<https://www.Geo.FU-Berlin.DE/en/v/soga/Geodata-analysis/ geostatistics/Inverse-Distance-Weighting/index.html>} and U{SHEPARD_INTERP_2D<https://People.SC.FSU.edu/~jburkardt/c_src/ shepard_interp_2d/shepard_interp_2d.html>}.
@note: See note at function L{vincentys_}. '''
'''New L{HeightIDWhaversine} interpolator.
@arg knots: The points with known height (C{LatLon}s). @kwarg beta: Inverse distance power (C{int} 1, 2, or 3). @kwarg wrap: Wrap and L{unrollPI} longitudes (C{bool}). @kwarg name: Optional name for this height interpolator (C{str}).
@raise HeightError: Insufficient number of B{C{knots}} or an B{C{knot}} or B{C{beta}}. '''
if _FOR_DOCS: __call__ = _HeightIDW.__call__ height = _HeightIDW.height
if _FOR_DOCS: __doc__ = HeightIDWflatLocal.__doc__ __init__ = HeightIDWflatLocal.__init__ __call__ = HeightIDWflatLocal.__call__ height = HeightIDWflatLocal.height
'''Height interpolator using U{Inverse Distance Weighting <https://WikiPedia.org/wiki/Inverse_distance_weighting>} (IDW) and the I{angular} distance in C{degrees} from I{Karney}'s U{geographiclib<https://PyPI.org/project/geographiclib>} U{Geodesic <https://GeographicLib.SourceForge.io/html/python/code.html>} Inverse method.
@see: L{HeightIDWcosineAndoyerLambert}, L{HeightIDWcosineForsytheAndoyerLambert}, L{HeightIDWdistanceTo}, L{HeightIDWflatLocal}, L{HeightIDWhubeny}, L{HeightIDWthomas}, U{IDW<https://www.Geo.FU-Berlin.DE/en/v/soga/Geodata-analysis/ geostatistics/Inverse-Distance-Weighting/index.html>} and U{SHEPARD_INTERP_2D<https://People.SC.FSU.edu/~jburkardt/c_src/ shepard_interp_2d/shepard_interp_2d.html>}. '''
'''New L{HeightIDWkarney} interpolator.
@arg knots: The points with known height (C{LatLon}s). @kwarg datum: Optional datum overriding the default C{Datums.WGS84} and first B{C{knots}}' datum (L{Datum}, L{Ellipsoid}, L{Ellipsoid2} or L{a_f2Tuple}). @kwarg beta: Inverse distance power (C{int} 1, 2, or 3). @kwarg wrap: Wrap and L{unroll180} longitudes (C{bool}). @kwarg name: Optional name for this height interpolator (C{str}).
@raise HeightError: Insufficient number of B{C{knots}} or an invalid B{C{knot}}, B{C{datum}} or B{C{beta}}.
@raise ImportError: Package U{geographiclib <https://PyPI.org/project/geographiclib>} missing.
@raise TypeError: Invalid B{C{datum}}. ''' raise _insufficientError(self._kmin, knots=n)
self.name = name
# non-negative I{angular} distance in C{degrees}
'''Interpolate the height for one or several locations.
@arg llis: The location or locations (C{LatLon}, ... or C{LatLon}s).
@return: A single interpolated height (C{float}) or a list or tuple of interpolated heights (C{float}s).
@raise HeightError: Insufficient number of B{C{llis}}, an invalid B{C{lli}} or an L{fidw} issue. ''' raise HeightError(i, ll, txt=str(x))
if _FOR_DOCS: height = _HeightIDW.height
'''Height interpolator using U{Inverse Distance Weighting <https://WikiPedia.org/wiki/Inverse_distance_weighting>} (IDW) and the I{angular} distance in C{radians} from function L{thomas_}.
@see: L{HeightIDWcosineAndoyerLambert}, L{HeightIDWcosineForsytheAndoyerLambert}, L{HeightIDWdistanceTo}, L{HeightIDWflatLocal}, L{HeightIDWhubeny}, U{IDW<https://www.Geo.FU-Berlin.DE/en/v/soga/Geodata-analysis/ geostatistics/Inverse-Distance-Weighting/index.html>} and U{SHEPARD_INTERP_2D<https://People.SC.FSU.edu/~jburkardt/c_src/ shepard_interp_2d/shepard_interp_2d.html>}. '''
'''New L{HeightIDWthomas} interpolator.
@arg knots: The points with known height (C{LatLon}s). @kwarg datum: Optional datum overriding the default C{Datums.WGS84} and first B{C{knots}}' datum (L{Datum}, L{Ellipsoid}, L{Ellipsoid2} or L{a_f2Tuple}). @kwarg beta: Inverse distance power (C{int} 1, 2, or 3). @kwarg wrap: Wrap and L{unrollPI} longitudes (C{bool}). @kwarg name: Optional name for this height interpolator (C{str}).
@raise HeightError: Insufficient number of B{C{knots}} or an invalid B{C{knot}} or B{C{beta}}.
@raise TypeError: Invalid B{C{datum}}. '''
if _FOR_DOCS: __call__ = _HeightIDW.__call__ height = _HeightIDW.height
'''Height interpolator using U{Inverse Distance Weighting <https://WikiPedia.org/wiki/Inverse_distance_weighting>} (IDW) and the I{angular} distance in C{radians} from function L{vincentys_}.
@see: L{HeightIDWcosineLaw}, L{HeightIDWequirectangular}, L{HeightIDWeuclidean}, L{HeightIDWflatPolar}, L{HeightIDWhaversine}, U{IDW<https://www.Geo.FU-Berlin.DE/en/v/soga/Geodata-analysis/ geostatistics/Inverse-Distance-Weighting/index.html>} and U{SHEPARD_INTERP_2D<https://People.SC.FSU.edu/~jburkardt/c_src/ shepard_interp_2d/shepard_interp_2d.html>}.
@note: See note at function L{vincentys_}. '''
'''New L{HeightIDWvincentys} interpolator.
@arg knots: The points with known height (C{LatLon}s). @kwarg beta: Inverse distance power (C{int} 1, 2, or 3). @kwarg wrap: Wrap and L{unrollPI} longitudes (C{bool}). @kwarg name: Optional name for this height interpolator (C{str}).
@raise HeightError: Insufficient number of B{C{knots}} or an invalid B{C{knot}} or B{C{beta}}. '''
if _FOR_DOCS: __call__ = _HeightIDW.__call__ height = _HeightIDW.height
'''Height interpolator using C{SciPy} U{LSQSphereBivariateSpline <https://docs.SciPy.org/doc/scipy/reference/generated/scipy. interpolate.LSQSphereBivariateSpline.html>}. '''
'''New L{HeightLSQBiSpline} interpolator.
@arg knots: The points with known height (C{LatLon}s). @kwarg weight: Optional weight or weights for each B{C{knot}} (C{scalar} or C{scalar}s). @kwarg name: Optional name for this height interpolator (C{str}).
@raise HeightError: Insufficient number of B{C{knots}} or an invalid B{C{knot}} or B{C{weight}}.
@raise LenError: Unequal number of B{C{knots}} and B{C{weight}}s.
@raise ImportError: Package C{numpy} or C{scipy} not found or not installed.
@raise SciPyError: A C{LSQSphereBivariateSpline} issue.
@raise SciPyWarning: A C{LSQSphereBivariateSpline} warning as exception. '''
raise HeightError(weight=w) raise LenError(HeightLSQBiSpline, weight=m, knots=n) w = Fmt.SQUARE(weight=w.find(m)) raise HeightError(w, m) ts, ps, eps=EPS, w=w).ev except Exception as x: raise _SciPyIssue(x)
self.name = name
'''Interpolate the height for one or several locations.
@arg llis: The location or locations (C{LatLon}, ... or C{LatLon}s).
@return: A single interpolated height (C{float}) or a list or tuple of interpolated heights (C{float}s).
@raise HeightError: Insufficient number of B{C{llis}} or an invalid B{C{lli}}.
@raise SciPyError: A C{LSQSphereBivariateSpline} issue.
@raise SciPyWarning: A C{LSQSphereBivariateSpline} warning as exception. '''
'''Interpolate the height for one or several lat-/longitudes.
@arg lats: Latitude or latitudes (C{degrees} or C{degrees}s). @arg lons: Longitude or longitudes (C{degrees} or C{degrees}s).
@return: A single interpolated height (C{float}) or a list of interpolated heights (C{float}s).
@raise HeightError: Insufficient or non-matching number of B{C{lats}} and B{C{lons}}.
@raise SciPyError: A C{LSQSphereBivariateSpline} issue.
@raise SciPyWarning: A C{LSQSphereBivariateSpline} warning as exception. '''
'''Height interpolator using C{SciPy} U{SmoothSphereBivariateSpline <https://docs.SciPy.org/doc/scipy/reference/generated/scipy. interpolate.SmoothSphereBivariateSpline.html>}. '''
'''New L{HeightSmoothBiSpline} interpolator.
@arg knots: The points with known height (C{LatLon}s). @kwarg s: The spline smoothing factor (C{4}). @kwarg name: Optional name for this height interpolator (C{str}).
@raise HeightError: Insufficient number of B{C{knots}} or an invalid B{C{knot}} or B{C{s}}.
@raise ImportError: Package C{numpy} or C{scipy} not found or not installed.
@raise SciPyError: A C{SmoothSphereBivariateSpline} issue.
@raise SciPyWarning: A C{SmoothSphereBivariateSpline} warning as exception. '''
eps=EPS, s=s).ev except Exception as x: raise _SciPyIssue(x)
self.name = name
'''Interpolate the height for one or several locations.
@arg llis: The location or locations (C{LatLon}, ... or C{LatLon}s).
@return: A single interpolated height (C{float}) or a list or tuple of interpolated heights (C{float}s).
@raise HeightError: Insufficient number of B{C{llis}} or an invalid B{C{lli}}.
@raise SciPyError: A C{SmoothSphereBivariateSpline} issue.
@raise SciPyWarning: A C{SmoothSphereBivariateSpline} warning as exception. '''
'''Interpolate the height for one or several lat-/longitudes.
@arg lats: Latitude or latitudes (C{degrees} or C{degrees}s). @arg lons: Longitude or longitudes (C{degrees} or C{degrees}s).
@return: A single interpolated height (C{float}) or a list of interpolated heights (C{float}s).
@raise HeightError: Insufficient or non-matching number of B{C{lats}} and B{C{lons}}.
@raise SciPyError: A C{SmoothSphereBivariateSpline} issue.
@raise SciPyWarning: A C{SmoothSphereBivariateSpline} warning as exception. '''
# **) MIT License # # Copyright (C) 2016-2021 -- mrJean1 at Gmail -- All Rights Reserved. # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "Software"), # to deal in the Software without restriction, including without limitation # the rights to use, copy, modify, merge, publish, distribute, sublicense, # and/or sell copies of the Software, and to permit persons to whom the # Software is furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included # in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR # OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR # OTHER DEALINGS IN THE SOFTWARE. |