コード例 #1
0
ファイル: bases.py プロジェクト: N-Razzouk/PyGeodesy
    def latlon(self, latlonh):
        '''Set the lat- and longitude and optionally the height.

           @param latlonh: New lat-, longitude and height (2- or
                           3-tuple of C{degrees} and C{meter}).

           @raise TypeError: Height of I{latlonh} not C{scalar} or
                             I{latlonh} not C{list} or C{tuple}.

           @raise ValueError: Invalid I{latlonh} or M{len(latlonh)}.

           @see: Function L{parse3llh} to parse a I{latlonh} string
                 into a 3-tuple (lat, lon, h).
        '''
        if not isinstance(latlonh, (list, tuple)):
            raise TypeError('%s invalid: %r' % ('latlonh', latlonh))

        if len(latlonh) == 3:
            h = scalar(latlonh[2], None, name='latlonh')
        elif len(latlonh) != 2:
            raise ValueError('%s invalid: %r' % ('latlonh', latlonh))
        else:
            h = self._height

        lat, lon = parseDMS2(latlonh[0], latlonh[1])
        self._update(lat != self._lat or
                     lon != self._lon or h != self._height)
        self._lat, self._lon, self._height = lat, lon, h
コード例 #2
0
ファイル: bases.py プロジェクト: N-Razzouk/PyGeodesy
    def __init__(self, lat, lon, height=0, name=''):
        '''New C{LatLon}.

           @param lat: Latitude (C{degrees} or DMS C{str} with N or S suffix).
           @param lon: Longitude (C{degrees} or DMS C{str} with E or W suffix).
           @keyword height: Optional height (C{meter} above or below the earth surface).
           @keyword name: Optional name (C{str}).

           @return: New instance (C{LatLon}).

           @raise RangeError: Value of I{lat} or I{lon} outside the valid
                              range and I{rangerrrors} set to C{True}.

           @raise ValueError: Invalid I{lat} or I{lon}.

           @example:

           >>> p = LatLon(50.06632, -5.71475)
           >>> q = LatLon('50°03′59″N', """005°42'53"W""")
        '''
        self._lat, self._lon = parseDMS2(lat, lon)
        if height:  # elevation
            self._height = scalar(height, None, name='height')
        if name:
            self.name = name
コード例 #3
0
    def epsilon(self, tol):
        '''Set the tolerance for equality tests.

           @param tol: New tolerance (C{scalar}).

           @raise TypeError: Non-scalar I{tol}.

           @raise ValueError: Out-of-bounds I{tol}.
        '''
        self._epsilon = scalar(tol, 0.0, name='tolerance')
コード例 #4
0
ファイル: points.py プロジェクト: qdhqf/PyGeodesy
    def epsilon(self, tol):
        '''Set the tolerance for equality tests.

           @param tol: New tolerance (scalar).

           @raise TypeError: Tolerance not scalar.

           @raise ValueError: Tolerance out of bounds.
        '''
        self._epsilon = scalar(tol, 0.0, name='tolerance')
コード例 #5
0
    def iterations(self, limit):
        '''Set the iteration limit.

           @param limit: New iteration limit (scalar).

           @raise TypeError: Limit not scalar.

           @raise ValueError: Limit out of bounds.
        '''
        self._iterations = scalar(limit, 4, 200, name='limit')
コード例 #6
0
    def epsilon(self, eps):
        '''Set the convergence epsilon.

           @param eps: New epsilon (scalar).

           @raise TypeError: If I{eps} is not scalar.

           @raise ValueError: If I{eps} is out of bounds.
        '''
        self._epsilon = scalar(eps, name='epsilon')
コード例 #7
0
    def iterations(self, limit):
        '''Set the iteration limit.

           @param limit: New iteration limit (scalar).

           @raise TypeError: Non-scalar I{limit}.

           @raise ValueError: Out-of-bounds I{limit}.
        '''
        self._iterations = scalar(limit, 4, 200, name='limit')
コード例 #8
0
    def epsilon(self, eps):
        '''Set the convergence epsilon.

           @param eps: New epsilon (scalar).

           @raise TypeError: Non-scalar I{eps}.

           @raise ValueError: Out of bounds I{eps}.
        '''
        self._epsilon = scalar(eps, name='epsilon')
コード例 #9
0
ファイル: bases.py プロジェクト: N-Razzouk/PyGeodesy
    def height(self, height):
        '''Set the height.

           @param height: New height (C{meter}).

           @raise TypeError: Invalid I{height} C{type}.

           @raise ValueError: Invalid I{height}.
        '''
        h = scalar(height, None, name='height')
        self._update(h != self._height)
        self._height = h
コード例 #10
0
    def h(self, h):
        '''Sets height above surface.

           @param h: New height (C{meter}).

           @raise TypeError: If B{C{h}} invalid.

           @raise ValueError: If B{C{h}} invalid.
        '''
        h = scalar(h, None, name='h')
        self._update(h != self._h)
        self._h = h
コード例 #11
0
ファイル: nvector.py プロジェクト: tiger222/PyGeodesy
    def __init__(self, x, y, z, h=0, ll=None):
        '''New n-vector normal to the earth's surface.

           @param x: X component (scalar).
           @param y: Y component (scalar).
           @param z: Z component (scalar).
           @keyword h: Optional height above surface (meter).
           @keyword ll: Optional, original latlon (I{LatLon}).

           @example:

           >>> from sphericalNvector import Nvector
           >>> v = Nvector(0.5, 0.5, 0.7071, 1)
           >>> v.toLatLon()  # 45.0°N, 045.0°E, +1.00m
        '''
        Vector3d.__init__(self, x, y, z, ll=ll)
        if h:
            self._h = scalar(h, None, name='h')