From 615ca44b2e851f0da4cde8fa81f46104ef519f98 Mon Sep 17 00:00:00 2001 From: "Michael Hirsch, Ph.D" Date: Wed, 8 May 2019 11:32:38 -0400 Subject: [PATCH] py34 support --- README.md | 8 +++++++- pymap3d/math/aer.py | 9 ++++----- pymap3d/math/ecef.py | 15 +++++++-------- pymap3d/math/enu.py | 9 ++++----- pymap3d/math/ned.py | 15 +++++++-------- pytest.ini | 1 - setup.cfg | 5 +++-- 7 files changed, 32 insertions(+), 30 deletions(-) diff --git a/README.md b/README.md index 1fc0409..fa01f54 100644 --- a/README.md +++ b/README.md @@ -26,9 +26,15 @@ Includes some relevant ## Prerequisites -* Python ≥ 3.5 or PyPy3 +Python ≥ 3.4 + +or + +PyPy3 References to Numpy and AstroPy are *optional*, algorithms from Vallado and Meeus are used if AstroPy is not present. +PyMap3D is regularly tested with Python ≥ 3.5. +Limited Python 3.4 support is available for systems using MicroPython or other cases where a current Python version isn't available. ## Install diff --git a/pymap3d/math/aer.py b/pymap3d/math/aer.py index 6b13ff1..3046d5f 100644 --- a/pymap3d/math/aer.py +++ b/pymap3d/math/aer.py @@ -1,5 +1,4 @@ """ transforms involving AER: azimuth, elevation, slant range""" -from typing import Tuple from .ecef import ecef2enu, geodetic2ecef, ecef2geodetic, enu2uvw, Ellipsoid from .enu import geodetic2enu, aer2enu, enu2aer @@ -9,7 +8,7 @@ def ecef2aer(x: float, y: float, z: float, lat0: float, lon0: float, h0: float, - ell: Ellipsoid = None, deg: bool = True) -> Tuple[float, float, float]: + ell: Ellipsoid = None, deg: bool = True): """ gives azimuth, elevation and slant range from an Observer to a Point with ECEF coordinates. @@ -51,7 +50,7 @@ def ecef2aer(x: float, y: float, z: float, def geodetic2aer(lat: float, lon: float, h: float, lat0: float, lon0: float, h0: float, - ell: Ellipsoid = None, deg: bool = True) -> Tuple[float, float, float]: + ell: Ellipsoid = None, deg: bool = True): """ gives azimuth, elevation and slant range from an Observer to a Point with geodetic coordinates. @@ -93,7 +92,7 @@ def geodetic2aer(lat: float, lon: float, h: float, def aer2geodetic(az: float, el: float, srange: float, lat0: float, lon0: float, h0: float, ell: Ellipsoid = None, - deg: bool = True) -> Tuple[float, float, float]: + deg: bool = True): """ gives geodetic coordinates of a point with az, el, range from an observer at lat0, lon0, h0 @@ -136,7 +135,7 @@ def aer2geodetic(az: float, el: float, srange: float, def aer2ecef(az: float, el: float, srange: float, lat0: float, lon0: float, alt0: float, - ell: Ellipsoid = None, deg: bool = True) -> Tuple[float, float, float]: + ell: Ellipsoid = None, deg: bool = True): """ converts target azimuth, elevation, range from observer at lat0,lon0,alt0 to ECEF coordinates. diff --git a/pymap3d/math/ecef.py b/pymap3d/math/ecef.py index 41e1452..b866d6c 100644 --- a/pymap3d/math/ecef.py +++ b/pymap3d/math/ecef.py @@ -1,7 +1,6 @@ """ Transforms involving ECEF: earth-centered, earth-fixed frame """ from math import radians, sin, cos, tan, hypot, degrees, sqrt, pi from math import atan as arctan, atan2 as arctan2 -from typing import Tuple tau = 2 * pi @@ -90,7 +89,7 @@ def get_radius_normal(lat_radians: float, ell: Ellipsoid = None) -> float: def geodetic2ecef(lat: float, lon: float, alt: float, - ell: Ellipsoid = None, deg: bool = True) -> Tuple[float, float, float]: + ell: Ellipsoid = None, deg: bool = True): """ point transformation from Geodetic of specified ellipsoid (default WGS-84) to ECEF @@ -143,7 +142,7 @@ def geodetic2ecef(lat: float, lon: float, alt: float, def ecef2geodetic(x: float, y: float, z: float, - ell: Ellipsoid = None, deg: bool = True) -> Tuple[float, float, float]: + ell: Ellipsoid = None, deg: bool = True): """ convert ECEF (meters) to geodetic coordinates @@ -216,7 +215,7 @@ def ecef2geodetic(x: float, y: float, z: float, def ecef2enuv(u: float, v: float, w: float, - lat0: float, lon0: float, deg: bool = True) -> Tuple[float, float, float]: + lat0: float, lon0: float, deg: bool = True): """ VECTOR from observer to target ECEF => ENU @@ -261,7 +260,7 @@ def ecef2enuv(u: float, v: float, w: float, def ecef2enu(x: float, y: float, z: float, lat0: float, lon0: float, h0: float, - ell: Ellipsoid = None, deg: bool = True) -> Tuple[float, float, float]: + ell: Ellipsoid = None, deg: bool = True): """ from observer to target, ECEF => ENU @@ -300,7 +299,7 @@ def ecef2enu(x: float, y: float, z: float, def enu2uvw(east: float, north: float, up: float, - lat0: float, lon0: float, deg: bool = True) -> Tuple[float, float, float]: + lat0: float, lon0: float, deg: bool = True): """ Parameters ---------- @@ -334,7 +333,7 @@ def enu2uvw(east: float, north: float, up: float, def uvw2enu(u: float, v: float, w: float, - lat0: float, lon0: float, deg: bool = True) -> Tuple[float, float, float]: + lat0: float, lon0: float, deg: bool = True): """ Parameters ---------- @@ -368,7 +367,7 @@ def uvw2enu(u: float, v: float, w: float, def enu2ecef(e1: float, n1: float, u1: float, lat0: float, lon0: float, h0: float, - ell: Ellipsoid = None, deg: bool = True) -> Tuple[float, float, float]: + ell: Ellipsoid = None, deg: bool = True): """ ENU to ECEF diff --git a/pymap3d/math/enu.py b/pymap3d/math/enu.py index 8a4bb0f..7a002c4 100644 --- a/pymap3d/math/enu.py +++ b/pymap3d/math/enu.py @@ -1,5 +1,4 @@ """ transforms involving ENU East North Up """ -from typing import Tuple from math import radians, sin, cos, hypot, degrees, pi from math import atan2 as arctan2 @@ -10,7 +9,7 @@ __all__ = ['enu2aer', 'aer2enu', 'enu2geodetic', 'geodetic2enu'] -def enu2aer(e: float, n: float, u: float, deg: bool = True) -> Tuple[float, float, float]: +def enu2aer(e: float, n: float, u: float, deg: bool = True): """ ENU to Azimuth, Elevation, Range @@ -58,7 +57,7 @@ def enu2aer(e: float, n: float, u: float, deg: bool = True) -> Tuple[float, floa def aer2enu(az: float, el: float, srange: float, - deg: bool = True) -> Tuple[float, float, float]: + deg: bool = True): """ Azimuth, Elevation, Slant range to target to East, north, Up @@ -96,7 +95,7 @@ def aer2enu(az: float, el: float, srange: float, def enu2geodetic(e: float, n: float, u: float, lat0: float, lon0: float, h0: float, - ell: Ellipsoid = None, deg: bool = True) -> Tuple[float, float, float]: + ell: Ellipsoid = None, deg: bool = True): """ East, North, Up to target to geodetic coordinates @@ -137,7 +136,7 @@ def enu2geodetic(e: float, n: float, u: float, def geodetic2enu(lat: float, lon: float, h: float, lat0: float, lon0: float, h0: float, - ell: Ellipsoid = None, deg: bool = True) -> Tuple[float, float, float]: + ell: Ellipsoid = None, deg: bool = True): """ Parameters ---------- diff --git a/pymap3d/math/ned.py b/pymap3d/math/ned.py index 324fed0..4b200a1 100644 --- a/pymap3d/math/ned.py +++ b/pymap3d/math/ned.py @@ -1,13 +1,12 @@ """ Transforms involving NED North East Down """ from .enu import geodetic2enu, aer2enu, enu2aer from .ecef import ecef2geodetic, ecef2enuv, ecef2enu, enu2ecef, Ellipsoid -from typing import Tuple __all__ = ['aer2ned', 'ned2aer', 'ned2geodetic', 'ned2ecef', 'ecef2ned', 'geodetic2ned', 'ecef2nedv'] def aer2ned(az: float, elev: float, slantRange: float, - deg: bool = True) -> Tuple[float, float, float]: + deg: bool = True): """ converts azimuth, elevation, range to target from observer to North, East, Down @@ -38,7 +37,7 @@ def aer2ned(az: float, elev: float, slantRange: float, def ned2aer(n: float, e: float, d: float, - deg: bool = True) -> Tuple[float, float, float]: + deg: bool = True): """ converts North, East, Down to azimuth, elevation, range @@ -69,7 +68,7 @@ def ned2aer(n: float, e: float, d: float, def ned2geodetic(n: float, e: float, d: float, lat0: float, lon0: float, h0: float, - ell: Ellipsoid = None, deg: bool = True) -> Tuple[float, float, float]: + ell: Ellipsoid = None, deg: bool = True): """ Converts North, East, Down to target latitude, longitude, altitude @@ -111,7 +110,7 @@ def ned2geodetic(n: float, e: float, d: float, def ned2ecef(n: float, e: float, d: float, lat0: float, lon0: float, h0: float, - ell: Ellipsoid = None, deg: bool = True) -> Tuple[float, float, float]: + ell: Ellipsoid = None, deg: bool = True): """ North, East, Down to target ECEF coordinates @@ -150,7 +149,7 @@ def ned2ecef(n: float, e: float, d: float, def ecef2ned(x: float, y: float, z: float, lat0: float, lon0: float, h0: float, - ell: Ellipsoid = None, deg: bool = True) -> Tuple[float, float, float]: + ell: Ellipsoid = None, deg: bool = True): """ Convert ECEF x,y,z to North, East, Down @@ -192,7 +191,7 @@ def ecef2ned(x: float, y: float, z: float, def geodetic2ned(lat: float, lon: float, h: float, lat0: float, lon0: float, h0: float, - ell: Ellipsoid = None, deg: bool = True) -> Tuple[float, float, float]: + ell: Ellipsoid = None, deg: bool = True): """ convert latitude, longitude, altitude of target to North, East, Down from observer @@ -234,7 +233,7 @@ def geodetic2ned(lat: float, lon: float, h: float, def ecef2nedv(x: float, y: float, z: float, lat0: float, lon0: float, - deg: bool = True) -> Tuple[float, float, float]: + deg: bool = True): """ for VECTOR between two points diff --git a/pytest.ini b/pytest.ini index 2bbf0fa..ab94313 100644 --- a/pytest.ini +++ b/pytest.ini @@ -1,5 +1,4 @@ [pytest] -minversion = 3.5 filterwarnings = ignore::DeprecationWarning diff --git a/setup.cfg b/setup.cfg index 7c6a2ee..a43dd32 100644 --- a/setup.cfg +++ b/setup.cfg @@ -12,6 +12,7 @@ classifiers = Environment :: Console Intended Audience :: Science/Research Operating System :: OS Independent + Programming Language :: Python :: 3.4 Programming Language :: Python :: 3.5 Programming Language :: Python :: 3.6 Programming Language :: Python :: 3.7 @@ -24,7 +25,7 @@ long_description = file: README.md long_description_content_type = text/markdown [options] -python_requires = >= 3.5 +python_requires = >= 3.4 setup_requires = pip >= 10 setuptools >= 38.6.0 @@ -36,7 +37,7 @@ install_requires = [options.extras_require] tests = - pytest >= 3.5 + pytest cov = pytest-cov coveralls