Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
As = tuple(Azimuthal(0, 0, datum=1) for # spherical datum of radius=1 for Snyder's Table ...
# ... 30, pp 196-197 26, pp 168 28, pp 188-189 22, pp 151 24, pp 158-159
Azimuthal in (Equidistant, Gnomonic, LambertEqualArea, Orthographic, Stereographic))
t.testSnyder(10, 80, As, (1.37704, 0.24656), (5.67128, 1.01543), (1.26747, 0.22694), (0.96985, 0.17365), (1.65643, 0.29658))
t.testSnyder(20, 20, As, (0.33454, 0.35601), (0.36397, 0.38733), (0.33123, 0.35248), (0.32139, 0.34202), (0.34136, 0.36327))
t.testSnyder(40, 40, As, (0.57386, 0.74912), (0.8391, 1.09537), (0.55281, 0.72164), (0.4924, 0.64279), (0.62062, 0.81016))
t.testSnyder(60, 60, As, (0.58948, 1.17896), (1.73205, 3.4641), (0.54772, 1.09545), (0.43301, 0.86603), (0.69282, 1.38564))
t.testSnyder(70, 80, As, (0.50997, 1.42273), (5.67128, 15.82209), (0.46280, 1.29114), (0.33682, 0.93969), (0.63588, 1.77402))
t.testSnyder(80, 80, As, (0.26358, 1.51792), (5.67128, 32.65961), (0.23828, 1.37219), (0.17101, 0.98481), (0.33201, 1.91196)) # XXX 1.96962?
t.testSnyder(80, 10, As, (0.04281, 1.39829), (0.17633, 5.75877), (0.03941, 1.28702), (0.03015, 0.98481), (0.05150, 1.68198))
A = equidistant(0, 0, datum=1, name='coverage')
t.test('equatoradius', A.equatoradius, 1.0, nl=1)
t.test('flattening', A.flattening, 0)
t.test('latlon0', A.latlon0, (0.0, 0.0))
A.latlon0 = named.LatLon2Tuple(1, 2)
t.test('latlon0', A.latlon0, (1.0, 2.0))
t.test('name', A.name, 'coverage')
t.test('radius', A.radius, 1.0)
t.results()
t.exit()
@arg name: Method, property or name (C{str} or C{callable}).
@arg args: Method or property positional arguments (any C{type}s).
@arg kwds: Method or property keyword arguments (any C{type}s).
'''
t = _notError(inst, name, args, kwds)
raise _AssertionError(t, txt=notOverloaded.__name__)
__all__ += _ALL_DOCS(_Named,
_NamedBase, # _NamedDict,
_NamedEnum, _NamedEnumItem, # _NamedTuple,
Bearing2Tuple, Bounds2Tuple, Bounds4Tuple,
Destination2Tuple, Destination3Tuple,
Distance2Tuple, Distance3Tuple, Distance4Tuple,
EasNor2Tuple, EasNor3Tuple,
LatLon2Tuple, LatLon3Tuple, LatLon4Tuple,
LatLonDatum3Tuple, LatLonPrec3Tuple, LatLonPrec5Tuple,
NearestOn3Tuple,
PhiLam2Tuple, PhiLam3Tuple, PhiLam4Tuple, Points2Tuple,
Vector3Tuple, Vector4Tuple)
if __name__ == '__main__':
from sys import argv, exit # PYCHOK shadows exit
from pygeodesy.lazily import _FOR_DOCS
if not _FOR_DOCS:
exit('%s\n' % (' '.join('usage: env PYGEODESY_FOR_DOCS=1 python -m'.split() + argv),))
ls = locals()
for n in __all__:
def _decode(self):
# cache all decoded attrs
lat, lon, p, h, r = decode5(self) # PYCHOK LatLonPrec5Tuple
if self._latlon is None:
self._latlon = LatLon2Tuple(lat, lon)
if self._precision is None:
self._precision = p
if self._height is _Missing:
self._height = h
if self._radius is _Missing:
self._radius = r
@raise TypeError: If B{C{latlon}} is not ellipsoidal.
'''
_xinstanceof(_LLEB, LatLon4Tuple, latlon=latlon)
cs = _CassiniSoldner(cs0)
cs._datumatch(latlon)
c = cs.forward4(latlon.lat, latlon.lon)
h = latlon.height if height is None else Height(height)
if Css is None:
r = EasNor3Tuple(c.easting, c.northing, h)
else:
r = Css(c.easting, c.northing, h=h, cs0=cs)
r._latlon = LatLon2Tuple(latlon.lat, latlon.lon)
r._azi, r._rk = c.azimuth, c.reciprocal
return _xnamed(r, name or nameof(latlon))
def latlon(self):
'''Get the lat- and longitude (L{LatLon2Tuple}).
'''
r = LatLon2Tuple(self.reverse4.lat, self.reverse4.lon)
return self._xnamed(r)
def latlon0(self, latlon0):
'''Set the center lat- and longitude (C{LatLon}, L{LatLon2Tuple} or L{LatLon4Tuple}).
@raise AzimuthalError: Ellipsoidal mismatch of B{C{latlon0}} and this projection.
@raise RangeError: Invalid B{C{lat0}} or B{C{lon0}}.
@raise UnitError: Invalid B{C{lat0}} or B{C{lon0}}.
'''
B = _LLEB if self.datum.isEllipsoidal else _LLB
_xinstanceof(B, LatLon2Tuple, LatLon4Tuple, latlon0=latlon0)
if hasattr(latlon0, _datum_):
_datum_datum(self.datum, latlon0.datum, Error=AzimuthalError)
self.reset(latlon0.lat, latlon0.lon)
def latlon0(self):
'''Get the central origin (L{LatLon2Tuple}C{(lat, lon)}).
'''
return self._xnamed(LatLon2Tuple(self.lat0, self.lon0))
def latlon(self):
'''Get the lat- and longitude of (the approximate center of)
this geohash as a L{LatLon2Tuple}C{(lat, lon)} in C{degrees}.
B{Example:}
>>> geohash.Geohash('geek').latlon # 65.478515625, -17.75390625
>>> geohash.decode('geek') # '65.48', '-17.75'
'''
# B{Example:} not @example: since that causes Epydoc error
if not self._latlon:
lat, lon = _2center(self.bounds())
self._latlon = LatLon2Tuple(lat, lon)
return self._latlon
def sizes(self):
'''Get the lat- and longitudinal size of this cell as
a L{LatLon2Tuple}C{(lat, lon)} with the latitudinal
height and longitudinal width in (C{meter}).
'''
n = min(len(_Sizes) - 1, self.precision or 1)
return LatLon2Tuple(*map2(float, _Sizes[n][:2])) # XXX Height, Width