How to use the pygeodesy.units.Radius function in PyGeodesy

To help you get started, we’ve selected a few PyGeodesy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mrJean1 / PyGeodesy / pygeodesy / vector3d.py View on Github external
y = r1 * sqrt(y)  # y == a / 2
        elif y < 0:
            raise ValueError(_invalid_)
        else:  # abutting
            y = 0
    elif o < 0:
        t = d if too_d is None else too_d
        raise ValueError(_too_distant_fmt_ % (t,))
    else:  # abutting
        x, y = r1, 0

    u = m.unit()
    if sphere:  # sphere radius and center
        c = c1 if x < EPS  else (
            c2 if x > EPS1 else c1.plus(u.times(x)))
        t = _Vector(c.x, c.y, c.z), Radius(y)
    elif y > 0:
        t = _xVector(c1, u, x, y), _xVector(c1, u, x, -y)
    else:  # abutting circles
        t = _xVector(c1, u, x, 0)
        t = t, t
    return t
github mrJean1 / PyGeodesy / pygeodesy / datum.py View on Github external
from pygeodesy.lazily import _ALL_DOCS, _ALL_LAZY
from pygeodesy.named import Distance2Tuple, _NamedEnum, _NamedEnumItem, \
                           _NamedTuple, Vector3Tuple
from pygeodesy.streprs import _e, instr, _Fmt, fstr
from pygeodesy.units import Bearing_, Lam_, Lat, Phi, Phi_, \
                            Radius, Radius_, Scalar
from pygeodesy.utily import degrees360, degrees2m, m2degrees, \
                            m2km, m2NM, m2SM

from math import atan, atan2, atanh, copysign, cos, exp, hypot, \
                 radians, sin, sinh, sqrt

R_M  = Radius(R_M,       name='R_M')  #: Mean (spherical) earth radius (C{meter}).
R_MA = Radius(6378137.0, name='R_MA')  #: Major (equatorial) earth radius (C{meter}) WGS84, EPSG:3785.
R_MB = Radius(6356752.0, name='R_MB')  #: Minor (polar) earth radius (C{meter}) WGS84, EPSG:3785.
R_KM = Radius(m2km(R_M), name='R_KM')  #: Mean (spherical) earth radius (C{KM}, kilo meter).
R_NM = Radius(m2NM(R_M), name='R_NM')  #: Mean (spherical) earth radius (C{NM}, nautical miles).
R_SM = Radius(m2SM(R_M), name='R_SM')  #: Mean (spherical) earth radius (C{SM}, statute miles).
# See ,
#  and
# 
# based on International Standard Nautical Mile of 1,852 meter (1' latitude)
R_FM = Radius(6371000.0,       name='R_FM')  #: Former FAI Sphere earth radius (C{meter}).
R_VM = Radius(6366707.0194937, name='R_VM')  #: Aviation/Navigation earth radius (C{meter}).
# R_ = Radius(6372797.560856,  name='R_')   #: XXX some other earth radius???

__all__ = _ALL_LAZY.datum
__version__ = '20.07.17'

_Flts = {}               # floats cache, deleted below
_TOL  = sqrt(EPS * 0.1)  # for Ellipsoid.estauf, imported by .ups
github mrJean1 / PyGeodesy / pygeodesy / datum.py View on Github external
and L{rangerrors} set to C{True}.

           @raise ValueError: Invalid B{C{lat}} or B{C{bearing}}.

           @see: U{Radii of Curvature
                 }
        '''
        c2 = cos(Bearing_(bearing))**2
        s2 = 1 - c2
        m, n = self.roc2_(Phi_(lat))
        if n < m:  # == n / (c2 * n / m + s2)
            c2 *= n / m
        elif m < n:  # == m / (c2 + s2 * m / n)
            s2 *= m / n
            n = m
        return Radius(n / (c2 + s2), name=Ellipsoid.rocBearing.__name__)  # == 1 / (c2 / m + s2 / n)
github mrJean1 / PyGeodesy / pygeodesy / datum.py View on Github external
from pygeodesy.interns import _COMMA_SPACE_, _ellipsoid_, _lat0_, _lat1_, \
                              _lon0_, _lon1_, _n_a_, _name_, NN, \
                              _transform_, _UNDERSCORE_, _x_
from pygeodesy.lazily import _ALL_DOCS, _ALL_LAZY
from pygeodesy.named import Distance2Tuple, _NamedEnum, _NamedEnumItem, \
                           _NamedTuple, Vector3Tuple
from pygeodesy.streprs import _e, instr, _Fmt, fstr
from pygeodesy.units import Bearing_, Lam_, Lat, Phi, Phi_, \
                            Radius, Radius_, Scalar
from pygeodesy.utily import degrees360, degrees2m, m2degrees, \
                            m2km, m2NM, m2SM

from math import atan, atan2, atanh, copysign, cos, exp, hypot, \
                 radians, sin, sinh, sqrt

R_M  = Radius(R_M,       name='R_M')  #: Mean (spherical) earth radius (C{meter}).
R_MA = Radius(6378137.0, name='R_MA')  #: Major (equatorial) earth radius (C{meter}) WGS84, EPSG:3785.
R_MB = Radius(6356752.0, name='R_MB')  #: Minor (polar) earth radius (C{meter}) WGS84, EPSG:3785.
R_KM = Radius(m2km(R_M), name='R_KM')  #: Mean (spherical) earth radius (C{KM}, kilo meter).
R_NM = Radius(m2NM(R_M), name='R_NM')  #: Mean (spherical) earth radius (C{NM}, nautical miles).
R_SM = Radius(m2SM(R_M), name='R_SM')  #: Mean (spherical) earth radius (C{SM}, statute miles).
# See ,
#  and
# 
# based on International Standard Nautical Mile of 1,852 meter (1' latitude)
R_FM = Radius(6371000.0,       name='R_FM')  #: Former FAI Sphere earth radius (C{meter}).
R_VM = Radius(6366707.0194937, name='R_VM')  #: Aviation/Navigation earth radius (C{meter}).
# R_ = Radius(6372797.560856,  name='R_')   #: XXX some other earth radius???

__all__ = _ALL_LAZY.datum
__version__ = '20.07.17'
github mrJean1 / PyGeodesy / pygeodesy / sphericalBase.py View on Github external
           @example:

           >>> p = LatLon(51.127, 1.338)
           >>> q = LatLon(50.964, 1.853)
           >>> d = p.rhumbDistanceTo(q)  # 403100
        '''
        # see 
        da, db, dp = self._rhumb3(other)

        # on Mercator projection, longitude distances shrink
        # by latitude; the 'stretch factor' q becomes ill-
        # conditioned along E-W line (0/0); use an empirical
        # tolerance to avoid it
        q = (da / dp) if abs(dp) > EPS else cos(self.phi)
        return hypot(da, q * db) * Radius(radius)
