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 B{C{latlonh}} not C{scalar} or B{C{latlonh}} not C{list} or C{tuple}. @raise ValueError: Invalid B{C{latlonh}} or M{len(latlonh)}. @see: Function L{parse3llh} to parse a B{C{latlonh}} string into a 3-tuple (lat, lon, h). ''' _TypeError(list, tuple, 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
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 B{C{lat}} or B{C{lon}} outside the valid range and C{rangerrors} set to C{True}. @raise ValueError: Invalid B{C{lat}} or B{C{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) # PYCHOK LatLon2Tuple if height: # elevation self._height = scalar(height, None, name='height') if name: self.name = name
def iterations(self, limit): '''Set the iteration limit. @param limit: New iteration limit (scalar). @raise TypeError: Non-scalar B{C{limit}}. @raise ValueError: Out-of-bounds B{C{limit}}. ''' self._iterations = scalar(limit, 4, 200, name='limit')
def epsilon(self, eps): '''Set the convergence epsilon. @param eps: New epsilon (scalar). @raise TypeError: Non-scalar B{C{eps}}. @raise ValueError: Out of bounds B{C{eps}}. ''' self._epsilon = scalar(eps, name='epsilon')
def height(self, height): '''Set the height. @param height: New height (C{meter}). @raise TypeError: Invalid B{C{height}} C{type}. @raise ValueError: Invalid B{C{height}}. ''' h = scalar(height, None, name='height') self._update(h != self._height) self._height = h
def h(self, h): '''Set the height above surface. @param h: New height (C{meter}). @raise TypeError: If B{C{h}} invalid. @raise VectorError: If B{C{h}} invalid. ''' h = scalar(h, None, name='h', Error=VectorError) self._update(h != self._h) self._h = h
def __init__(self, x, y, z, h=0, ll=None, name=''): '''New n-vector normal to the earth's surface. @param x: X component (C{scalar}). @param y: Y component (C{scalar}). @param z: Z component (C{scalar}). @keyword h: Optional height above surface (C{meter}). @keyword ll: Optional, original latlon (C{LatLon}). @keyword name: Optional name (C{str}). @example: >>> from pygeodesy.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, name=name) if h: self._h = scalar(h, None, name='h')