[Git][debian-gis-team/pymap3d][master] 4 commits: New upstream version 2.4.3
Antonio Valentino
gitlab at salsa.debian.org
Thu Sep 24 07:15:11 BST 2020
Antonio Valentino pushed to branch master at Debian GIS Project / pymap3d
Commits:
d78f261c by Antonio Valentino at 2020-09-24T05:59:58+00:00
New upstream version 2.4.3
- - - - -
23520631 by Antonio Valentino at 2020-09-24T05:59:59+00:00
Update upstream source from tag 'upstream/2.4.3'
Update to upstream version '2.4.3'
with Debian dir 631379efa4ff765440f540504c5db3980577e66a
- - - - -
0c7a69da by Antonio Valentino at 2020-09-24T06:09:11+00:00
New upstream release
- - - - -
63f7ea56 by Antonio Valentino at 2020-09-24T06:10:04+00:00
Set distribution to unstable
- - - - -
20 changed files:
- .github/workflows/codeql-analysis.yml
- README.md
- debian/changelog
- examples/plot_geodetic2ecef.py
- setup.cfg
- src/pymap3d/aer.py
- src/pymap3d/azelradec.py
- src/pymap3d/ecef.py
- src/pymap3d/eci.py
- src/pymap3d/enu.py
- src/pymap3d/haversine.py
- src/pymap3d/latitude.py
- src/pymap3d/los.py
- src/pymap3d/lox.py
- src/pymap3d/ned.py
- src/pymap3d/rcurve.py
- src/pymap3d/rsphere.py
- src/pymap3d/utils.py
- src/pymap3d/vallado.py
- src/pymap3d/vincenty.py
Changes:
=====================================
.github/workflows/codeql-analysis.yml
=====================================
@@ -1,7 +1,6 @@
name: "CodeQL"
on:
- push:
schedule:
- cron: '0 10 * * 6'
=====================================
README.md
=====================================
@@ -108,7 +108,7 @@ Abbreviations:
* [AER: Azimuth, Elevation, Range](https://en.wikipedia.org/wiki/Spherical_coordinate_system)
* [ECEF: Earth-centered, Earth-fixed](https://en.wikipedia.org/wiki/ECEF)
-* [ECI: Earth-centered Inertial](https://en.wikipedia.org/wiki/Earth-centered_inertial)
+* [ECI: Earth-centered Inertial using IERS](https://www.iers.org/IERS/EN/Home/home_node.html) via `astropy`
* [ENU: East North Up](https://en.wikipedia.org/wiki/Axes_conventions#Ground_reference_frames:_ENU_and_NED)
* [NED: North East Down](https://en.wikipedia.org/wiki/North_east_down)
* [radec: right ascension, declination](https://en.wikipedia.org/wiki/Right_ascension)
=====================================
debian/changelog
=====================================
@@ -1,3 +1,9 @@
+pymap3d (2.4.3-1) unstable; urgency=medium
+
+ * New upstream release.
+
+ -- Antonio Valentino <antonio.valentino at tiscali.it> Thu, 24 Sep 2020 06:09:56 +0000
+
pymap3d (2.4.2-1) unstable; urgency=medium
* New upstream release.
=====================================
examples/plot_geodetic2ecef.py
=====================================
@@ -1,9 +1,15 @@
#!/usr/bin/env python3
+import typing
import pymap3d as pm
import matplotlib.pyplot as mpl
import numpy as np
import argparse
+try:
+ from numpy.typing import ArrayLike
+except ImportError:
+ ArrayLike = typing.Any
+
p = argparse.ArgumentParser()
p.add_argument("alt_m", help="altitude [meters]", type=float, default=0.0, nargs="?")
p = p.parse_args()
@@ -13,7 +19,7 @@ lat, lon = np.meshgrid(np.arange(-90, 90, 0.1), np.arange(-180, 180, 0.2))
x, y, z = pm.geodetic2ecef(lat, lon, p.alt_m)
-def panel(ax, val: np.ndarray, name: str, cmap: str = None):
+def panel(ax, val: ArrayLike, name: str, cmap: str = None):
hi = ax.pcolormesh(lon, lat, val, cmap=cmap)
ax.set_title(name)
fg.colorbar(hi, ax=ax).set_label(name + " [m]")
=====================================
setup.cfg
=====================================
@@ -1,6 +1,6 @@
[metadata]
name = pymap3d
-version = 2.4.2
+version = 2.4.3
author = Michael Hirsch, Ph.D.
author_email = scivision at users.noreply.github.com
description = pure Python (no prereqs) coordinate conversions, following convention of several popular Matlab routines.
@@ -13,24 +13,14 @@ classifiers =
Intended Audience :: Science/Research
Operating System :: OS Independent
Programming Language :: Python :: 3
- Programming Language :: Python :: 3.5
- Programming Language :: Python :: 3.6
- Programming Language :: Python :: 3.7
- Programming Language :: Python :: 3.8
- Programming Language :: Python :: 3.9
- Programming Language :: Python :: Implementation :: CPython
- Programming Language :: Python :: Implementation :: PyPy
Topic :: Scientific/Engineering :: GIS
license_files =
LICENSE.txt
-long_description = file: README.md
-long_description_content_type = text/markdown
[options]
python_requires = >= 3.5.2
packages = find:
zip_safe = False
-install_requires =
package_dir=
=src
=====================================
src/pymap3d/aer.py
=====================================
@@ -11,22 +11,24 @@ try:
except ImportError:
eci2ecef = ecef2eci = None
-__all__ = ["aer2ecef", "ecef2aer", "geodetic2aer", "aer2geodetic", "eci2aer", "aer2eci"]
+try:
+ from numpy.typing import ArrayLike
+except ImportError:
+ ArrayLike = typing.Any
-if typing.TYPE_CHECKING:
- from numpy import ndarray
+__all__ = ["aer2ecef", "ecef2aer", "geodetic2aer", "aer2geodetic", "eci2aer", "aer2eci"]
def ecef2aer(
- x: "ndarray",
- y: "ndarray",
- z: "ndarray",
- lat0: "ndarray",
- lon0: "ndarray",
- h0: "ndarray",
+ x: ArrayLike,
+ y: ArrayLike,
+ z: ArrayLike,
+ lat0: ArrayLike,
+ lon0: ArrayLike,
+ h0: ArrayLike,
ell: Ellipsoid = None,
deg: bool = True,
-) -> typing.Tuple["ndarray", "ndarray", "ndarray"]:
+) -> typing.Tuple[ArrayLike, ArrayLike, ArrayLike]:
"""
compute azimuth, elevation and slant range from an Observer to a Point with ECEF coordinates.
@@ -35,17 +37,17 @@ def ecef2aer(
Parameters
----------
- x : "ndarray"
+ x : ArrayLike
ECEF x coordinate (meters)
- y : "ndarray"
+ y : ArrayLike
ECEF y coordinate (meters)
- z : "ndarray"
+ z : ArrayLike
ECEF z coordinate (meters)
- lat0 : "ndarray"
+ lat0 : ArrayLike
Observer geodetic latitude
- lon0 : "ndarray"
+ lon0 : ArrayLike
Observer geodetic longitude
- h0 : "ndarray"
+ h0 : ArrayLike
observer altitude above geodetic ellipsoid (meters)
ell : Ellipsoid, optional
reference ellipsoid
@@ -54,11 +56,11 @@ def ecef2aer(
Returns
-------
- az : "ndarray"
+ az : ArrayLike
azimuth to target
- el : "ndarray"
+ el : ArrayLike
elevation to target
- srange : "ndarray"
+ srange : ArrayLike
slant range [meters]
"""
xEast, yNorth, zUp = ecef2enu(x, y, z, lat0, lon0, h0, ell, deg=deg)
@@ -67,15 +69,15 @@ def ecef2aer(
def geodetic2aer(
- lat: "ndarray",
- lon: "ndarray",
- h: "ndarray",
- lat0: "ndarray",
- lon0: "ndarray",
- h0: "ndarray",
+ lat: ArrayLike,
+ lon: ArrayLike,
+ h: ArrayLike,
+ lat0: ArrayLike,
+ lon0: ArrayLike,
+ h0: ArrayLike,
ell: Ellipsoid = None,
deg: bool = True,
-) -> typing.Tuple["ndarray", "ndarray", "ndarray"]:
+) -> typing.Tuple[ArrayLike, ArrayLike, ArrayLike]:
"""
gives azimuth, elevation and slant range from an Observer to a Point with geodetic coordinates.
@@ -83,17 +85,17 @@ def geodetic2aer(
Parameters
----------
- lat : "ndarray"
+ lat : ArrayLike
target geodetic latitude
- lon : "ndarray"
+ lon : ArrayLike
target geodetic longitude
- h : "ndarray"
+ h : ArrayLike
target altitude above geodetic ellipsoid (meters)
- lat0 : "ndarray"
+ lat0 : ArrayLike
Observer geodetic latitude
- lon0 : "ndarray"
+ lon0 : ArrayLike
Observer geodetic longitude
- h0 : "ndarray"
+ h0 : ArrayLike
observer altitude above geodetic ellipsoid (meters)
ell : Ellipsoid, optional
reference ellipsoid
@@ -102,11 +104,11 @@ def geodetic2aer(
Returns
-------
- az : "ndarray"
+ az : ArrayLike
azimuth
- el : "ndarray"
+ el : ArrayLike
elevation
- srange : "ndarray"
+ srange : ArrayLike
slant range [meters]
"""
e, n, u = geodetic2enu(lat, lon, h, lat0, lon0, h0, ell, deg=deg)
@@ -115,32 +117,32 @@ def geodetic2aer(
def aer2geodetic(
- az: "ndarray",
- el: "ndarray",
- srange: "ndarray",
- lat0: "ndarray",
- lon0: "ndarray",
- h0: "ndarray",
+ az: ArrayLike,
+ el: ArrayLike,
+ srange: ArrayLike,
+ lat0: ArrayLike,
+ lon0: ArrayLike,
+ h0: ArrayLike,
ell: Ellipsoid = None,
deg: bool = True,
-) -> typing.Tuple["ndarray", "ndarray", "ndarray"]:
+) -> typing.Tuple[ArrayLike, ArrayLike, ArrayLike]:
"""
gives geodetic coordinates of a point with az, el, range
from an observer at lat0, lon0, h0
Parameters
----------
- az : "ndarray"
+ az : ArrayLike
azimuth to target
- el : "ndarray"
+ el : ArrayLike
elevation to target
- srange : "ndarray"
+ srange : ArrayLike
slant range [meters]
- lat0 : "ndarray"
+ lat0 : ArrayLike
Observer geodetic latitude
- lon0 : "ndarray"
+ lon0 : ArrayLike
Observer geodetic longitude
- h0 : "ndarray"
+ h0 : ArrayLike
observer altitude above geodetic ellipsoid (meters)
ell : Ellipsoid, optional
reference ellipsoid
@@ -152,11 +154,11 @@ def aer2geodetic(
In reference ellipsoid system:
- lat : "ndarray"
+ lat : ArrayLike
geodetic latitude
- lon : "ndarray"
+ lon : ArrayLike
geodetic longitude
- alt : "ndarray"
+ alt : ArrayLike
altitude above ellipsoid (meters)
"""
x, y, z = aer2ecef(az, el, srange, lat0, lon0, h0, ell=ell, deg=deg)
@@ -165,34 +167,34 @@ def aer2geodetic(
def eci2aer(
- x: "ndarray",
- y: "ndarray",
- z: "ndarray",
- lat0: "ndarray",
- lon0: "ndarray",
- h0: "ndarray",
+ x: ArrayLike,
+ y: ArrayLike,
+ z: ArrayLike,
+ lat0: ArrayLike,
+ lon0: ArrayLike,
+ h0: ArrayLike,
t: datetime,
*,
deg: bool = True,
use_astropy: bool = True
-) -> typing.Tuple["ndarray", "ndarray", "ndarray"]:
+) -> typing.Tuple[ArrayLike, ArrayLike, ArrayLike]:
"""
takes Earth Centered Inertial x,y,z ECI coordinates of point and gives az, el, slant range from Observer
Parameters
----------
- x : "ndarray"
+ x : ArrayLike
ECI x-location [meters]
- y : "ndarray"
+ y : ArrayLike
ECI y-location [meters]
- z : "ndarray"
+ z : ArrayLike
ECI z-location [meters]
- lat0 : "ndarray"
+ lat0 : ArrayLike
Observer geodetic latitude
- lon0 : "ndarray"
+ lon0 : ArrayLike
Observer geodetic longitude
- h0 : "ndarray"
+ h0 : ArrayLike
observer altitude above geodetic ellipsoid (meters)
t : datetime.datetime
Observation time
@@ -203,11 +205,11 @@ def eci2aer(
Returns
-------
- az : "ndarray"
+ az : ArrayLike
azimuth to target
- el : "ndarray"
+ el : ArrayLike
elevation to target
- srange : "ndarray"
+ srange : ArrayLike
slant range [meters]
"""
if eci2ecef is None:
@@ -219,34 +221,34 @@ def eci2aer(
def aer2eci(
- az: "ndarray",
- el: "ndarray",
- srange: "ndarray",
- lat0: "ndarray",
- lon0: "ndarray",
- h0: "ndarray",
+ az: ArrayLike,
+ el: ArrayLike,
+ srange: ArrayLike,
+ lat0: ArrayLike,
+ lon0: ArrayLike,
+ h0: ArrayLike,
t: datetime,
ell=None,
*,
deg: bool = True,
use_astropy: bool = True
-) -> typing.Tuple["ndarray", "ndarray", "ndarray"]:
+) -> typing.Tuple[ArrayLike, ArrayLike, ArrayLike]:
"""
gives ECI of a point from an observer at az, el, slant range
Parameters
----------
- az : "ndarray"
+ az : ArrayLike
azimuth to target
- el : "ndarray"
+ el : ArrayLike
elevation to target
- srange : "ndarray"
+ srange : ArrayLike
slant range [meters]
- lat0 : "ndarray"
+ lat0 : ArrayLike
Observer geodetic latitude
- lon0 : "ndarray"
+ lon0 : ArrayLike
Observer geodetic longitude
- h0 : "ndarray"
+ h0 : ArrayLike
observer altitude above geodetic ellipsoid (meters)
t : datetime.datetime
Observation time
@@ -262,11 +264,11 @@ def aer2eci(
Earth Centered Inertial x,y,z
- x : "ndarray"
+ x : ArrayLike
ECEF x coordinate (meters)
- y : "ndarray"
+ y : ArrayLike
ECEF y coordinate (meters)
- z : "ndarray"
+ z : ArrayLike
ECEF z coordinate (meters)
"""
if ecef2eci is None:
@@ -278,31 +280,31 @@ def aer2eci(
def aer2ecef(
- az: "ndarray",
- el: "ndarray",
- srange: "ndarray",
- lat0: "ndarray",
- lon0: "ndarray",
- alt0: "ndarray",
+ az: ArrayLike,
+ el: ArrayLike,
+ srange: ArrayLike,
+ lat0: ArrayLike,
+ lon0: ArrayLike,
+ alt0: ArrayLike,
ell: Ellipsoid = None,
deg: bool = True,
-) -> typing.Tuple["ndarray", "ndarray", "ndarray"]:
+) -> typing.Tuple[ArrayLike, ArrayLike, ArrayLike]:
"""
converts target azimuth, elevation, range from observer at lat0,lon0,alt0 to ECEF coordinates.
Parameters
----------
- az : "ndarray"
+ az : ArrayLike
azimuth to target
- el : "ndarray"
+ el : ArrayLike
elevation to target
- srange : "ndarray"
+ srange : ArrayLike
slant range [meters]
- lat0 : "ndarray"
+ lat0 : ArrayLike
Observer geodetic latitude
- lon0 : "ndarray"
+ lon0 : ArrayLike
Observer geodetic longitude
- h0 : "ndarray"
+ h0 : ArrayLike
observer altitude above geodetic ellipsoid (meters)
ell : Ellipsoid, optional
reference ellipsoid
@@ -314,11 +316,11 @@ def aer2ecef(
ECEF (Earth centered, Earth fixed) x,y,z
- x : "ndarray"
+ x : ArrayLike
ECEF x coordinate (meters)
- y : "ndarray"
+ y : ArrayLike
ECEF y coordinate (meters)
- z : "ndarray"
+ z : ArrayLike
ECEF z coordinate (meters)
=====================================
src/pymap3d/azelradec.py
=====================================
@@ -13,27 +13,29 @@ try:
except ImportError:
Time = None
-__all__ = ["radec2azel", "azel2radec"]
+try:
+ from numpy.typing import ArrayLike
+except ImportError:
+ ArrayLike = typing.Any
-if typing.TYPE_CHECKING:
- from numpy import ndarray
+__all__ = ["radec2azel", "azel2radec"]
def azel2radec(
- az_deg: "ndarray", el_deg: "ndarray", lat_deg: "ndarray", lon_deg: "ndarray", time: datetime, *, use_astropy: bool = True
-) -> typing.Tuple["ndarray", "ndarray"]:
+ az_deg: ArrayLike, el_deg: ArrayLike, lat_deg: ArrayLike, lon_deg: ArrayLike, time: datetime, *, use_astropy: bool = True
+) -> typing.Tuple[ArrayLike, ArrayLike]:
"""
viewing angle (az, el) to sky coordinates (ra, dec)
Parameters
----------
- az_deg : "ndarray"
+ az_deg : ArrayLike
azimuth [degrees clockwize from North]
- el_deg : "ndarray"
+ el_deg : ArrayLike
elevation [degrees above horizon (neglecting aberration)]
- lat_deg : "ndarray"
+ lat_deg : ArrayLike
observer latitude [-90, 90]
- lon_deg : "ndarray"
+ lon_deg : ArrayLike
observer longitude [-180, 180] (degrees)
time : datetime.datetime or str
time of observation
@@ -42,9 +44,9 @@ def azel2radec(
Returns
-------
- ra_deg : "ndarray"
+ ra_deg : ArrayLike
ecliptic right ascension (degress)
- dec_deg : "ndarray"
+ dec_deg : ArrayLike
ecliptic declination (degrees)
"""
@@ -62,20 +64,20 @@ def azel2radec(
def radec2azel(
- ra_deg: "ndarray", dec_deg: "ndarray", lat_deg: "ndarray", lon_deg: "ndarray", time: datetime, *, use_astropy: bool = False
-) -> typing.Tuple["ndarray", "ndarray"]:
+ ra_deg: ArrayLike, dec_deg: ArrayLike, lat_deg: ArrayLike, lon_deg: ArrayLike, time: datetime, *, use_astropy: bool = False
+) -> typing.Tuple[ArrayLike, ArrayLike]:
"""
sky coordinates (ra, dec) to viewing angle (az, el)
Parameters
----------
- ra_deg : "ndarray"
+ ra_deg : ArrayLike
ecliptic right ascension (degress)
- dec_deg : "ndarray"
+ dec_deg : ArrayLike
ecliptic declination (degrees)
- lat_deg : "ndarray"
+ lat_deg : ArrayLike
observer latitude [-90, 90]
- lon_deg : "ndarray"
+ lon_deg : ArrayLike
observer longitude [-180, 180] (degrees)
time : datetime.datetime or str
time of observation
@@ -84,9 +86,9 @@ def radec2azel(
Returns
-------
- az_deg : "ndarray"
+ az_deg : ArrayLike
azimuth [degrees clockwize from North]
- el_deg : "ndarray"
+ el_deg : ArrayLike
elevation [degrees above horizon (neglecting aberration)]
"""
=====================================
src/pymap3d/ecef.py
=====================================
@@ -19,6 +19,11 @@ except ImportError:
# py < 3.6 compatible
tau = 2 * pi
+try:
+ from numpy.typing import ArrayLike
+except ImportError:
+ ArrayLike = typing.Any
+
__all__ = [
"geodetic2ecef",
"ecef2geodetic",
@@ -31,24 +36,21 @@ __all__ = [
"enu2ecef",
]
-if typing.TYPE_CHECKING:
- from numpy import ndarray
-
def geodetic2ecef(
- lat: "ndarray", lon: "ndarray", alt: "ndarray", ell: Ellipsoid = None, deg: bool = True
-) -> typing.Tuple["ndarray", "ndarray", "ndarray"]:
+ lat: ArrayLike, lon: ArrayLike, alt: ArrayLike, ell: Ellipsoid = None, deg: bool = True
+) -> typing.Tuple[ArrayLike, ArrayLike, ArrayLike]:
"""
point transformation from Geodetic of specified ellipsoid (default WGS-84) to ECEF
Parameters
----------
- lat : "ndarray"
+ lat : ArrayLike
target geodetic latitude
- lon : "ndarray"
+ lon : ArrayLike
target geodetic longitude
- h : "ndarray"
+ h : ArrayLike
target altitude above geodetic ellipsoid (meters)
ell : Ellipsoid, optional
reference ellipsoid
@@ -61,11 +63,11 @@ def geodetic2ecef(
ECEF (Earth centered, Earth fixed) x,y,z
- x : "ndarray"
+ x : ArrayLike
target x ECEF coordinate (meters)
- y : "ndarray"
+ y : ArrayLike
target y ECEF coordinate (meters)
- z : "ndarray"
+ z : ArrayLike
target z ECEF coordinate (meters)
"""
lat, ell = sanitize(lat, ell, deg)
@@ -84,8 +86,8 @@ def geodetic2ecef(
def ecef2geodetic(
- x: "ndarray", y: "ndarray", z: "ndarray", ell: Ellipsoid = None, deg: bool = True
-) -> typing.Tuple["ndarray", "ndarray", "ndarray"]:
+ x: ArrayLike, y: ArrayLike, z: ArrayLike, ell: Ellipsoid = None, deg: bool = True
+) -> typing.Tuple[ArrayLike, ArrayLike, ArrayLike]:
if vectorize is not None:
fun = vectorize(ecef2geodetic_point)
lat, lon, alt = fun(x, y, z, ell, deg)
@@ -174,35 +176,35 @@ def ecef2geodetic_point(x: float, y: float, z: float, ell: Ellipsoid = None, deg
def ecef2enuv(
- u: "ndarray", v: "ndarray", w: "ndarray", lat0: "ndarray", lon0: "ndarray", deg: bool = True
-) -> typing.Tuple["ndarray", "ndarray", "ndarray"]:
+ u: ArrayLike, v: ArrayLike, w: ArrayLike, lat0: ArrayLike, lon0: ArrayLike, deg: bool = True
+) -> typing.Tuple[ArrayLike, ArrayLike, ArrayLike]:
"""
VECTOR from observer to target ECEF => ENU
Parameters
----------
- u : "ndarray"
+ u : ArrayLike
target x ECEF coordinate (meters)
- v : "ndarray"
+ v : ArrayLike
target y ECEF coordinate (meters)
- w : "ndarray"
+ w : ArrayLike
target z ECEF coordinate (meters)
- lat0 : "ndarray"
+ lat0 : ArrayLike
Observer geodetic latitude
- lon0 : "ndarray"
+ lon0 : ArrayLike
Observer geodetic longitude
- h0 : "ndarray"
+ h0 : ArrayLike
observer altitude above geodetic ellipsoid (meters)
deg : bool, optional
degrees input/output (False: radians in/out)
Returns
-------
- uEast : "ndarray"
+ uEast : ArrayLike
target east ENU coordinate (meters)
- vNorth : "ndarray"
+ vNorth : ArrayLike
target north ENU coordinate (meters)
- wUp : "ndarray"
+ wUp : ArrayLike
target up ENU coordinate (meters)
"""
@@ -219,31 +221,31 @@ def ecef2enuv(
def ecef2enu(
- x: "ndarray",
- y: "ndarray",
- z: "ndarray",
- lat0: "ndarray",
- lon0: "ndarray",
- h0: "ndarray",
+ x: ArrayLike,
+ y: ArrayLike,
+ z: ArrayLike,
+ lat0: ArrayLike,
+ lon0: ArrayLike,
+ h0: ArrayLike,
ell: Ellipsoid = None,
deg: bool = True,
-) -> typing.Tuple["ndarray", "ndarray", "ndarray"]:
+) -> typing.Tuple[ArrayLike, ArrayLike, ArrayLike]:
"""
from observer to target, ECEF => ENU
Parameters
----------
- x : "ndarray"
+ x : ArrayLike
target x ECEF coordinate (meters)
- y : "ndarray"
+ y : ArrayLike
target y ECEF coordinate (meters)
- z : "ndarray"
+ z : ArrayLike
target z ECEF coordinate (meters)
- lat0 : "ndarray"
+ lat0 : ArrayLike
Observer geodetic latitude
- lon0 : "ndarray"
+ lon0 : ArrayLike
Observer geodetic longitude
- h0 : "ndarray"
+ h0 : ArrayLike
observer altitude above geodetic ellipsoid (meters)
ell : Ellipsoid, optional
reference ellipsoid
@@ -252,11 +254,11 @@ def ecef2enu(
Returns
-------
- East : "ndarray"
+ East : ArrayLike
target east ENU coordinate (meters)
- North : "ndarray"
+ North : ArrayLike
target north ENU coordinate (meters)
- Up : "ndarray"
+ Up : ArrayLike
target up ENU coordinate (meters)
"""
@@ -266,25 +268,25 @@ def ecef2enu(
def enu2uvw(
- east: "ndarray", north: "ndarray", up: "ndarray", lat0: "ndarray", lon0: "ndarray", deg: bool = True
-) -> typing.Tuple["ndarray", "ndarray", "ndarray"]:
+ east: ArrayLike, north: ArrayLike, up: ArrayLike, lat0: ArrayLike, lon0: ArrayLike, deg: bool = True
+) -> typing.Tuple[ArrayLike, ArrayLike, ArrayLike]:
"""
Parameters
----------
- e1 : "ndarray"
+ e1 : ArrayLike
target east ENU coordinate (meters)
- n1 : "ndarray"
+ n1 : ArrayLike
target north ENU coordinate (meters)
- u1 : "ndarray"
+ u1 : ArrayLike
target up ENU coordinate (meters)
Results
-------
- u : "ndarray"
- v : "ndarray"
- w : "ndarray"
+ u : ArrayLike
+ v : ArrayLike
+ w : ArrayLike
"""
if deg:
@@ -301,25 +303,25 @@ def enu2uvw(
def uvw2enu(
- u: "ndarray", v: "ndarray", w: "ndarray", lat0: "ndarray", lon0: "ndarray", deg: bool = True
-) -> typing.Tuple["ndarray", "ndarray", "ndarray"]:
+ u: ArrayLike, v: ArrayLike, w: ArrayLike, lat0: ArrayLike, lon0: ArrayLike, deg: bool = True
+) -> typing.Tuple[ArrayLike, ArrayLike, ArrayLike]:
"""
Parameters
----------
- u : "ndarray"
- v : "ndarray"
- w : "ndarray"
+ u : ArrayLike
+ v : ArrayLike
+ w : ArrayLike
Results
-------
- East : "ndarray"
+ East : ArrayLike
target east ENU coordinate (meters)
- North : "ndarray"
+ North : ArrayLike
target north ENU coordinate (meters)
- Up : "ndarray"
+ Up : ArrayLike
target up ENU coordinate (meters)
"""
if deg:
@@ -335,8 +337,8 @@ def uvw2enu(
def eci2geodetic(
- x: "ndarray", y: "ndarray", z: "ndarray", t: datetime, ell: Ellipsoid = None, *, deg: bool = True, use_astropy: bool = True
-) -> typing.Tuple["ndarray", "ndarray", "ndarray"]:
+ x: ArrayLike, y: ArrayLike, z: ArrayLike, t: datetime, ell: Ellipsoid = None, *, deg: bool = True, use_astropy: bool = True
+) -> typing.Tuple[ArrayLike, ArrayLike, ArrayLike]:
"""
convert Earth Centered Internal ECI to geodetic coordinates
@@ -344,13 +346,13 @@ def eci2geodetic(
Parameters
----------
- x : "ndarray"
+ x : ArrayLike
ECI x-location [meters]
- y : "ndarray"
+ y : ArrayLike
ECI y-location [meters]
- z : "ndarray"
+ z : ArrayLike
ECI z-location [meters]
- t : datetime.datetime, "ndarray"
+ t : datetime.datetime, ArrayLike
UTC time
ell : Ellipsoid, optional
planet ellipsoid model
@@ -361,11 +363,11 @@ def eci2geodetic(
Results
-------
- lat : "ndarray"
+ lat : ArrayLike
geodetic latitude
- lon : "ndarray"
+ lon : ArrayLike
geodetic longitude
- alt : "ndarray"
+ alt : ArrayLike
altitude above ellipsoid (meters)
eci2geodetic() a.k.a. eci2lla()
@@ -379,15 +381,15 @@ def eci2geodetic(
def geodetic2eci(
- lat: "ndarray",
- lon: "ndarray",
- alt: "ndarray",
+ lat: ArrayLike,
+ lon: ArrayLike,
+ alt: ArrayLike,
t: datetime,
ell: Ellipsoid = None,
*,
deg: bool = True,
use_astropy: bool = True
-) -> typing.Tuple["ndarray", "ndarray", "ndarray"]:
+) -> typing.Tuple[ArrayLike, ArrayLike, ArrayLike]:
"""
convert geodetic coordinates to Earth Centered Internal ECI
@@ -395,13 +397,13 @@ def geodetic2eci(
Parameters
----------
- lat : "ndarray"
+ lat : ArrayLike
geodetic latitude
- lon : "ndarray"
+ lon : ArrayLike
geodetic longitude
- alt : "ndarray"
+ alt : ArrayLike
altitude above ellipsoid (meters)
- t : datetime.datetime, "ndarray"
+ t : datetime.datetime, ArrayLike
UTC time
ell : Ellipsoid, optional
planet ellipsoid model
@@ -412,11 +414,11 @@ def geodetic2eci(
Results
-------
- x : "ndarray"
+ x : ArrayLike
ECI x-location [meters]
- y : "ndarray"
+ y : ArrayLike
ECI y-location [meters]
- z : "ndarray"
+ z : ArrayLike
ECI z-location [meters]
geodetic2eci() a.k.a lla2eci()
@@ -430,32 +432,32 @@ def geodetic2eci(
def enu2ecef(
- e1: "ndarray",
- n1: "ndarray",
- u1: "ndarray",
- lat0: "ndarray",
- lon0: "ndarray",
- h0: "ndarray",
+ e1: ArrayLike,
+ n1: ArrayLike,
+ u1: ArrayLike,
+ lat0: ArrayLike,
+ lon0: ArrayLike,
+ h0: ArrayLike,
ell: Ellipsoid = None,
deg: bool = True,
-) -> typing.Tuple["ndarray", "ndarray", "ndarray"]:
+) -> typing.Tuple[ArrayLike, ArrayLike, ArrayLike]:
"""
ENU to ECEF
Parameters
----------
- e1 : "ndarray"
+ e1 : ArrayLike
target east ENU coordinate (meters)
- n1 : "ndarray"
+ n1 : ArrayLike
target north ENU coordinate (meters)
- u1 : "ndarray"
+ u1 : ArrayLike
target up ENU coordinate (meters)
- lat0 : "ndarray"
+ lat0 : ArrayLike
Observer geodetic latitude
- lon0 : "ndarray"
+ lon0 : ArrayLike
Observer geodetic longitude
- h0 : "ndarray"
+ h0 : ArrayLike
observer altitude above geodetic ellipsoid (meters)
ell : Ellipsoid, optional
reference ellipsoid
@@ -465,11 +467,11 @@ def enu2ecef(
Results
-------
- x : "ndarray"
+ x : ArrayLike
target x ECEF coordinate (meters)
- y : "ndarray"
+ y : ArrayLike
target y ECEF coordinate (meters)
- z : "ndarray"
+ z : ArrayLike
target z ECEF coordinate (meters)
"""
x0, y0, z0 = geodetic2ecef(lat0, lon0, h0, ell, deg=deg)
=====================================
src/pymap3d/eci.py
=====================================
@@ -2,7 +2,7 @@
from datetime import datetime
import typing
-from numpy import array, ndarray, sin, cos, column_stack, empty, atleast_1d
+from numpy import array, sin, cos, column_stack, empty, atleast_1d
try:
from astropy.coordinates import GCRS, ITRS, EarthLocation, CartesianRepresentation
@@ -13,12 +13,17 @@ except ImportError:
from .sidereal import greenwichsrt, juliandate
+try:
+ from numpy.typing import ArrayLike
+except ImportError:
+ ArrayLike = typing.Any
+
__all__ = ["eci2ecef", "ecef2eci"]
def eci2ecef(
- x: "ndarray", y: "ndarray", z: "ndarray", time: datetime, *, use_astropy: bool = True
-) -> typing.Tuple["ndarray", "ndarray", "ndarray"]:
+ x: ArrayLike, y: ArrayLike, z: ArrayLike, time: datetime, *, use_astropy: bool = True
+) -> typing.Tuple[ArrayLike, ArrayLike, ArrayLike]:
"""
Observer => Point ECI => ECEF
@@ -26,11 +31,11 @@ def eci2ecef(
Parameters
----------
- x : "ndarray"
+ x : ArrayLike
ECI x-location [meters]
- y : "ndarray"
+ y : ArrayLike
ECI y-location [meters]
- z : "ndarray"
+ z : ArrayLike
ECI z-location [meters]
time : datetime.datetime
time of obsevation (UTC)
@@ -39,11 +44,11 @@ def eci2ecef(
Results
-------
- x_ecef : "ndarray"
+ x_ecef : ArrayLike
x ECEF coordinate
- y_ecef : "ndarray"
+ y_ecef : ArrayLike
y ECEF coordinate
- z_ecef : "ndarray"
+ z_ecef : ArrayLike
z ECEF coordinate
"""
@@ -75,8 +80,8 @@ def eci2ecef(
def ecef2eci(
- x: "ndarray", y: "ndarray", z: "ndarray", time: datetime, *, use_astropy: bool = True
-) -> typing.Tuple["ndarray", "ndarray", "ndarray"]:
+ x: ArrayLike, y: ArrayLike, z: ArrayLike, time: datetime, *, use_astropy: bool = True
+) -> typing.Tuple[ArrayLike, ArrayLike, ArrayLike]:
"""
Point => Point ECEF => ECI
@@ -85,11 +90,11 @@ def ecef2eci(
Parameters
----------
- x : "ndarray"
+ x : ArrayLike
target x ECEF coordinate
- y : "ndarray"
+ y : ArrayLike
target y ECEF coordinate
- z : "ndarray"
+ z : ArrayLike
target z ECEF coordinate
time : datetime.datetime
time of observation
@@ -98,11 +103,11 @@ def ecef2eci(
Results
-------
- x_eci : "ndarray"
+ x_eci : ArrayLike
x ECI coordinate
- y_eci : "ndarray"
+ y_eci : ArrayLike
y ECI coordinate
- z_eci : "ndarray"
+ z_eci : ArrayLike
z ECI coordinate
"""
@@ -134,6 +139,6 @@ def ecef2eci(
return x_eci, y_eci, z_eci
-def R3(x: float) -> "ndarray":
+def R3(x: float) -> ArrayLike:
"""Rotation matrix for ECI"""
return array([[cos(x), sin(x), 0], [-sin(x), cos(x), 0], [0, 0, 1]])
=====================================
src/pymap3d/enu.py
=====================================
@@ -11,27 +11,29 @@ except ImportError:
from .ecef import geodetic2ecef, ecef2geodetic, enu2ecef, uvw2enu
from .ellipsoid import Ellipsoid
+try:
+ from numpy.typing import ArrayLike
+except ImportError:
+ ArrayLike = typing.Any
+
# py < 3.6 compatible
tau = 2 * pi
__all__ = ["enu2aer", "aer2enu", "enu2geodetic", "geodetic2enu"]
-if typing.TYPE_CHECKING:
- from numpy import ndarray
-
-def enu2aer(e: "ndarray", n: "ndarray", u: "ndarray", deg: bool = True) -> typing.Tuple["ndarray", "ndarray", "ndarray"]:
+def enu2aer(e: ArrayLike, n: ArrayLike, u: ArrayLike, deg: bool = True) -> typing.Tuple[ArrayLike, ArrayLike, ArrayLike]:
"""
ENU to Azimuth, Elevation, Range
Parameters
----------
- e : "ndarray"
+ e : ArrayLike
ENU East coordinate (meters)
- n : "ndarray"
+ n : ArrayLike
ENU North coordinate (meters)
- u : "ndarray"
+ u : ArrayLike
ENU Up coordinate (meters)
deg : bool, optional
degrees input/output (False: radians in/out)
@@ -39,11 +41,11 @@ def enu2aer(e: "ndarray", n: "ndarray", u: "ndarray", deg: bool = True) -> typin
Results
-------
- azimuth : "ndarray"
+ azimuth : ArrayLike
azimuth to rarget
- elevation : "ndarray"
+ elevation : ArrayLike
elevation to target
- srange : "ndarray"
+ srange : ArrayLike
slant range [meters]
"""
if vectorize is not None:
@@ -54,7 +56,7 @@ def enu2aer(e: "ndarray", n: "ndarray", u: "ndarray", deg: bool = True) -> typin
return enu2aer_point(e, n, u, deg)
-def enu2aer_point(e: "ndarray", n: "ndarray", u: "ndarray", deg: bool = True) -> typing.Tuple["ndarray", "ndarray", "ndarray"]:
+def enu2aer_point(e: ArrayLike, n: ArrayLike, u: ArrayLike, deg: bool = True) -> typing.Tuple[ArrayLike, ArrayLike, ArrayLike]:
# 1 millimeter precision for singularity
@@ -77,7 +79,7 @@ def enu2aer_point(e: "ndarray", n: "ndarray", u: "ndarray", deg: bool = True) ->
return az, elev, slantRange
-def aer2enu(az: "ndarray", el: "ndarray", srange: "ndarray", deg: bool = True) -> typing.Tuple["ndarray", "ndarray", "ndarray"]:
+def aer2enu(az: ArrayLike, el: ArrayLike, srange: ArrayLike, deg: bool = True) -> typing.Tuple[ArrayLike, ArrayLike, ArrayLike]:
if vectorize is not None:
fun = vectorize(aer2enu_point)
e, n, u = fun(az, el, srange, deg)
@@ -123,31 +125,31 @@ def aer2enu_point(az: float, el: float, srange: float, deg: bool = True) -> typi
def enu2geodetic(
- e: "ndarray",
- n: "ndarray",
- u: "ndarray",
- lat0: "ndarray",
- lon0: "ndarray",
- h0: "ndarray",
+ e: ArrayLike,
+ n: ArrayLike,
+ u: ArrayLike,
+ lat0: ArrayLike,
+ lon0: ArrayLike,
+ h0: ArrayLike,
ell: Ellipsoid = None,
deg: bool = True,
-) -> typing.Tuple["ndarray", "ndarray", "ndarray"]:
+) -> typing.Tuple[ArrayLike, ArrayLike, ArrayLike]:
"""
East, North, Up to target to geodetic coordinates
Parameters
----------
- e : "ndarray"
+ e : ArrayLike
East ENU coordinate (meters)
- n : "ndarray"
+ n : ArrayLike
North ENU coordinate (meters)
- u : "ndarray"
+ u : ArrayLike
Up ENU coordinate (meters)
- lat0 : "ndarray"
+ lat0 : ArrayLike
Observer geodetic latitude
- lon0 : "ndarray"
+ lon0 : ArrayLike
Observer geodetic longitude
- h0 : "ndarray"
+ h0 : ArrayLike
observer altitude above geodetic ellipsoid (meters)
ell : Ellipsoid, optional
reference ellipsoid
@@ -157,11 +159,11 @@ def enu2geodetic(
Results
-------
- lat : "ndarray"
+ lat : ArrayLike
geodetic latitude
- lon : "ndarray"
+ lon : ArrayLike
geodetic longitude
- alt : "ndarray"
+ alt : ArrayLike
altitude above ellipsoid (meters)
"""
@@ -171,29 +173,29 @@ def enu2geodetic(
def geodetic2enu(
- lat: "ndarray",
- lon: "ndarray",
- h: "ndarray",
- lat0: "ndarray",
- lon0: "ndarray",
- h0: "ndarray",
+ lat: ArrayLike,
+ lon: ArrayLike,
+ h: ArrayLike,
+ lat0: ArrayLike,
+ lon0: ArrayLike,
+ h0: ArrayLike,
ell: Ellipsoid = None,
deg: bool = True,
-) -> typing.Tuple["ndarray", "ndarray", "ndarray"]:
+) -> typing.Tuple[ArrayLike, ArrayLike, ArrayLike]:
"""
Parameters
----------
- lat : "ndarray"
+ lat : ArrayLike
target geodetic latitude
- lon : "ndarray"
+ lon : ArrayLike
target geodetic longitude
- h : "ndarray"
+ h : ArrayLike
target altitude above ellipsoid (meters)
- lat0 : "ndarray"
+ lat0 : ArrayLike
Observer geodetic latitude
- lon0 : "ndarray"
+ lon0 : ArrayLike
Observer geodetic longitude
- h0 : "ndarray"
+ h0 : ArrayLike
observer altitude above geodetic ellipsoid (meters)
ell : Ellipsoid, optional
reference ellipsoid
@@ -203,11 +205,11 @@ def geodetic2enu(
Results
-------
- e : "ndarray"
+ e : ArrayLike
East ENU
- n : "ndarray"
+ n : ArrayLike
North ENU
- u : "ndarray"
+ u : ArrayLike
Up ENU
"""
x1, y1, z1 = geodetic2ecef(lat, lon, h, ell, deg=deg)
=====================================
src/pymap3d/haversine.py
=====================================
@@ -20,24 +20,26 @@ try:
except ImportError:
angular_separation = None
-__all__ = ["anglesep", "anglesep_meeus", "haversine"]
+try:
+ from numpy.typing import ArrayLike
+except ImportError:
+ ArrayLike = typing.Any
-if typing.TYPE_CHECKING:
- from numpy import ndarray
+__all__ = ["anglesep", "anglesep_meeus", "haversine"]
-def anglesep_meeus(lon0: "ndarray", lat0: "ndarray", lon1: "ndarray", lat1: "ndarray", deg: bool = True) -> "ndarray":
+def anglesep_meeus(lon0: ArrayLike, lat0: ArrayLike, lon1: ArrayLike, lat1: ArrayLike, deg: bool = True) -> ArrayLike:
"""
Parameters
----------
- lon0 : "ndarray"
+ lon0 : ArrayLike
longitude of first point
- lat0 : "ndarray"
+ lat0 : ArrayLike
latitude of first point
- lon1 : "ndarray"
+ lon1 : ArrayLike
longitude of second point
- lat1 : "ndarray"
+ lat1 : ArrayLike
latitude of second point
deg : bool, optional
degrees input/output (False: radians in/out)
@@ -45,7 +47,7 @@ def anglesep_meeus(lon0: "ndarray", lat0: "ndarray", lon1: "ndarray", lat1: "nda
Returns
-------
- sep_rad : "ndarray"
+ sep_rad : ArrayLike
angular separation
@@ -71,18 +73,18 @@ def anglesep_meeus(lon0: "ndarray", lat0: "ndarray", lon1: "ndarray", lat1: "nda
return degrees(sep_rad) if deg else sep_rad
-def anglesep(lon0: "ndarray", lat0: "ndarray", lon1: "ndarray", lat1: "ndarray", deg: bool = True) -> "ndarray":
+def anglesep(lon0: ArrayLike, lat0: ArrayLike, lon1: ArrayLike, lat1: ArrayLike, deg: bool = True) -> ArrayLike:
"""
Parameters
----------
- lon0 : "ndarray"
+ lon0 : ArrayLike
longitude of first point
- lat0 : "ndarray"
+ lat0 : ArrayLike
latitude of first point
- lon1 : "ndarray"
+ lon1 : ArrayLike
longitude of second point
- lat1 : "ndarray"
+ lat1 : ArrayLike
latitude of second point
deg : bool, optional
degrees input/output (False: radians in/out)
@@ -90,7 +92,7 @@ def anglesep(lon0: "ndarray", lat0: "ndarray", lon1: "ndarray", lat1: "ndarray",
Returns
-------
- sep_rad : "ndarray"
+ sep_rad : ArrayLike
angular separation
For reference, this is from astropy astropy/coordinates/angle_utilities.py
@@ -110,20 +112,20 @@ def anglesep(lon0: "ndarray", lat0: "ndarray", lon1: "ndarray", lat1: "ndarray",
return degrees(sep_rad) if deg else sep_rad
-def haversine(theta: "ndarray") -> "ndarray":
+def haversine(theta: ArrayLike) -> ArrayLike:
"""
Compute haversine
Parameters
----------
- theta : "ndarray"
+ theta : ArrayLike
angle (radians)
Results
-------
- htheta : "ndarray"
+ htheta : ArrayLike
haversine of `theta`
https://en.wikipedia.org/wiki/Haversine
=====================================
src/pymap3d/latitude.py
=====================================
@@ -15,6 +15,11 @@ except ImportError:
use_numpy = False
+try:
+ from numpy.typing import ArrayLike
+except ImportError:
+ ArrayLike = typing.Any
+
__all__ = [
"geodetic2isometric",
"isometric2geodetic",
@@ -32,11 +37,8 @@ __all__ = [
"geoc2geod",
]
-if typing.TYPE_CHECKING:
- from numpy import ndarray
-
-def geoc2geod(geocentric_lat: "ndarray", geocentric_distance: "ndarray", ell: Ellipsoid = None, deg: bool = True) -> "ndarray":
+def geoc2geod(geocentric_lat: ArrayLike, geocentric_distance: ArrayLike, ell: Ellipsoid = None, deg: bool = True) -> ArrayLike:
"""
convert geocentric latitude to geodetic latitude, consider mean sea level altitude
@@ -44,9 +46,9 @@ def geoc2geod(geocentric_lat: "ndarray", geocentric_distance: "ndarray", ell: El
Parameters
----------
- geocentric_lat : "ndarray"
+ geocentric_lat : ArrayLike
geocentric latitude
- geocentric_distance: "ndarray"
+ geocentric_distance: ArrayLike
distance from planet center, meters (NOT altitude above ground!)
ell : Ellipsoid, optional
reference ellipsoid (default WGS84)
@@ -55,7 +57,7 @@ def geoc2geod(geocentric_lat: "ndarray", geocentric_distance: "ndarray", ell: El
Returns
-------
- geodetic_lat : "ndarray"
+ geodetic_lat : ArrayLike
geodetic latiude
@@ -78,7 +80,7 @@ def geoc2geod(geocentric_lat: "ndarray", geocentric_distance: "ndarray", ell: El
return degrees(geodetic_lat) if deg else geodetic_lat
-def geodetic2geocentric(geodetic_lat: "ndarray", alt_m: "ndarray", ell: Ellipsoid = None, deg: bool = True) -> "ndarray":
+def geodetic2geocentric(geodetic_lat: ArrayLike, alt_m: ArrayLike, ell: Ellipsoid = None, deg: bool = True) -> ArrayLike:
"""
convert geodetic latitude to geocentric latitude on spheroid surface
@@ -87,9 +89,9 @@ def geodetic2geocentric(geodetic_lat: "ndarray", alt_m: "ndarray", ell: Ellipsoi
Parameters
----------
- geodetic_lat : "ndarray"
+ geodetic_lat : ArrayLike
geodetic latitude
- alt_m: "ndarray"
+ alt_m: ArrayLike
altitude above ellipsoid
ell : Ellipsoid, optional
reference ellipsoid (default WGS84)
@@ -98,7 +100,7 @@ def geodetic2geocentric(geodetic_lat: "ndarray", alt_m: "ndarray", ell: Ellipsoi
Returns
-------
- geocentric_lat : "ndarray"
+ geocentric_lat : ArrayLike
geocentric latiude
Notes
@@ -117,7 +119,7 @@ def geodetic2geocentric(geodetic_lat: "ndarray", alt_m: "ndarray", ell: Ellipsoi
geod2geoc = geodetic2geocentric
-def geocentric2geodetic(geocentric_lat: "ndarray", alt_m: "ndarray", ell: Ellipsoid = None, deg: bool = True) -> "ndarray":
+def geocentric2geodetic(geocentric_lat: ArrayLike, alt_m: ArrayLike, ell: Ellipsoid = None, deg: bool = True) -> ArrayLike:
"""
converts from geocentric latitude to geodetic latitude
@@ -126,9 +128,9 @@ def geocentric2geodetic(geocentric_lat: "ndarray", alt_m: "ndarray", ell: Ellips
Parameters
----------
- geocentric_lat : "ndarray"
+ geocentric_lat : ArrayLike
geocentric latitude
- alt_m: "ndarray"
+ alt_m: ArrayLike
altitude above ellipsoid
ell : Ellipsoid, optional
reference ellipsoid (default WGS84)
@@ -137,7 +139,7 @@ def geocentric2geodetic(geocentric_lat: "ndarray", alt_m: "ndarray", ell: Ellips
Returns
-------
- geodetic_lat : "ndarray"
+ geodetic_lat : ArrayLike
geodetic latiude
Notes
@@ -174,7 +176,7 @@ def geodetic2isometric_point(geodetic_lat: float, ell: Ellipsoid = None, deg: bo
return degrees(isometric_lat) if deg else isometric_lat
-def geodetic2isometric(geodetic_lat: "ndarray", ell: Ellipsoid = None, deg: bool = True) -> "ndarray":
+def geodetic2isometric(geodetic_lat: ArrayLike, ell: Ellipsoid = None, deg: bool = True) -> ArrayLike:
"""
computes isometric latitude on an ellipsoid
@@ -183,7 +185,7 @@ def geodetic2isometric(geodetic_lat: "ndarray", ell: Ellipsoid = None, deg: bool
Parameters
----------
- lat : "ndarray"
+ lat : ArrayLike
geodetic latitude
ell : Ellipsoid, optional
reference ellipsoid (default WGS84)
@@ -192,7 +194,7 @@ def geodetic2isometric(geodetic_lat: "ndarray", ell: Ellipsoid = None, deg: bool
Returns
-------
- isolat : "ndarray"
+ isolat : ArrayLike
isometric latiude
Notes
@@ -210,7 +212,7 @@ def geodetic2isometric(geodetic_lat: "ndarray", ell: Ellipsoid = None, deg: bool
return geodetic2isometric_point(geodetic_lat, ell, deg)
-def isometric2geodetic(isometric_lat: "ndarray", ell: Ellipsoid = None, deg: bool = True) -> "ndarray":
+def isometric2geodetic(isometric_lat: ArrayLike, ell: Ellipsoid = None, deg: bool = True) -> ArrayLike:
"""
converts from isometric latitude to geodetic latitude
@@ -218,7 +220,7 @@ def isometric2geodetic(isometric_lat: "ndarray", ell: Ellipsoid = None, deg: boo
Parameters
----------
- isometric_lat : "ndarray"
+ isometric_lat : ArrayLike
isometric latitude
ell : Ellipsoid, optional
reference ellipsoid (default WGS84)
@@ -227,7 +229,7 @@ def isometric2geodetic(isometric_lat: "ndarray", ell: Ellipsoid = None, deg: boo
Returns
-------
- geodetic_lat : "ndarray"
+ geodetic_lat : ArrayLike
geodetic latiude
Notes
@@ -246,7 +248,7 @@ def isometric2geodetic(isometric_lat: "ndarray", ell: Ellipsoid = None, deg: boo
return degrees(geodetic_lat) if deg else geodetic_lat
-def conformal2geodetic(conformal_lat: "ndarray", ell: Ellipsoid = None, deg: bool = True) -> "ndarray":
+def conformal2geodetic(conformal_lat: ArrayLike, ell: Ellipsoid = None, deg: bool = True) -> ArrayLike:
"""
converts from conformal latitude to geodetic latitude
@@ -254,7 +256,7 @@ def conformal2geodetic(conformal_lat: "ndarray", ell: Ellipsoid = None, deg: boo
Parameters
----------
- conformal_lat : "ndarray"
+ conformal_lat : ArrayLike
conformal latitude
ell : Ellipsoid, optional
reference ellipsoid (default WGS84)
@@ -263,7 +265,7 @@ def conformal2geodetic(conformal_lat: "ndarray", ell: Ellipsoid = None, deg: boo
Returns
-------
- geodetic_lat : "ndarray"
+ geodetic_lat : ArrayLike
geodetic latiude
Notes
@@ -291,7 +293,7 @@ def conformal2geodetic(conformal_lat: "ndarray", ell: Ellipsoid = None, deg: boo
return degrees(geodetic_lat) if deg else geodetic_lat
-def geodetic2conformal(geodetic_lat: "ndarray", ell: Ellipsoid = None, deg: bool = True) -> "ndarray":
+def geodetic2conformal(geodetic_lat: ArrayLike, ell: Ellipsoid = None, deg: bool = True) -> ArrayLike:
"""
converts from geodetic latitude to conformal latitude
@@ -299,7 +301,7 @@ def geodetic2conformal(geodetic_lat: "ndarray", ell: Ellipsoid = None, deg: bool
Parameters
----------
- geodetic_lat : "ndarray"
+ geodetic_lat : ArrayLike
geodetic latitude
ell : Ellipsoid, optional
reference ellipsoid (default WGS84)
@@ -308,7 +310,7 @@ def geodetic2conformal(geodetic_lat: "ndarray", ell: Ellipsoid = None, deg: bool
Returns
-------
- conformal_lat : "ndarray"
+ conformal_lat : ArrayLike
conformal latiude
Notes
@@ -344,7 +346,7 @@ def geodetic2conformal_point(geodetic_lat: float, ell: Ellipsoid = None, deg: bo
# %% rectifying
-def geodetic2rectifying(geodetic_lat: "ndarray", ell: Ellipsoid = None, deg: bool = True) -> "ndarray":
+def geodetic2rectifying(geodetic_lat: ArrayLike, ell: Ellipsoid = None, deg: bool = True) -> ArrayLike:
"""
converts from geodetic latitude to rectifying latitude
@@ -352,7 +354,7 @@ def geodetic2rectifying(geodetic_lat: "ndarray", ell: Ellipsoid = None, deg: boo
Parameters
----------
- geodetic_lat : "ndarray"
+ geodetic_lat : ArrayLike
geodetic latitude
ell : Ellipsoid, optional
reference ellipsoid (default WGS84)
@@ -361,7 +363,7 @@ def geodetic2rectifying(geodetic_lat: "ndarray", ell: Ellipsoid = None, deg: boo
Returns
-------
- rectifying_lat : "ndarray"
+ rectifying_lat : ArrayLike
rectifying latiude
Notes
@@ -390,7 +392,7 @@ def geodetic2rectifying(geodetic_lat: "ndarray", ell: Ellipsoid = None, deg: boo
return degrees(rectifying_lat) if deg else rectifying_lat
-def rectifying2geodetic(rectifying_lat: "ndarray", ell: Ellipsoid = None, deg: bool = True) -> "ndarray":
+def rectifying2geodetic(rectifying_lat: ArrayLike, ell: Ellipsoid = None, deg: bool = True) -> ArrayLike:
"""
converts from rectifying latitude to geodetic latitude
@@ -398,7 +400,7 @@ def rectifying2geodetic(rectifying_lat: "ndarray", ell: Ellipsoid = None, deg: b
Parameters
----------
- rectifying_lat : "ndarray"
+ rectifying_lat : ArrayLike
latitude
ell : Ellipsoid, optional
reference ellipsoid (default WGS84)
@@ -407,7 +409,7 @@ def rectifying2geodetic(rectifying_lat: "ndarray", ell: Ellipsoid = None, deg: b
Returns
-------
- geodetic_lat : "ndarray"
+ geodetic_lat : ArrayLike
geodetic latiude
Notes
@@ -436,7 +438,7 @@ def rectifying2geodetic(rectifying_lat: "ndarray", ell: Ellipsoid = None, deg: b
# %% authalic
-def geodetic2authalic(geodetic_lat: "ndarray", ell: Ellipsoid = None, deg: bool = True) -> "ndarray":
+def geodetic2authalic(geodetic_lat: ArrayLike, ell: Ellipsoid = None, deg: bool = True) -> ArrayLike:
"""
converts from geodetic latitude to authalic latitude
@@ -444,7 +446,7 @@ def geodetic2authalic(geodetic_lat: "ndarray", ell: Ellipsoid = None, deg: bool
Parameters
----------
- geodetic_lat : "ndarray"
+ geodetic_lat : ArrayLike
geodetic latitude
ell : Ellipsoid, optional
reference ellipsoid (default WGS84)
@@ -453,7 +455,7 @@ def geodetic2authalic(geodetic_lat: "ndarray", ell: Ellipsoid = None, deg: bool
Returns
-------
- authalic_lat : "ndarray"
+ authalic_lat : ArrayLike
authalic latiude
Notes
@@ -475,7 +477,7 @@ def geodetic2authalic(geodetic_lat: "ndarray", ell: Ellipsoid = None, deg: bool
return degrees(authalic_lat) if deg else authalic_lat
-def authalic2geodetic(authalic_lat: "ndarray", ell: Ellipsoid = None, deg: bool = True) -> "ndarray":
+def authalic2geodetic(authalic_lat: ArrayLike, ell: Ellipsoid = None, deg: bool = True) -> ArrayLike:
"""
converts from authalic latitude to geodetic latitude
@@ -483,7 +485,7 @@ def authalic2geodetic(authalic_lat: "ndarray", ell: Ellipsoid = None, deg: bool
Parameters
----------
- authalic_lat : "ndarray"
+ authalic_lat : ArrayLike
latitude
ell : Ellipsoid, optional
reference ellipsoid (default WGS84)
@@ -492,7 +494,7 @@ def authalic2geodetic(authalic_lat: "ndarray", ell: Ellipsoid = None, deg: bool
Returns
-------
- geodetic_lat : "ndarray"
+ geodetic_lat : ArrayLike
geodetic latiude
Notes
@@ -513,7 +515,7 @@ def authalic2geodetic(authalic_lat: "ndarray", ell: Ellipsoid = None, deg: bool
# %% parametric
-def geodetic2parametric(geodetic_lat: "ndarray", ell: Ellipsoid = None, deg: bool = True) -> "ndarray":
+def geodetic2parametric(geodetic_lat: ArrayLike, ell: Ellipsoid = None, deg: bool = True) -> ArrayLike:
"""
converts from geodetic latitude to parametric latitude
@@ -521,7 +523,7 @@ def geodetic2parametric(geodetic_lat: "ndarray", ell: Ellipsoid = None, deg: boo
Parameters
----------
- geodetic_lat : "ndarray"
+ geodetic_lat : ArrayLike
geodetic latitude
ell : Ellipsoid, optional
reference ellipsoid (default WGS84)
@@ -530,7 +532,7 @@ def geodetic2parametric(geodetic_lat: "ndarray", ell: Ellipsoid = None, deg: boo
Returns
-------
- parametric_lat : "ndarray"
+ parametric_lat : ArrayLike
parametric latiude
Notes
@@ -547,7 +549,7 @@ def geodetic2parametric(geodetic_lat: "ndarray", ell: Ellipsoid = None, deg: boo
return degrees(parametric_lat) if deg else parametric_lat
-def parametric2geodetic(parametric_lat: "ndarray", ell: Ellipsoid = None, deg: bool = True) -> "ndarray":
+def parametric2geodetic(parametric_lat: ArrayLike, ell: Ellipsoid = None, deg: bool = True) -> ArrayLike:
"""
converts from parametric latitude to geodetic latitude
@@ -555,7 +557,7 @@ def parametric2geodetic(parametric_lat: "ndarray", ell: Ellipsoid = None, deg: b
Parameters
----------
- parametric_lat : "ndarray"
+ parametric_lat : ArrayLike
latitude
ell : Ellipsoid, optional
reference ellipsoid (default WGS84)
@@ -564,7 +566,7 @@ def parametric2geodetic(parametric_lat: "ndarray", ell: Ellipsoid = None, deg: b
Returns
-------
- geodetic_lat : "ndarray"
+ geodetic_lat : ArrayLike
geodetic latiude
Notes
=====================================
src/pymap3d/los.py
=====================================
@@ -13,30 +13,32 @@ from .aer import aer2enu
from .ecef import enu2uvw, geodetic2ecef, ecef2geodetic
from .ellipsoid import Ellipsoid
-__all__ = ["lookAtSpheroid"]
+try:
+ from numpy.typing import ArrayLike
+except ImportError:
+ ArrayLike = typing.Any
-if typing.TYPE_CHECKING:
- from numpy import ndarray
+__all__ = ["lookAtSpheroid"]
def lookAtSpheroid(
- lat0: "ndarray", lon0: "ndarray", h0: "ndarray", az: "ndarray", tilt: "ndarray", ell: Ellipsoid = None, deg: bool = True
-) -> typing.Tuple["ndarray", "ndarray", "ndarray"]:
+ lat0: ArrayLike, lon0: ArrayLike, h0: ArrayLike, az: ArrayLike, tilt: ArrayLike, ell: Ellipsoid = None, deg: bool = True
+) -> typing.Tuple[ArrayLike, ArrayLike, ArrayLike]:
"""
Calculates line-of-sight intersection with Earth (or other ellipsoid) surface from above surface / orbit
Parameters
----------
- lat0 : "ndarray"
+ lat0 : ArrayLike
observer geodetic latitude
- lon0 : "ndarray"
+ lon0 : ArrayLike
observer geodetic longitude
- h0 : "ndarray"
+ h0 : ArrayLike
observer altitude (meters) Must be non-negative since this function doesn't consider terrain
- az : "ndarray"
+ az : ArrayLike
azimuth angle of line-of-sight, clockwise from North
- tilt : "ndarray"
+ tilt : ArrayLike
tilt angle of line-of-sight with respect to local vertical (nadir = 0)
ell : Ellipsoid, optional
reference ellipsoid
@@ -46,11 +48,11 @@ def lookAtSpheroid(
Results
-------
- lat : "ndarray"
+ lat : ArrayLike
geodetic latitude where the line-of-sight intersects with the Earth ellipsoid
- lon : "ndarray"
+ lon : ArrayLike
geodetic longitude where the line-of-sight intersects with the Earth ellipsoid
- d : "ndarray"
+ d : ArrayLike
slant range (meters) from starting point to intersect point
Values will be NaN if the line of sight does not intersect.
=====================================
src/pymap3d/lox.py
=====================================
@@ -12,19 +12,21 @@ from .rsphere import rsphere_rectifying
from .latitude import geodetic2rectifying, rectifying2geodetic, geodetic2isometric, geodetic2authalic, authalic2geodetic
from .utils import sph2cart, cart2sph
-__all__ = ["loxodrome_inverse", "loxodrome_direct", "meridian_arc", "meridian_dist", "departure", "meanm"]
+try:
+ from numpy.typing import ArrayLike
+except ImportError:
+ ArrayLike = typing.Any
-if typing.TYPE_CHECKING:
- from numpy import ndarray
+__all__ = ["loxodrome_inverse", "loxodrome_direct", "meridian_arc", "meridian_dist", "departure", "meanm"]
-def meridian_dist(lat: "ndarray", ell: Ellipsoid = None, deg: bool = True) -> "ndarray":
+def meridian_dist(lat: ArrayLike, ell: Ellipsoid = None, deg: bool = True) -> ArrayLike:
"""
Computes the ground distance on an ellipsoid from the equator to the input latitude.
Parameters
----------
- lat : "ndarray"
+ lat : ArrayLike
geodetic latitude
ell : Ellipsoid, optional
reference ellipsoid (default WGS84)
@@ -33,19 +35,19 @@ def meridian_dist(lat: "ndarray", ell: Ellipsoid = None, deg: bool = True) -> "n
Results
-------
- dist : "ndarray"
+ dist : ArrayLike
distance (meters)
"""
return meridian_arc(0, lat, ell, deg)
-def meridian_arc(lat1: "ndarray", lat2: "ndarray", ell: Ellipsoid = None, deg: bool = True) -> "ndarray":
+def meridian_arc(lat1: ArrayLike, lat2: ArrayLike, ell: Ellipsoid = None, deg: bool = True) -> ArrayLike:
"""
Computes the ground distance on an ellipsoid between two latitudes.
Parameters
----------
- lat1, lat2 : "ndarray"
+ lat1, lat2 : ArrayLike
geodetic latitudes
ell : Ellipsoid, optional
reference ellipsoid (default WGS84)
@@ -54,7 +56,7 @@ def meridian_arc(lat1: "ndarray", lat2: "ndarray", ell: Ellipsoid = None, deg: b
Results
-------
- dist : "ndarray"
+ dist : ArrayLike
distance (meters)
"""
@@ -68,8 +70,8 @@ def meridian_arc(lat1: "ndarray", lat2: "ndarray", ell: Ellipsoid = None, deg: b
def loxodrome_inverse(
- lat1: "ndarray", lon1: "ndarray", lat2: "ndarray", lon2: "ndarray", ell: Ellipsoid = None, deg: bool = True
-) -> typing.Tuple["ndarray", "ndarray"]:
+ lat1: ArrayLike, lon1: ArrayLike, lat2: ArrayLike, lon2: ArrayLike, ell: Ellipsoid = None, deg: bool = True
+) -> typing.Tuple[ArrayLike, ArrayLike]:
"""
computes the arc length and azimuth of the loxodrome
between two points on the surface of the reference ellipsoid
@@ -79,13 +81,13 @@ def loxodrome_inverse(
Parameters
----------
- lat1 : "ndarray"
+ lat1 : ArrayLike
geodetic latitude of first point
- lon1 : "ndarray"
+ lon1 : ArrayLike
geodetic longitude of first point
- lat2 : "ndarray"
+ lat2 : ArrayLike
geodetic latitude of second point
- lon2 : "ndarray"
+ lon2 : ArrayLike
geodetic longitude of second point
ell : Ellipsoid, optional
reference ellipsoid (default WGS84)
@@ -95,9 +97,9 @@ def loxodrome_inverse(
Results
-------
- lox_s : "ndarray"
+ lox_s : ArrayLike
distance along loxodrome
- az12 : "ndarray"
+ az12 : ArrayLike
azimuth of loxodrome (degrees/radians)
Based on Deakin, R.E., 2010, 'The Loxodrome on an Ellipsoid', Lecture Notes,
@@ -149,8 +151,8 @@ def loxodrome_inverse_point(
def loxodrome_direct(
- lat1: "ndarray", lon1: "ndarray", rng: "ndarray", a12: "ndarray", ell: Ellipsoid = None, deg: bool = True
-) -> typing.Tuple["ndarray", "ndarray"]:
+ lat1: ArrayLike, lon1: ArrayLike, rng: ArrayLike, a12: ArrayLike, ell: Ellipsoid = None, deg: bool = True
+) -> typing.Tuple[ArrayLike, ArrayLike]:
"""
Given starting lat, lon with arclength and azimuth, compute final lat, lon
@@ -158,13 +160,13 @@ def loxodrome_direct(
Parameters
----------
- lat1 : "ndarray"
+ lat1 : ArrayLike
inital geodetic latitude (degrees)
- lon1 : "ndarray"
+ lon1 : ArrayLike
initial geodetic longitude (degrees)
- rng : "ndarray"
+ rng : ArrayLike
ground distance (meters)
- a12 : "ndarray"
+ a12 : ArrayLike
azimuth (degrees) clockwide from north.
ell : Ellipsoid, optional
reference ellipsoid
@@ -173,9 +175,9 @@ def loxodrome_direct(
Results
-------
- lat2 : "ndarray"
+ lat2 : ArrayLike
final geodetic latitude (degrees)
- lon2 : "ndarray"
+ lon2 : ArrayLike
final geodetic longitude (degrees)
"""
if vectorize is not None:
@@ -218,7 +220,7 @@ def loxodrome_direct_point(
return lat2, lon2
-def departure(lon1: "ndarray", lon2: "ndarray", lat: "ndarray", ell: Ellipsoid = None, deg: bool = True) -> "ndarray":
+def departure(lon1: ArrayLike, lon2: ArrayLike, lat: ArrayLike, ell: Ellipsoid = None, deg: bool = True) -> ArrayLike:
"""
Computes the distance along a specific parallel between two meridians.
@@ -226,9 +228,9 @@ def departure(lon1: "ndarray", lon2: "ndarray", lat: "ndarray", ell: Ellipsoid =
Parameters
----------
- lon1, lon2 : "ndarray"
+ lon1, lon2 : ArrayLike
geodetic longitudes (degrees)
- lat : "ndarray"
+ lat : ArrayLike
geodetic latitude (degrees)
ell : Ellipsoid, optional
reference ellipsoid
@@ -237,7 +239,7 @@ def departure(lon1: "ndarray", lon2: "ndarray", lat: "ndarray", ell: Ellipsoid =
Returns
-------
- dist: "ndarray"
+ dist: ArrayLike
ground distance (meters)
"""
if deg:
@@ -246,7 +248,7 @@ def departure(lon1: "ndarray", lon2: "ndarray", lat: "ndarray", ell: Ellipsoid =
return rcurve_parallel(lat, ell, deg=False) * ((lon2 - lon1) % pi)
-def meanm(lat: "ndarray", lon: "ndarray", ell: Ellipsoid = None, deg: bool = True) -> typing.Tuple[float, float]:
+def meanm(lat: ArrayLike, lon: ArrayLike, ell: Ellipsoid = None, deg: bool = True) -> typing.Tuple[float, float]:
"""
Computes geographic mean for geographic points on an ellipsoid
=====================================
src/pymap3d/ned.py
=====================================
@@ -6,35 +6,37 @@ from .enu import geodetic2enu, aer2enu, enu2aer
from .ecef import ecef2geodetic, ecef2enuv, ecef2enu, enu2ecef
from .ellipsoid import Ellipsoid
-if typing.TYPE_CHECKING:
- from numpy import ndarray
+try:
+ from numpy.typing import ArrayLike
+except ImportError:
+ ArrayLike = typing.Any
def aer2ned(
- az: "ndarray", elev: "ndarray", slantRange: "ndarray", deg: bool = True
-) -> typing.Tuple["ndarray", "ndarray", "ndarray"]:
+ az: ArrayLike, elev: ArrayLike, slantRange: ArrayLike, deg: bool = True
+) -> typing.Tuple[ArrayLike, ArrayLike, ArrayLike]:
"""
converts azimuth, elevation, range to target from observer to North, East, Down
Parameters
-----------
- az : "ndarray"
+ az : ArrayLike
azimuth
- elev : "ndarray"
+ elev : ArrayLike
elevation
- slantRange : "ndarray"
+ slantRange : ArrayLike
slant range [meters]
deg : bool, optional
degrees input/output (False: radians in/out)
Results
-------
- n : "ndarray"
+ n : ArrayLike
North NED coordinate (meters)
- e : "ndarray"
+ e : ArrayLike
East NED coordinate (meters)
- d : "ndarray"
+ d : ArrayLike
Down NED coordinate (meters)
"""
e, n, u = aer2enu(az, elev, slantRange, deg=deg)
@@ -42,18 +44,18 @@ def aer2ned(
return n, e, -u
-def ned2aer(n: "ndarray", e: "ndarray", d: "ndarray", deg: bool = True) -> typing.Tuple["ndarray", "ndarray", "ndarray"]:
+def ned2aer(n: ArrayLike, e: ArrayLike, d: ArrayLike, deg: bool = True) -> typing.Tuple[ArrayLike, ArrayLike, ArrayLike]:
"""
converts North, East, Down to azimuth, elevation, range
Parameters
----------
- n : "ndarray"
+ n : ArrayLike
North NED coordinate (meters)
- e : "ndarray"
+ e : ArrayLike
East NED coordinate (meters)
- d : "ndarray"
+ d : ArrayLike
Down NED coordinate (meters)
deg : bool, optional
degrees input/output (False: radians in/out)
@@ -61,43 +63,43 @@ def ned2aer(n: "ndarray", e: "ndarray", d: "ndarray", deg: bool = True) -> typin
Results
-------
- az : "ndarray"
+ az : ArrayLike
azimuth
- elev : "ndarray"
+ elev : ArrayLike
elevation
- slantRange : "ndarray"
+ slantRange : ArrayLike
slant range [meters]
"""
return enu2aer(e, n, -d, deg=deg)
def ned2geodetic(
- n: "ndarray",
- e: "ndarray",
- d: "ndarray",
- lat0: "ndarray",
- lon0: "ndarray",
- h0: "ndarray",
+ n: ArrayLike,
+ e: ArrayLike,
+ d: ArrayLike,
+ lat0: ArrayLike,
+ lon0: ArrayLike,
+ h0: ArrayLike,
ell: Ellipsoid = None,
deg: bool = True,
-) -> typing.Tuple["ndarray", "ndarray", "ndarray"]:
+) -> typing.Tuple[ArrayLike, ArrayLike, ArrayLike]:
"""
Converts North, East, Down to target latitude, longitude, altitude
Parameters
----------
- n : "ndarray"
+ n : ArrayLike
North NED coordinate (meters)
- e : "ndarray"
+ e : ArrayLike
East NED coordinate (meters)
- d : "ndarray"
+ d : ArrayLike
Down NED coordinate (meters)
- lat0 : "ndarray"
+ lat0 : ArrayLike
Observer geodetic latitude
- lon0 : "ndarray"
+ lon0 : ArrayLike
Observer geodetic longitude
- h0 : "ndarray"
+ h0 : ArrayLike
observer altitude above geodetic ellipsoid (meters)
ell : Ellipsoid, optional
reference ellipsoid
@@ -107,11 +109,11 @@ def ned2geodetic(
Results
-------
- lat : "ndarray"
+ lat : ArrayLike
target geodetic latitude
- lon : "ndarray"
+ lon : ArrayLike
target geodetic longitude
- h : "ndarray"
+ h : ArrayLike
target altitude above geodetic ellipsoid (meters)
"""
@@ -121,32 +123,32 @@ def ned2geodetic(
def ned2ecef(
- n: "ndarray",
- e: "ndarray",
- d: "ndarray",
- lat0: "ndarray",
- lon0: "ndarray",
- h0: "ndarray",
+ n: ArrayLike,
+ e: ArrayLike,
+ d: ArrayLike,
+ lat0: ArrayLike,
+ lon0: ArrayLike,
+ h0: ArrayLike,
ell: Ellipsoid = None,
deg: bool = True,
-) -> typing.Tuple["ndarray", "ndarray", "ndarray"]:
+) -> typing.Tuple[ArrayLike, ArrayLike, ArrayLike]:
"""
North, East, Down to target ECEF coordinates
Parameters
----------
- n : "ndarray"
+ n : ArrayLike
North NED coordinate (meters)
- e : "ndarray"
+ e : ArrayLike
East NED coordinate (meters)
- d : "ndarray"
+ d : ArrayLike
Down NED coordinate (meters)
- lat0 : "ndarray"
+ lat0 : ArrayLike
Observer geodetic latitude
- lon0 : "ndarray"
+ lon0 : ArrayLike
Observer geodetic longitude
- h0 : "ndarray"
+ h0 : ArrayLike
observer altitude above geodetic ellipsoid (meters)
ell : Ellipsoid, optional
reference ellipsoid
@@ -156,43 +158,43 @@ def ned2ecef(
Results
-------
- x : "ndarray"
+ x : ArrayLike
ECEF x coordinate (meters)
- y : "ndarray"
+ y : ArrayLike
ECEF y coordinate (meters)
- z : "ndarray"
+ z : ArrayLike
ECEF z coordinate (meters)
"""
return enu2ecef(e, n, -d, lat0, lon0, h0, ell, deg=deg)
def ecef2ned(
- x: "ndarray",
- y: "ndarray",
- z: "ndarray",
- lat0: "ndarray",
- lon0: "ndarray",
- h0: "ndarray",
+ x: ArrayLike,
+ y: ArrayLike,
+ z: ArrayLike,
+ lat0: ArrayLike,
+ lon0: ArrayLike,
+ h0: ArrayLike,
ell: Ellipsoid = None,
deg: bool = True,
-) -> typing.Tuple["ndarray", "ndarray", "ndarray"]:
+) -> typing.Tuple[ArrayLike, ArrayLike, ArrayLike]:
"""
Convert ECEF x,y,z to North, East, Down
Parameters
----------
- x : "ndarray"
+ x : ArrayLike
ECEF x coordinate (meters)
- y : "ndarray"
+ y : ArrayLike
ECEF y coordinate (meters)
- z : "ndarray"
+ z : ArrayLike
ECEF z coordinate (meters)
- lat0 : "ndarray"
+ lat0 : ArrayLike
Observer geodetic latitude
- lon0 : "ndarray"
+ lon0 : ArrayLike
Observer geodetic longitude
- h0 : "ndarray"
+ h0 : ArrayLike
observer altitude above geodetic ellipsoid (meters)
ell : Ellipsoid, optional
reference ellipsoid
@@ -202,11 +204,11 @@ def ecef2ned(
Results
-------
- n : "ndarray"
+ n : ArrayLike
North NED coordinate (meters)
- e : "ndarray"
+ e : ArrayLike
East NED coordinate (meters)
- d : "ndarray"
+ d : ArrayLike
Down NED coordinate (meters)
"""
@@ -216,32 +218,32 @@ def ecef2ned(
def geodetic2ned(
- lat: "ndarray",
- lon: "ndarray",
- h: "ndarray",
- lat0: "ndarray",
- lon0: "ndarray",
- h0: "ndarray",
+ lat: ArrayLike,
+ lon: ArrayLike,
+ h: ArrayLike,
+ lat0: ArrayLike,
+ lon0: ArrayLike,
+ h0: ArrayLike,
ell: Ellipsoid = None,
deg: bool = True,
-) -> typing.Tuple["ndarray", "ndarray", "ndarray"]:
+) -> typing.Tuple[ArrayLike, ArrayLike, ArrayLike]:
"""
convert latitude, longitude, altitude of target to North, East, Down from observer
Parameters
----------
- lat : "ndarray"
+ lat : ArrayLike
target geodetic latitude
- lon : "ndarray"
+ lon : ArrayLike
target geodetic longitude
- h : "ndarray"
+ h : ArrayLike
target altitude above geodetic ellipsoid (meters)
- lat0 : "ndarray"
+ lat0 : ArrayLike
Observer geodetic latitude
- lon0 : "ndarray"
+ lon0 : ArrayLike
Observer geodetic longitude
- h0 : "ndarray"
+ h0 : ArrayLike
observer altitude above geodetic ellipsoid (meters)
ell : Ellipsoid, optional
reference ellipsoid
@@ -252,11 +254,11 @@ def geodetic2ned(
Results
-------
- n : "ndarray"
+ n : ArrayLike
North NED coordinate (meters)
- e : "ndarray"
+ e : ArrayLike
East NED coordinate (meters)
- d : "ndarray"
+ d : ArrayLike
Down NED coordinate (meters)
"""
e, n, u = geodetic2enu(lat, lon, h, lat0, lon0, h0, ell, deg=deg)
@@ -265,22 +267,22 @@ def geodetic2ned(
def ecef2nedv(
- x: "ndarray", y: "ndarray", z: "ndarray", lat0: "ndarray", lon0: "ndarray", deg: bool = True
-) -> typing.Tuple["ndarray", "ndarray", "ndarray"]:
+ x: ArrayLike, y: ArrayLike, z: ArrayLike, lat0: ArrayLike, lon0: ArrayLike, deg: bool = True
+) -> typing.Tuple[ArrayLike, ArrayLike, ArrayLike]:
"""
for VECTOR between two points
Parameters
----------
- x : "ndarray"
+ x : ArrayLike
ECEF x coordinate (meters)
- y : "ndarray"
+ y : ArrayLike
ECEF y coordinate (meters)
- z : "ndarray"
+ z : ArrayLike
ECEF z coordinate (meters)
- lat0 : "ndarray"
+ lat0 : ArrayLike
Observer geodetic latitude
- lon0 : "ndarray"
+ lon0 : ArrayLike
Observer geodetic longitude
deg : bool, optional
degrees input/output (False: radians in/out)
@@ -290,11 +292,11 @@ def ecef2nedv(
(Vector)
- n : "ndarray"
+ n : ArrayLike
North NED coordinate (meters)
- e : "ndarray"
+ e : ArrayLike
East NED coordinate (meters)
- d : "ndarray"
+ d : ArrayLike
Down NED coordinate (meters)
"""
e, n, u = ecef2enuv(x, y, z, lat0, lon0, deg=deg)
=====================================
src/pymap3d/rcurve.py
=====================================
@@ -10,13 +10,15 @@ except ImportError:
from .ellipsoid import Ellipsoid
from .utils import sanitize
-__all__ = ["rcurve_parallel", "rcurve_meridian", "rcurve_transverse", "geocentric_radius"]
+try:
+ from numpy.typing import ArrayLike
+except ImportError:
+ ArrayLike = typing.Any
-if typing.TYPE_CHECKING:
- from numpy import ndarray
+__all__ = ["rcurve_parallel", "rcurve_meridian", "rcurve_transverse", "geocentric_radius"]
-def geocentric_radius(geodetic_lat: "ndarray", ell: Ellipsoid = None, deg: bool = True) -> "ndarray":
+def geocentric_radius(geodetic_lat: ArrayLike, ell: Ellipsoid = None, deg: bool = True) -> ArrayLike:
"""
compute geocentric radius at geodetic latitude
@@ -30,13 +32,13 @@ def geocentric_radius(geodetic_lat: "ndarray", ell: Ellipsoid = None, deg: bool
)
-def rcurve_parallel(lat: "ndarray", ell: Ellipsoid = None, deg: bool = True) -> "ndarray":
+def rcurve_parallel(lat: ArrayLike, ell: Ellipsoid = None, deg: bool = True) -> ArrayLike:
"""
computes the radius of the small circle encompassing the globe at the specified latitude
Parameters
----------
- lat : "ndarray"
+ lat : ArrayLike
geodetic latitude (degrees)
ell : Ellipsoid, optional
reference ellipsoid
@@ -45,7 +47,7 @@ def rcurve_parallel(lat: "ndarray", ell: Ellipsoid = None, deg: bool = True) ->
Returns
-------
- radius: "ndarray"
+ radius: ArrayLike
radius of ellipsoid
"""
@@ -55,14 +57,14 @@ def rcurve_parallel(lat: "ndarray", ell: Ellipsoid = None, deg: bool = True) ->
return cos(lat) * rcurve_transverse(lat, ell, deg=False)
-def rcurve_meridian(lat: "ndarray", ell: Ellipsoid = None, deg: bool = True) -> "ndarray":
+def rcurve_meridian(lat: ArrayLike, ell: Ellipsoid = None, deg: bool = True) -> ArrayLike:
"""computes the meridional radius of curvature for the ellipsoid
like Matlab rcurve('meridian', ...)
Parameters
----------
- lat : "ndarray"
+ lat : ArrayLike
geodetic latitude (degrees)
ell : Ellipsoid, optional
reference ellipsoid
@@ -71,7 +73,7 @@ def rcurve_meridian(lat: "ndarray", ell: Ellipsoid = None, deg: bool = True) ->
Returns
-------
- radius: "ndarray"
+ radius: ArrayLike
radius of ellipsoid
"""
@@ -85,7 +87,7 @@ def rcurve_meridian(lat: "ndarray", ell: Ellipsoid = None, deg: bool = True) ->
return f1 / sqrt(f2 ** 3)
-def rcurve_transverse(lat: "ndarray", ell: Ellipsoid = None, deg: bool = True) -> "ndarray":
+def rcurve_transverse(lat: ArrayLike, ell: Ellipsoid = None, deg: bool = True) -> ArrayLike:
"""computes the radius of the curve formed by a plane
intersecting the ellipsoid at the latitude which is
normal to the surface of the ellipsoid
@@ -94,7 +96,7 @@ def rcurve_transverse(lat: "ndarray", ell: Ellipsoid = None, deg: bool = True) -
Parameters
----------
- lat : "ndarray"
+ lat : ArrayLike
latitude (degrees)
ell : Ellipsoid, optional
reference ellipsoid
@@ -103,7 +105,7 @@ def rcurve_transverse(lat: "ndarray", ell: Ellipsoid = None, deg: bool = True) -
Returns
-------
- radius: "ndarray"
+ radius: ArrayLike
radius of ellipsoid
"""
=====================================
src/pymap3d/rsphere.py
=====================================
@@ -13,6 +13,11 @@ from .ellipsoid import Ellipsoid
from .rcurve import rcurve_meridian, rcurve_transverse
from .vincenty import vdist
+try:
+ from numpy.typing import ArrayLike
+except ImportError:
+ ArrayLike = typing.Any
+
__all__ = [
"rsphere_eqavol",
"rsphere_authalic",
@@ -23,9 +28,6 @@ __all__ = [
"rsphere_biaxial",
]
-if typing.TYPE_CHECKING:
- from numpy import ndarray
-
def rsphere_eqavol(ell: Ellipsoid = None) -> float:
"""computes the radius of the sphere with equal volume as the ellipsoid
@@ -94,16 +96,16 @@ def rsphere_rectifying(ell: Ellipsoid = None) -> float:
def rsphere_euler(
- lat1: "ndarray", lon1: "ndarray", lat2: "ndarray", lon2: "ndarray", ell: Ellipsoid = None, deg: bool = True
-) -> "ndarray":
+ lat1: ArrayLike, lon1: ArrayLike, lat2: ArrayLike, lon2: ArrayLike, ell: Ellipsoid = None, deg: bool = True
+) -> ArrayLike:
"""computes the Euler radii of curvature at the midpoint of the
great circle arc defined by the endpoints (lat1,lon1) and (lat2,lon2)
Parameters
----------
- lat1, lat2 : "ndarray"
+ lat1, lat2 : ArrayLike
geodetic latitudes (degrees)
- lon1, lon2 : "ndarray"
+ lon1, lon2 : ArrayLike
geodetic longitudes (degrees)
ell : Ellipsoid, optional
reference ellipsoid
@@ -112,7 +114,7 @@ def rsphere_euler(
Returns
-------
- radius: "ndarray"
+ radius: ArrayLike
radius of sphere
"""
if not deg:
@@ -136,13 +138,13 @@ def rsphere_euler(
return rho * nu / den
-def rsphere_curve(lat: "ndarray", ell: Ellipsoid = None, deg: bool = True, method: str = "mean") -> "ndarray":
+def rsphere_curve(lat: ArrayLike, ell: Ellipsoid = None, deg: bool = True, method: str = "mean") -> ArrayLike:
"""computes the arithmetic average of the transverse and meridional
radii of curvature at a specified latitude point
Parameters
----------
- lat1 : "ndarray"
+ lat1 : ArrayLike
geodetic latitudes (degrees)
ell : Ellipsoid, optional
reference ellipsoid
@@ -153,7 +155,7 @@ def rsphere_curve(lat: "ndarray", ell: Ellipsoid = None, deg: bool = True, metho
Returns
-------
- radius: "ndarray"
+ radius: ArrayLike
radius of sphere
"""
=====================================
src/pymap3d/utils.py
=====================================
@@ -11,13 +11,15 @@ except ImportError:
asarray = None
-__all__ = ["cart2pol", "pol2cart", "cart2sph", "sph2cart", "sign"]
+try:
+ from numpy.typing import ArrayLike
+except ImportError:
+ ArrayLike = typing.Any
-if typing.TYPE_CHECKING:
- from numpy import ndarray
+__all__ = ["cart2pol", "pol2cart", "cart2sph", "sph2cart", "sign"]
-def sign(x: "ndarray") -> "ndarray":
+def sign(x: ArrayLike) -> ArrayLike:
""" signum function """
if x < 0:
y = -1.0
@@ -29,17 +31,17 @@ def sign(x: "ndarray") -> "ndarray":
return y
-def cart2pol(x: "ndarray", y: "ndarray") -> typing.Tuple["ndarray", "ndarray"]:
+def cart2pol(x: ArrayLike, y: ArrayLike) -> typing.Tuple[ArrayLike, ArrayLike]:
"""Transform Cartesian to polar coordinates"""
return atan2(y, x), hypot(x, y)
-def pol2cart(theta: "ndarray", rho: "ndarray") -> typing.Tuple["ndarray", "ndarray"]:
+def pol2cart(theta: ArrayLike, rho: ArrayLike) -> typing.Tuple[ArrayLike, ArrayLike]:
"""Transform polar to Cartesian coordinates"""
return rho * cos(theta), rho * sin(theta)
-def cart2sph(x: "ndarray", y: "ndarray", z: "ndarray") -> typing.Tuple["ndarray", "ndarray", "ndarray"]:
+def cart2sph(x: ArrayLike, y: ArrayLike, z: ArrayLike) -> typing.Tuple[ArrayLike, ArrayLike, ArrayLike]:
"""Transform Cartesian to spherical coordinates"""
hxy = hypot(x, y)
r = hypot(hxy, z)
@@ -48,7 +50,7 @@ def cart2sph(x: "ndarray", y: "ndarray", z: "ndarray") -> typing.Tuple["ndarray"
return az, el, r
-def sph2cart(az: "ndarray", el: "ndarray", r: "ndarray") -> typing.Tuple["ndarray", "ndarray", "ndarray"]:
+def sph2cart(az: ArrayLike, el: ArrayLike, r: ArrayLike) -> typing.Tuple[ArrayLike, ArrayLike, ArrayLike]:
"""Transform spherical to Cartesian coordinates"""
rcos_theta = r * cos(el)
x = rcos_theta * cos(az)
@@ -57,7 +59,7 @@ def sph2cart(az: "ndarray", el: "ndarray", r: "ndarray") -> typing.Tuple["ndarra
return x, y, z
-def sanitize(lat: "ndarray", ell: Ellipsoid, deg: bool) -> typing.Tuple["ndarray", Ellipsoid]:
+def sanitize(lat: ArrayLike, ell: Ellipsoid, deg: bool) -> typing.Tuple[ArrayLike, Ellipsoid]:
if ell is None:
ell = Ellipsoid()
if asarray is not None:
=====================================
src/pymap3d/vallado.py
=====================================
@@ -16,28 +16,30 @@ except ImportError:
from .sidereal import datetime2sidereal
-__all__ = ["azel2radec", "radec2azel"]
+try:
+ from numpy.typing import ArrayLike
+except ImportError:
+ ArrayLike = typing.Any
-if typing.TYPE_CHECKING:
- from numpy import ndarray
+__all__ = ["azel2radec", "radec2azel"]
def azel2radec(
- az_deg: "ndarray", el_deg: "ndarray", lat_deg: "ndarray", lon_deg: "ndarray", time: datetime, *, use_astropy: bool = True
-) -> typing.Tuple["ndarray", "ndarray"]:
+ az_deg: ArrayLike, el_deg: ArrayLike, lat_deg: ArrayLike, lon_deg: ArrayLike, time: datetime, *, use_astropy: bool = True
+) -> typing.Tuple[ArrayLike, ArrayLike]:
"""
converts azimuth, elevation to right ascension, declination
Parameters
----------
- az_deg : "ndarray"
+ az_deg : ArrayLike
azimuth (clockwise) to point [degrees]
- el_deg : "ndarray"
+ el_deg : ArrayLike
elevation above horizon to point [degrees]
- lat_deg : "ndarray"
+ lat_deg : ArrayLike
observer WGS84 latitude [degrees]
- lon_deg : "ndarray"
+ lon_deg : ArrayLike
observer WGS84 longitude [degrees]
time : datetime.datetime
time of observation
@@ -47,9 +49,9 @@ def azel2radec(
Results
-------
- ra_deg : "ndarray"
+ ra_deg : ArrayLike
right ascension to target [degrees]
- dec_deg : "ndarray"
+ dec_deg : ArrayLike
declination of target [degrees]
from D.Vallado Fundamentals of Astrodynamics and Applications
@@ -75,21 +77,21 @@ def azel2radec(
def radec2azel(
- ra_deg: "ndarray", dec_deg: "ndarray", lat_deg: "ndarray", lon_deg: "ndarray", time: datetime, *, use_astropy: bool = True
-) -> typing.Tuple["ndarray", "ndarray"]:
+ ra_deg: ArrayLike, dec_deg: ArrayLike, lat_deg: ArrayLike, lon_deg: ArrayLike, time: datetime, *, use_astropy: bool = True
+) -> typing.Tuple[ArrayLike, ArrayLike]:
"""
converts right ascension, declination to azimuth, elevation
Parameters
----------
- ra_deg : "ndarray"
+ ra_deg : ArrayLike
right ascension to target [degrees]
- dec_deg : "ndarray"
+ dec_deg : ArrayLike
declination to target [degrees]
- lat_deg : "ndarray"
+ lat_deg : ArrayLike
observer WGS84 latitude [degrees]
- lon_deg : "ndarray"
+ lon_deg : ArrayLike
observer WGS84 longitude [degrees]
time : datetime.datetime
time of observation
@@ -99,9 +101,9 @@ def radec2azel(
Results
-------
- az_deg : "ndarray"
+ az_deg : ArrayLike
azimuth clockwise from north to point [degrees]
- el_deg : "ndarray"
+ el_deg : ArrayLike
elevation above horizon to point [degrees]
=====================================
src/pymap3d/vincenty.py
=====================================
@@ -15,15 +15,17 @@ except ImportError:
from .ellipsoid import Ellipsoid
from .utils import sign
-__all__ = ["vdist", "vreckon", "track2"]
+try:
+ from numpy.typing import ArrayLike
+except ImportError:
+ ArrayLike = typing.Any
-if typing.TYPE_CHECKING:
- from numpy import ndarray
+__all__ = ["vdist", "vreckon", "track2"]
def vdist(
- Lat1: "ndarray", Lon1: "ndarray", Lat2: "ndarray", Lon2: "ndarray", ell: Ellipsoid = None
-) -> typing.Tuple["ndarray", "ndarray"]:
+ Lat1: ArrayLike, Lon1: ArrayLike, Lat2: ArrayLike, Lon2: ArrayLike, ell: Ellipsoid = None
+) -> typing.Tuple[ArrayLike, ArrayLike]:
"""
Using the reference ellipsoid, compute the distance between two points
within a few millimeters of accuracy, compute forward azimuth,
@@ -37,13 +39,13 @@ def vdist(
Parameters
----------
- Lat1 : "ndarray"
+ Lat1 : ArrayLike
Geodetic latitude of first point (degrees)
- Lon1 : "ndarray"
+ Lon1 : ArrayLike
Geodetic longitude of first point (degrees)
- Lat2 : "ndarray"
+ Lat2 : ArrayLike
Geodetic latitude of second point (degrees)
- Lon2 : "ndarray"
+ Lon2 : ArrayLike
Geodetic longitude of second point (degrees)
ell : Ellipsoid, optional
reference ellipsoid
@@ -51,9 +53,9 @@ def vdist(
Results
-------
- dist_m : "ndarray"
+ dist_m : ArrayLike
distance (meters)
- az : "ndarray"
+ az : ArrayLike
azimuth (degrees) clockwise from first point to second point (forward)
@@ -220,8 +222,8 @@ def vdist_point(Lat1: float, Lon1: float, Lat2: float, Lon2: float, ell: Ellipso
def vreckon(
- Lat1: "ndarray", Lon1: "ndarray", Rng: "ndarray", Azim: "ndarray", ell: Ellipsoid = None
-) -> typing.Tuple["ndarray", "ndarray"]:
+ Lat1: ArrayLike, Lon1: ArrayLike, Rng: ArrayLike, Azim: ArrayLike, ell: Ellipsoid = None
+) -> typing.Tuple[ArrayLike, ArrayLike]:
"""
This is the Vincenty "forward" solution.
@@ -236,13 +238,13 @@ def vreckon(
Parameters
----------
- Lat1 : "ndarray"
+ Lat1 : ArrayLike
inital geodetic latitude (degrees)
- Lon1 : "ndarray"
+ Lon1 : ArrayLike
initial geodetic longitude (degrees)
- Rng : "ndarray"
+ Rng : ArrayLike
ground distance (meters)
- Azim : "ndarray"
+ Azim : ArrayLike
intial azimuth (degrees) clockwide from north.
ell : Ellipsoid, optional
reference ellipsoid
@@ -250,9 +252,9 @@ def vreckon(
Results
-------
- Lat2 : "ndarray"
+ Lat2 : ArrayLike
final geodetic latitude (degrees)
- Lon2 : "ndarray"
+ Lon2 : ArrayLike
final geodetic longitude (degrees)
@@ -368,7 +370,7 @@ def vreckon_point(Lat1: float, Lon1: float, Rng: float, Azim: float, ell: Ellips
def track2(
- lat1: "ndarray", lon1: "ndarray", lat2: "ndarray", lon2: "ndarray", ell: Ellipsoid = None, npts: int = 100, deg: bool = True
+ lat1: ArrayLike, lon1: ArrayLike, lat2: ArrayLike, lon2: ArrayLike, ell: Ellipsoid = None, npts: int = 100, deg: bool = True
) -> typing.Tuple[typing.List[float], typing.List[float]]:
"""
computes great circle tracks starting at the point lat1, lon1 and ending at lat2, lon2
@@ -376,13 +378,13 @@ def track2(
Parameters
----------
- Lat1 : "ndarray"
+ Lat1 : ArrayLike
Geodetic latitude of first point (degrees)
- Lon1 : "ndarray"
+ Lon1 : ArrayLike
Geodetic longitude of first point (degrees)
- Lat2 : "ndarray"
+ Lat2 : ArrayLike
Geodetic latitude of second point (degrees)
- Lon2 : "ndarray"
+ Lon2 : ArrayLike
Geodetic longitude of second point (degrees)
ell : Ellipsoid, optional
reference ellipsoid
View it on GitLab: https://salsa.debian.org/debian-gis-team/pymap3d/-/compare/8989c79d2a613246d8f5f690b8c7bd9aefc6dfa5...63f7ea567fabc5c2255123aeab92224fadb5564f
--
View it on GitLab: https://salsa.debian.org/debian-gis-team/pymap3d/-/compare/8989c79d2a613246d8f5f690b8c7bd9aefc6dfa5...63f7ea567fabc5c2255123aeab92224fadb5564f
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-grass-devel/attachments/20200924/824e74de/attachment-0001.html>
More information about the Pkg-grass-devel
mailing list