github mrJean1 / PyGeodesy / pygeodesy / ellipsoidalNvector.py View on Github external
           @example:

           >>> p = LatLon(52.205, 0.119)
           >>> q = LatLon(48.857, 2.351);
           >>> d = p.distanceTo(q)  # 404300
        '''
        self.others(other)

        v1 = self._N_vector
        v2 = other._N_vector

        if radius is None:
            r = self.datum.ellipsoid.R1
        else:
            r = Radius(radius)
        return v1.angleTo(v2) * r
github mrJean1 / PyGeodesy / pygeodesy / datum.py View on Github external
and prime vertical U{Radii of Curvature
                 }.
        '''
        a = abs(Phi(phi))
        r = self.e2s2(sin(a) if a < PI_2 else 1)
        if r < EPS:
            m = n = 0  # PYCHOK e2s2 attr?
        elif r < EPS1:
            n = self.a / sqrt(r)
            m = n * self.e12 / r  # PYCHOK e2s2 attr?
        else:
            n = self.a
            m = n * self.e12
        if scaled:
            n *= cos(a) if a < PI_2 else 0
        return Curvature2Tuple(Radius(m, name=Ellipsoid.rocMeridional.__name__),
                               Radius(n, name=Ellipsoid.rocPrimeVertical.__name__))
github mrJean1 / PyGeodesy / pygeodesy / datum.py View on Github external
def Rlat(self, lat):
        '''Approximate the earth radius at the given latitude.

           @arg lat: Latitude (C{degrees90}).

           @return: Approximate earth radius (C{meter}).

           @raise ValueError: Invalid B{C{lat}}.
        '''
        if self._ab_90 is None:
            self._ab_90 = (self.a - self.b) / 90.0
        # r = major - (major - minor) * |lat| / 90
        r = self.a
        if lat:
            r -= self._ab_90 * min(abs(Lat(lat, clip=0)), 90)
        return Radius(r, name=Ellipsoid.Rlat.__name__)
github mrJean1 / PyGeodesy / pygeodesy / datum.py View on Github external
_transform_, _UNDERSCORE_, _x_
from pygeodesy.lazily import _ALL_DOCS, _ALL_LAZY
from pygeodesy.named import Distance2Tuple, _NamedEnum, _NamedEnumItem, \
                           _NamedTuple, Vector3Tuple
from pygeodesy.streprs import _e, instr, _Fmt, fstr
from pygeodesy.units import Bearing_, Lam_, Lat, Phi, Phi_, \
                            Radius, Radius_, Scalar
from pygeodesy.utily import degrees360, degrees2m, m2degrees, \
                            m2km, m2NM, m2SM

from math import atan, atan2, atanh, copysign, cos, exp, hypot, \
                 radians, sin, sinh, sqrt

R_M  = Radius(R_M,       name='R_M')  #: Mean (spherical) earth radius (C{meter}).
R_MA = Radius(6378137.0, name='R_MA')  #: Major (equatorial) earth radius (C{meter}) WGS84, EPSG:3785.
R_MB = Radius(6356752.0, name='R_MB')  #: Minor (polar) earth radius (C{meter}) WGS84, EPSG:3785.
R_KM = Radius(m2km(R_M), name='R_KM')  #: Mean (spherical) earth radius (C{KM}, kilo meter).
R_NM = Radius(m2NM(R_M), name='R_NM')  #: Mean (spherical) earth radius (C{NM}, nautical miles).
R_SM = Radius(m2SM(R_M), name='R_SM')  #: Mean (spherical) earth radius (C{SM}, statute miles).
# See ,
#  and
# 
# based on International Standard Nautical Mile of 1,852 meter (1' latitude)
R_FM = Radius(6371000.0,       name='R_FM')  #: Former FAI Sphere earth radius (C{meter}).
R_VM = Radius(6366707.0194937, name='R_VM')  #: Aviation/Navigation earth radius (C{meter}).
# R_ = Radius(6372797.560856,  name='R_')   #: XXX some other earth radius???

__all__ = _ALL_LAZY.datum
__version__ = '20.07.17'

_Flts = {}               # floats cache, deleted below
_TOL  = sqrt(EPS * 0.1)  # for Ellipsoid.estauf, imported by .ups