[Git][debian-gis-team/pymap3d][master] 5 commits: Update d/watch file
Antonio Valentino (@antonio.valentino)
gitlab at salsa.debian.org
Sun Apr 10 11:46:05 BST 2022
Antonio Valentino pushed to branch master at Debian GIS Project / pymap3d
Commits:
04681d06 by Antonio Valentino at 2022-04-10T10:39:20+00:00
Update d/watch file
- - - - -
847a41ca by Antonio Valentino at 2022-04-10T10:40:06+00:00
New upstream version 2.8.0
- - - - -
baacd969 by Antonio Valentino at 2022-04-10T10:40:07+00:00
Update upstream source from tag 'upstream/2.8.0'
Update to upstream version '2.8.0'
with Debian dir 180f89ca7b6fe7f43d8c8bd8f9a3a3c4e3c2ae35
- - - - -
3d5d0ef0 by Antonio Valentino at 2022-04-10T10:40:53+00:00
New upstream version
- - - - -
c52770f3 by Antonio Valentino at 2022-04-10T10:42:45+00:00
Set distribution to unstable
- - - - -
25 changed files:
- .github/workflows/ci.yml
- .github/workflows/ci_stdlib_only.yml
- Examples/angle_distance.py
- Examples/azel2radec.py
- Examples/radec2azel.py
- README.md
- debian/changelog
- debian/copyright
- debian/watch
- pyproject.toml
- setup.cfg
- src/pymap3d/__init__.py
- src/pymap3d/aer.py
- src/pymap3d/ecef.py
- src/pymap3d/eci.py
- src/pymap3d/enu.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/tests/test_rcurve.py
- src/pymap3d/utils.py
- src/pymap3d/vincenty.py
Changes:
=====================================
.github/workflows/ci.yml
=====================================
@@ -12,12 +12,19 @@ on:
jobs:
full:
- runs-on: ubuntu-latest
+ runs-on: ${{ matrix.os }}
+
+ name: ${{ matrix.os }} Python ${{ matrix.python-version }}
+ strategy:
+ matrix:
+ python-version: [ '3.7', '3.8', '3.9', '3.10' ]
+ os: [ 'ubuntu-latest', 'windows-latest', 'macos-latest']
+
steps:
- uses: actions/checkout at v2
- uses: actions/setup-python at v2
with:
- python-version: 3.9
+ python-version: ${{ matrix.python-version }}
- run: pip install .[full,tests,lint]
=====================================
.github/workflows/ci_stdlib_only.yml
=====================================
@@ -12,12 +12,13 @@ on:
jobs:
stdlib_only:
- runs-on: ubuntu-latest
+ runs-on: ${{ matrix.os }}
- name: Python ${{ matrix.python-version }}
+ name: ${{ matrix.os }} Python ${{ matrix.python-version }}
strategy:
matrix:
- python-version: [ '3.7', '3.10' ]
+ python-version: [ '3.7', '3.8', '3.9', '3.10' ]
+ os: [ 'ubuntu-latest', 'windows-latest', 'macos-latest']
steps:
- uses: actions/checkout at v2
=====================================
Examples/angle_distance.py
=====================================
@@ -4,21 +4,16 @@ from argparse import ArgumentParser
from pytest import approx
-def main():
- p = ArgumentParser(description="angular distance between two sky points")
- p.add_argument("r0", help="right ascension: first point [deg]", type=float)
- p.add_argument("d0", help="declination: first point [deg]", type=float)
- p.add_argument("r1", help="right ascension: 2nd point [deg]", type=float)
- p.add_argument("d1", help="declination: 2nd point [degrees]", type=float)
- a = p.parse_args()
+p = ArgumentParser(description="angular distance between two sky points")
+p.add_argument("r0", help="right ascension: first point [deg]", type=float)
+p.add_argument("d0", help="declination: first point [deg]", type=float)
+p.add_argument("r1", help="right ascension: 2nd point [deg]", type=float)
+p.add_argument("d1", help="declination: 2nd point [degrees]", type=float)
+a = p.parse_args()
- dist_deg = anglesep_meeus(a.r0, a.d0, a.r1, a.d1)
- dist_deg_astropy = anglesep(a.r0, a.d0, a.r1, a.d1)
+dist_deg = anglesep_meeus(a.r0, a.d0, a.r1, a.d1)
+dist_deg_astropy = anglesep(a.r0, a.d0, a.r1, a.d1)
- print(f"{dist_deg:.6f} deg sep")
+print(f"{dist_deg:.6f} deg sep")
- assert dist_deg == approx(dist_deg_astropy)
-
-
-if __name__ == "__main__":
- main()
+assert dist_deg == approx(dist_deg_astropy)
=====================================
Examples/azel2radec.py
=====================================
@@ -8,21 +8,16 @@ from pymap3d import azel2radec
from argparse import ArgumentParser
-def main():
- p = ArgumentParser(
- description="convert azimuth and elevation to " "right ascension and declination"
- )
- p.add_argument("azimuth", help="azimuth [deg]", type=float)
- p.add_argument("elevation", help="elevation [deg]", type=float)
- p.add_argument("lat", help="WGS84 obs. lat [deg]", type=float)
- p.add_argument("lon", help="WGS84 obs. lon [deg]", type=float)
- p.add_argument("time", help="obs. time YYYY-mm-ddTHH:MM:SSZ")
- P = p.parse_args()
+p = ArgumentParser(
+ description="convert azimuth and elevation to " "right ascension and declination"
+)
+p.add_argument("azimuth", help="azimuth [deg]", type=float)
+p.add_argument("elevation", help="elevation [deg]", type=float)
+p.add_argument("lat", help="WGS84 obs. lat [deg]", type=float)
+p.add_argument("lon", help="WGS84 obs. lon [deg]", type=float)
+p.add_argument("time", help="obs. time YYYY-mm-ddTHH:MM:SSZ")
+P = p.parse_args()
- ra, dec = azel2radec(P.azimuth, P.elevation, P.lat, P.lon, P.time)
+ra, dec = azel2radec(P.azimuth, P.elevation, P.lat, P.lon, P.time)
- print("ra [deg] ", ra, " dec [deg] ", dec)
-
-
-if __name__ == "__main__": # pragma: no cover
- main()
+print("ra [deg] ", ra, " dec [deg] ", dec)
=====================================
Examples/radec2azel.py
=====================================
@@ -8,19 +8,14 @@ from pymap3d import radec2azel
from argparse import ArgumentParser
-def main():
- p = ArgumentParser(description="RightAscension,Declination =>" "Azimuth,Elevation")
- p.add_argument("ra", help="right ascension [degrees]", type=float)
- p.add_argument("dec", help="declination [degrees]", type=float)
- p.add_argument("lat", help="WGS84 latitude of observer [degrees]", type=float)
- p.add_argument("lon", help="WGS84 latitude of observer [degrees]", type=float)
- p.add_argument("time", help="UTC time of observation YYYY-mm-ddTHH:MM:SSZ")
- P = p.parse_args()
+p = ArgumentParser(description="RightAscension,Declination =>" "Azimuth,Elevation")
+p.add_argument("ra", help="right ascension [degrees]", type=float)
+p.add_argument("dec", help="declination [degrees]", type=float)
+p.add_argument("lat", help="WGS84 latitude of observer [degrees]", type=float)
+p.add_argument("lon", help="WGS84 latitude of observer [degrees]", type=float)
+p.add_argument("time", help="UTC time of observation YYYY-mm-ddTHH:MM:SSZ")
+P = p.parse_args()
- az_deg, el_deg = radec2azel(P.ra, P.dec, P.lat, P.lon, P.time)
- print("azimuth: [deg]", az_deg)
- print("elevation [deg]:", el_deg)
-
-
-if __name__ == "__main__":
- main()
+az_deg, el_deg = radec2azel(P.ra, P.dec, P.lat, P.lon, P.time)
+print("azimuth: [deg]", az_deg)
+print("elevation [deg]:", el_deg)
=====================================
README.md
=====================================
@@ -85,18 +85,28 @@ Popular mapping toolbox functions ported to Python include the
following, where the source coordinate system (before the "2") is
converted to the desired coordinate system:
- aer2ecef aer2enu aer2geodetic aer2ned
- ecef2aer ecef2enu ecef2enuv ecef2geodetic ecef2ned ecef2nedv
- ecef2eci eci2ecef eci2aer aer2eci geodetic2eci eci2geodetic
- enu2aer enu2ecef enu2geodetic
- geodetic2aer geodetic2ecef geodetic2enu geodetic2ned
- ned2aer ned2ecef ned2geodetic
- azel2radec radec2azel
- vreckon vdist
- lookAtSpheroid
- track2 departure meanm
- rcurve rsphere
- geod2geoc geoc2geod
+```
+aer2ecef aer2enu aer2geodetic aer2ned
+ecef2aer ecef2enu ecef2enuv ecef2geodetic ecef2ned ecef2nedv
+ecef2eci eci2ecef eci2aer aer2eci geodetic2eci eci2geodetic
+enu2aer enu2ecef enu2geodetic
+geodetic2aer geodetic2ecef geodetic2enu geodetic2ned
+ned2aer ned2ecef ned2geodetic
+azel2radec radec2azel
+lookAtSpheroid
+track2 departure meanm
+rcurve rsphere
+geod2geoc geoc2geod
+```
+
+Vincenty functions "vincenty.vreckon" and "vincenty.vdist" are accessed like:
+
+```python
+import pymap3d.vincenty as pmv
+
+lat2, lon2 = pmv.vreckon(lat1, lon1, ground_range_m, azimuth_deg)
+dist_m, azimuth_deg = pmv.vdist(lat1, lon1, lat2, lon2)
+```
Additional functions:
=====================================
debian/changelog
=====================================
@@ -1,3 +1,10 @@
+pymap3d (2.8.0-1) unstable; urgency=medium
+
+ * New upstream version.
+ * Update d/watch file.
+
+ -- Antonio Valentino <antonio.valentino at tiscali.it> Sun, 10 Apr 2022 10:42:16 +0000
+
pymap3d (2.7.3-1) unstable; urgency=medium
* New upstream release.
=====================================
debian/copyright
=====================================
@@ -10,7 +10,7 @@ Copyright: 2014-2018, Michael Hirsch, Ph.D.
License: BSD-2-Clause
Files: debian/*
-Copyright: 2020-2021, Antonio Valentino <antonio.valentino at tiscali.it>
+Copyright: 2020-2022, Antonio Valentino <antonio.valentino at tiscali.it>
License: BSD-2-Clause
License: BSD-2-Clause
=====================================
debian/watch
=====================================
@@ -2,6 +2,6 @@ version=4
opts=\
dversionmangle=s/\+(debian|dfsg|ds|deb)\.?\d*$//,\
uversionmangle=s/(\d)[_\.\-\+]?((RC|rc|pre|dev|b|beta|a|alpha)\d*)$/$1~$2/;s/RC/rc/;s/\-/\./g,\
-filenamemangle=s/(?:.*?)?(?:rel|v|pymap3d)?[\-\_]?(\d\S*)\.(tgz|tbz|txz|(?:tar\.(?:gz|bz2|xz)))/pymap3d-$1.$2/ \
+filenamemangle=s/(?:.*?)?(?:rel|v|pymap3d)?[\-\_]?(\d\.\d\S*)\.(tgz|tbz|txz|(?:tar\.(?:gz|bz2|xz)))/pymap3d-$1.$2/ \
https://github.com/geospace-code/pymap3d/tags \
-(?:.*?/archive/(?:.*?/)?)?(?:rel|v|pymap3d)?[\-\_]?(\d\S+)\.(?:tgz|tbz|txz|(?:tar\.(?:gz|bz2|xz)))
+(?:.*?/archive/(?:.*?/)?)?(?:rel|v|pymap3d)?[\-\_]?(\d\.\d\S+)\.(?:tgz|tbz|txz|(?:tar\.(?:gz|bz2|xz)))
=====================================
pyproject.toml
=====================================
@@ -1,41 +1,5 @@
-[project]
-name = "pymap3d"
-version = "2.7.2"
-description = "pure Python (no prereqs) coordinate conversions, following convention of several popular Matlab routines."
-readme = "README.md"
-requires-python = ">=3.7"
-license = {file = "LICENSE.txt"}
-keywords = ["geodesy"]
-classifiers = [
- 'Development Status :: 5 - Production/Stable',
- 'Environment :: Console',
- 'Intended Audience :: Science/Research',
- 'Operating System :: OS Independent',
- 'Programming Language :: Python :: 3',
- 'Topic :: Scientific/Engineering :: GIS'
-]
-authors = [{name = "Michael Hirsch"}]
-
-[project.urls]
-homepage = "https://github.com/geospace-code/pymap3d"
-
-[project.optional-dependencies]
-test = [
- "pytest"
-]
-lint = [
- "flake8",
- "flake8-bugbear",
- "flake8-builtins",
- "flake8-blind-except",
- "mypy >= 0.800"
-]
-full = [
- "python-dateutil",
- "numpy >= 1.10.0",
- "astropy",
- "xarray"
-]
+[build-system]
+requires = ["setuptools", "wheel"]
[tool.black]
line-length = 100
=====================================
setup.cfg
=====================================
@@ -1,6 +1,6 @@
[metadata]
name = pymap3d
-version = 2.7.3
+version = attr: src.pymap3d.__version__
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.
=====================================
src/pymap3d/__init__.py
=====================================
@@ -29,6 +29,8 @@ Companion packages exist for:
* Fortran: [Maptran3D](https://github.com/geospace-code/maptran3d)
"""
+__version__ = "2.8.0"
+
from .aer import ecef2aer, aer2ecef, geodetic2aer, aer2geodetic
from .enu import enu2geodetic, geodetic2enu, aer2enu, enu2aer
=====================================
src/pymap3d/aer.py
=====================================
@@ -1,7 +1,6 @@
""" transforms involving AER: azimuth, elevation, slant range"""
from __future__ import annotations
-import typing
from datetime import datetime
from .ecef import ecef2enu, geodetic2ecef, ecef2geodetic, enu2uvw
@@ -13,22 +12,19 @@ try:
except ImportError:
pass
-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,
+ y,
+ z,
+ lat0,
+ lon0,
+ h0,
ell: Ellipsoid = None,
deg: bool = True,
-) -> tuple[ndarray, ndarray, ndarray]:
+) -> tuple:
"""
compute azimuth, elevation and slant range from an Observer to a Point with ECEF coordinates.
@@ -69,15 +65,15 @@ def ecef2aer(
def geodetic2aer(
- lat: ndarray,
- lon: ndarray,
- h: ndarray,
- lat0: ndarray,
- lon0: ndarray,
- h0: ndarray,
+ lat,
+ lon,
+ h,
+ lat0,
+ lon0,
+ h0,
ell: Ellipsoid = None,
deg: bool = True,
-) -> tuple[ndarray, ndarray, ndarray]:
+) -> tuple:
"""
gives azimuth, elevation and slant range from an Observer to a Point with geodetic coordinates.
@@ -117,15 +113,15 @@ def geodetic2aer(
def aer2geodetic(
- az: ndarray,
- el: ndarray,
- srange: ndarray,
- lat0: ndarray,
- lon0: ndarray,
- h0: ndarray,
+ az,
+ el,
+ srange,
+ lat0,
+ lon0,
+ h0,
ell: Ellipsoid = None,
deg: bool = True,
-) -> tuple[ndarray, ndarray, ndarray]:
+) -> tuple:
"""
gives geodetic coordinates of a point with az, el, range
from an observer at lat0, lon0, h0
@@ -167,17 +163,8 @@ def aer2geodetic(
def eci2aer(
- x: ndarray,
- y: ndarray,
- z: ndarray,
- lat0: ndarray,
- lon0: ndarray,
- h0: ndarray,
- t: datetime,
- *,
- deg: bool = True,
- use_astropy: bool = True
-) -> tuple[ndarray, ndarray, ndarray]:
+ x, y, z, lat0, lon0, h0, t: datetime, *, deg: bool = True, use_astropy: bool = True
+) -> tuple:
"""
takes Earth Centered Inertial x,y,z ECI coordinates of point and gives az, el, slant range from Observer
@@ -222,18 +209,18 @@ def eci2aer(
def aer2eci(
- az: ndarray,
- el: ndarray,
- srange: ndarray,
- lat0: ndarray,
- lon0: ndarray,
- h0: ndarray,
+ az,
+ el,
+ srange,
+ lat0,
+ lon0,
+ h0,
t: datetime,
ell=None,
*,
deg: bool = True,
use_astropy: bool = True
-) -> tuple[ndarray, ndarray, ndarray]:
+) -> tuple:
"""
gives ECI of a point from an observer at az, el, slant range
@@ -282,15 +269,15 @@ def aer2eci(
def aer2ecef(
- az: ndarray,
- el: ndarray,
- srange: ndarray,
- lat0: ndarray,
- lon0: ndarray,
- alt0: ndarray,
+ az,
+ el,
+ srange,
+ lat0,
+ lon0,
+ alt0,
ell: Ellipsoid = None,
deg: bool = True,
-) -> tuple[ndarray, ndarray, ndarray]:
+) -> tuple:
"""
converts target azimuth, elevation, range from observer at lat0,lon0,alt0 to ECEF coordinates.
=====================================
src/pymap3d/ecef.py
=====================================
@@ -1,6 +1,5 @@
""" Transforms involving ECEF: earth-centered, earth-fixed frame """
from __future__ import annotations
-import typing
try:
from numpy import (
@@ -26,9 +25,6 @@ from datetime import datetime
from .ellipsoid import Ellipsoid
from .utils import sanitize
-if typing.TYPE_CHECKING:
- from numpy import ndarray
-
__all__ = [
"geodetic2ecef",
@@ -44,23 +40,23 @@ __all__ = [
def geodetic2ecef(
- lat: ndarray,
- lon: ndarray,
- alt: ndarray,
+ lat,
+ lon,
+ alt,
ell: Ellipsoid = None,
deg: bool = True,
-) -> tuple[ndarray, ndarray, ndarray]:
+) -> tuple:
"""
point transformation from Geodetic of specified ellipsoid (default WGS-84) to ECEF
Parameters
----------
- lat : float
+ lat
target geodetic latitude
- lon : float
+ lon
target geodetic longitude
- h : float
+ h
target altitude above geodetic ellipsoid (meters)
ell : Ellipsoid, optional
reference ellipsoid
@@ -73,11 +69,11 @@ def geodetic2ecef(
ECEF (Earth centered, Earth fixed) x,y,z
- x : float
+ x
target x ECEF coordinate (meters)
- y : float
+ y
target y ECEF coordinate (meters)
- z : float
+ z
target z ECEF coordinate (meters)
"""
lat, ell = sanitize(lat, ell, deg)
@@ -97,22 +93,22 @@ def geodetic2ecef(
def ecef2geodetic(
- x: ndarray,
- y: ndarray,
- z: ndarray,
+ x,
+ y,
+ z,
ell: Ellipsoid = None,
deg: bool = True,
-) -> tuple[ndarray, ndarray, ndarray]:
+) -> tuple:
"""
convert ECEF (meters) to geodetic coordinates
Parameters
----------
- x : float
+ x
target x ECEF coordinate (meters)
- y : float
+ y
target y ECEF coordinate (meters)
- z : float
+ z
target z ECEF coordinate (meters)
ell : Ellipsoid, optional
reference ellipsoid
@@ -121,11 +117,11 @@ def ecef2geodetic(
Returns
-------
- lat : float
+ lat
target geodetic latitude
- lon : float
+ lon
target geodetic longitude
- alt : float
+ alt
target altitude above geodetic ellipsoid (meters)
based on:
@@ -211,36 +207,34 @@ def ecef2geodetic(
return lat, lon, alt
-def ecef2enuv(
- u: float, v: float, w: float, lat0: float, lon0: float, deg: bool = True
-) -> tuple[float, float, float]:
+def ecef2enuv(u, v, w, lat0, lon0, deg: bool = True) -> tuple:
"""
VECTOR from observer to target ECEF => ENU
Parameters
----------
- u : float
+ u
target x ECEF coordinate (meters)
- v : float
+ v
target y ECEF coordinate (meters)
- w : float
+ w
target z ECEF coordinate (meters)
- lat0 : float
+ lat0
Observer geodetic latitude
- lon0 : float
+ lon0
Observer geodetic longitude
- h0 : float
+ h0
observer altitude above geodetic ellipsoid (meters)
deg : bool, optional
degrees input/output (False: radians in/out)
Returns
-------
- uEast : float
+ uEast
target east ENU coordinate (meters)
- vNorth : float
+ vNorth
target north ENU coordinate (meters)
- wUp : float
+ wUp
target up ENU coordinate (meters)
"""
@@ -257,31 +251,31 @@ def ecef2enuv(
def ecef2enu(
- x: ndarray,
- y: ndarray,
- z: ndarray,
- lat0: ndarray,
- lon0: ndarray,
- h0: ndarray,
+ x,
+ y,
+ z,
+ lat0,
+ lon0,
+ h0,
ell: Ellipsoid = None,
deg: bool = True,
-) -> tuple[ndarray, ndarray, ndarray]:
+) -> tuple:
"""
from observer to target, ECEF => ENU
Parameters
----------
- x : float
+ x
target x ECEF coordinate (meters)
- y : float
+ y
target y ECEF coordinate (meters)
- z : float
+ z
target z ECEF coordinate (meters)
- lat0 : float
+ lat0
Observer geodetic latitude
- lon0 : float
+ lon0
Observer geodetic longitude
- h0 : float
+ h0
observer altitude above geodetic ellipsoid (meters)
ell : Ellipsoid, optional
reference ellipsoid
@@ -290,11 +284,11 @@ def ecef2enu(
Returns
-------
- East : float
+ East
target east ENU coordinate (meters)
- North : float
+ North
target north ENU coordinate (meters)
- Up : float
+ Up
target up ENU coordinate (meters)
"""
@@ -304,30 +298,30 @@ def ecef2enu(
def enu2uvw(
- east: ndarray,
- north: ndarray,
- up: ndarray,
- lat0: ndarray,
- lon0: ndarray,
+ east,
+ north,
+ up,
+ lat0,
+ lon0,
deg: bool = True,
-) -> tuple[ndarray, ndarray, ndarray]:
+) -> tuple:
"""
Parameters
----------
- e1 : float
+ e1
target east ENU coordinate (meters)
- n1 : float
+ n1
target north ENU coordinate (meters)
- u1 : float
+ u1
target up ENU coordinate (meters)
Results
-------
- u : float
- v : float
- w : float
+ u
+ v
+ w
"""
if deg:
@@ -343,26 +337,24 @@ def enu2uvw(
return u, v, w
-def uvw2enu(
- u: ndarray, v: ndarray, w: ndarray, lat0: ndarray, lon0: ndarray, deg: bool = True
-) -> tuple[ndarray, ndarray, ndarray]:
+def uvw2enu(u, v, w, lat0, lon0, deg: bool = True) -> tuple:
"""
Parameters
----------
- u : float
- v : float
- w : float
+ u
+ v
+ w
Results
-------
- East : float
+ East
target east ENU coordinate (meters)
- North : float
+ North
target north ENU coordinate (meters)
- Up : float
+ Up
target up ENU coordinate (meters)
"""
if deg:
@@ -378,15 +370,8 @@ def uvw2enu(
def eci2geodetic(
- x: ndarray,
- y: ndarray,
- z: ndarray,
- t: datetime,
- ell: Ellipsoid = None,
- *,
- deg: bool = True,
- use_astropy: bool = True
-) -> tuple[ndarray, ndarray, ndarray]:
+ x, y, z, t: datetime, ell: Ellipsoid = None, *, deg: bool = True, use_astropy: bool = True
+) -> tuple:
"""
convert Earth Centered Internal ECI to geodetic coordinates
@@ -394,11 +379,11 @@ def eci2geodetic(
Parameters
----------
- x : float
+ x
ECI x-location [meters]
- y : float
+ y
ECI y-location [meters]
- z : float
+ z
ECI z-location [meters]
t : datetime.datetime, float
UTC time
@@ -411,11 +396,11 @@ def eci2geodetic(
Results
-------
- lat : float
+ lat
geodetic latitude
- lon : float
+ lon
geodetic longitude
- alt : float
+ alt
altitude above ellipsoid (meters)
eci2geodetic() a.k.a. eci2lla()
@@ -430,15 +415,8 @@ def eci2geodetic(
def geodetic2eci(
- lat: ndarray,
- lon: ndarray,
- alt: ndarray,
- t: datetime,
- ell: Ellipsoid = None,
- *,
- deg: bool = True,
- use_astropy: bool = True
-) -> tuple[ndarray, ndarray, ndarray]:
+ lat, lon, alt, t: datetime, ell: Ellipsoid = None, *, deg: bool = True, use_astropy: bool = True
+) -> tuple:
"""
convert geodetic coordinates to Earth Centered Internal ECI
@@ -446,11 +424,11 @@ def geodetic2eci(
Parameters
----------
- lat : float
+ lat
geodetic latitude
- lon : float
+ lon
geodetic longitude
- alt : float
+ alt
altitude above ellipsoid (meters)
t : datetime.datetime, float
UTC time
@@ -463,11 +441,11 @@ def geodetic2eci(
Results
-------
- x : float
+ x
ECI x-location [meters]
- y : float
+ y
ECI y-location [meters]
- z : float
+ z
ECI z-location [meters]
geodetic2eci() a.k.a lla2eci()
@@ -482,32 +460,32 @@ def geodetic2eci(
def enu2ecef(
- e1: ndarray,
- n1: ndarray,
- u1: ndarray,
- lat0: ndarray,
- lon0: ndarray,
- h0: ndarray,
+ e1,
+ n1,
+ u1,
+ lat0,
+ lon0,
+ h0,
ell: Ellipsoid = None,
deg: bool = True,
-) -> tuple[ndarray, ndarray, ndarray]:
+) -> tuple:
"""
ENU to ECEF
Parameters
----------
- e1 : float
+ e1
target east ENU coordinate (meters)
- n1 : float
+ n1
target north ENU coordinate (meters)
- u1 : float
+ u1
target up ENU coordinate (meters)
- lat0 : float
+ lat0
Observer geodetic latitude
- lon0 : float
+ lon0
Observer geodetic longitude
- h0 : float
+ h0
observer altitude above geodetic ellipsoid (meters)
ell : Ellipsoid, optional
reference ellipsoid
@@ -517,11 +495,11 @@ def enu2ecef(
Results
-------
- x : float
+ x
target x ECEF coordinate (meters)
- y : float
+ y
target y ECEF coordinate (meters)
- z : float
+ z
target z ECEF coordinate (meters)
"""
x0, y0, z0 = geodetic2ecef(lat0, lon0, h0, ell, deg=deg)
=====================================
src/pymap3d/eci.py
=====================================
@@ -2,7 +2,6 @@
from __future__ import annotations
-import typing
from datetime import datetime
from numpy import array, sin, cos, column_stack, empty, atleast_1d
@@ -15,15 +14,10 @@ except ImportError:
from .sidereal import greenwichsrt, juliandate
-if typing.TYPE_CHECKING:
- from numpy import ndarray
-
__all__ = ["eci2ecef", "ecef2eci"]
-def eci2ecef(
- x: ndarray, y: ndarray, z: ndarray, time: datetime, *, use_astropy: bool = True
-) -> tuple[ndarray, ndarray, ndarray]:
+def eci2ecef(x, y, z, time: datetime, *, use_astropy: bool = True) -> tuple:
"""
Observer => Point ECI => ECEF
@@ -79,9 +73,7 @@ def eci2ecef(
return x_ecef, y_ecef, z_ecef
-def ecef2eci(
- x: ndarray, y: ndarray, z: ndarray, time: datetime, *, use_astropy: bool = True
-) -> tuple[ndarray, ndarray, ndarray]:
+def ecef2eci(x, y, z, time: datetime, *, use_astropy: bool = True) -> tuple:
"""
Point => Point ECEF => ECI
@@ -139,6 +131,6 @@ def ecef2eci(
return x_eci, y_eci, z_eci
-def R3(x: float) -> ndarray:
+def R3(x: float):
"""Rotation matrix for ECI"""
return array([[cos(x), sin(x), 0], [-sin(x), cos(x), 0], [0, 0, 1]])
=====================================
src/pymap3d/enu.py
=====================================
@@ -1,6 +1,5 @@
""" transforms involving ENU East North Up """
from __future__ import annotations
-import typing
from math import tau
@@ -12,15 +11,10 @@ except ImportError:
from .ecef import geodetic2ecef, ecef2geodetic, enu2ecef, uvw2enu
from .ellipsoid import Ellipsoid
-if typing.TYPE_CHECKING:
- from numpy import ndarray
-
__all__ = ["enu2aer", "aer2enu", "enu2geodetic", "geodetic2enu"]
-def enu2aer(
- e: ndarray, n: ndarray, u: ndarray, deg: bool = True
-) -> tuple[ndarray, ndarray, ndarray]:
+def enu2aer(e, n, u, deg: bool = True) -> tuple:
"""
ENU to Azimuth, Elevation, Range
@@ -73,9 +67,7 @@ def enu2aer(
return az, elev, slantRange
-def aer2enu(
- az: ndarray, el: ndarray, srange: float | ndarray, deg: bool = True
-) -> tuple[ndarray, ndarray, ndarray]:
+def aer2enu(az, el, srange, deg: bool = True) -> tuple:
"""
Azimuth, Elevation, Slant range to target to East, North, Up
@@ -116,15 +108,15 @@ def aer2enu(
def enu2geodetic(
- e: ndarray,
- n: ndarray,
- u: ndarray,
- lat0: ndarray,
- lon0: ndarray,
- h0: ndarray,
+ e,
+ n,
+ u,
+ lat0,
+ lon0,
+ h0,
ell: Ellipsoid = None,
deg: bool = True,
-) -> tuple[ndarray, ndarray, ndarray]:
+) -> tuple:
"""
East, North, Up to target to geodetic coordinates
@@ -164,15 +156,15 @@ def enu2geodetic(
def geodetic2enu(
- lat: ndarray,
- lon: ndarray,
- h: ndarray,
- lat0: ndarray,
- lon0: ndarray,
- h0: ndarray,
+ lat,
+ lon,
+ h,
+ lat0,
+ lon0,
+ h0,
ell: Ellipsoid = None,
deg: bool = True,
-) -> tuple[ndarray, ndarray, ndarray]:
+) -> tuple:
"""
Parameters
----------
=====================================
src/pymap3d/latitude.py
=====================================
@@ -1,7 +1,6 @@
"""geodetic transforms to auxilary coordinate systems involving latitude"""
from __future__ import annotations
-import typing
from .ellipsoid import Ellipsoid
from .utils import sanitize, sign
@@ -17,9 +16,6 @@ except ImportError:
use_numpy = False
-if typing.TYPE_CHECKING:
- from numpy import ndarray
-
COS_EPS = 1e-9 # tolerance for angles near abs([90, 270])
__all__ = [
@@ -41,11 +37,11 @@ __all__ = [
def geoc2geod(
- geocentric_lat: ndarray,
- geocentric_distance: ndarray,
+ geocentric_lat,
+ geocentric_distance,
ell: Ellipsoid = None,
deg: bool = True,
-) -> float:
+):
"""
convert geocentric latitude to geodetic latitude, consider mean sea level altitude
@@ -87,9 +83,7 @@ def geoc2geod(
return degrees(geodetic_lat) if deg else geodetic_lat
-def geodetic2geocentric(
- geodetic_lat: ndarray, alt_m: float, ell: Ellipsoid = None, deg: bool = True
-) -> ndarray:
+def geodetic2geocentric(geodetic_lat, alt_m, ell: Ellipsoid = None, deg: bool = True):
"""
convert geodetic latitude to geocentric latitude on spheroid surface
@@ -128,9 +122,7 @@ def geodetic2geocentric(
geod2geoc = geodetic2geocentric
-def geocentric2geodetic(
- geocentric_lat: ndarray, alt_m: float, ell: Ellipsoid = None, deg: bool = True
-) -> ndarray:
+def geocentric2geodetic(geocentric_lat, alt_m, ell: Ellipsoid = None, deg: bool = True):
"""
converts from geocentric latitude to geodetic latitude
@@ -166,9 +158,7 @@ def geocentric2geodetic(
return degrees(geodetic_lat) if deg else geodetic_lat
-def geodetic2isometric(
- geodetic_lat: float | ndarray, ell: Ellipsoid = None, deg: bool = True
-) -> float:
+def geodetic2isometric(geodetic_lat, ell: Ellipsoid = None, deg: bool = True):
"""
computes isometric latitude on an ellipsoid
@@ -228,7 +218,7 @@ def geodetic2isometric(
return isometric_lat
-def isometric2geodetic(isometric_lat: ndarray, ell: Ellipsoid = None, deg: bool = True) -> ndarray:
+def isometric2geodetic(isometric_lat, ell: Ellipsoid = None, deg: bool = True):
"""
converts from isometric latitude to geodetic latitude
@@ -264,7 +254,7 @@ def isometric2geodetic(isometric_lat: ndarray, ell: Ellipsoid = None, deg: bool
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, ell: Ellipsoid = None, deg: bool = True):
"""
converts from conformal latitude to geodetic latitude
@@ -309,7 +299,7 @@ def conformal2geodetic(conformal_lat: ndarray, ell: Ellipsoid = None, deg: bool
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, ell: Ellipsoid = None, deg: bool = True):
"""
converts from geodetic latitude to conformal latitude
@@ -355,9 +345,7 @@ def geodetic2conformal(geodetic_lat: ndarray, ell: Ellipsoid = None, deg: bool =
# %% rectifying
-def geodetic2rectifying(
- geodetic_lat: float | ndarray, ell: Ellipsoid = None, deg: bool = True
-) -> float:
+def geodetic2rectifying(geodetic_lat, ell: Ellipsoid = None, deg: bool = True):
"""
converts from geodetic latitude to rectifying latitude
@@ -403,9 +391,7 @@ def geodetic2rectifying(
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, ell: Ellipsoid = None, deg: bool = True):
"""
converts from rectifying latitude to geodetic latitude
@@ -451,7 +437,7 @@ def rectifying2geodetic(
# %% authalic
-def geodetic2authalic(geodetic_lat: ndarray, ell: Ellipsoid = None, deg: bool = True) -> ndarray:
+def geodetic2authalic(geodetic_lat, ell: Ellipsoid = None, deg: bool = True):
"""
converts from geodetic latitude to authalic latitude
@@ -495,7 +481,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, ell: Ellipsoid = None, deg: bool = True):
"""
converts from authalic latitude to geodetic latitude
@@ -538,7 +524,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, ell: Ellipsoid = None, deg: bool = True):
"""
converts from geodetic latitude to parametric latitude
@@ -572,9 +558,7 @@ def geodetic2parametric(geodetic_lat: ndarray, ell: Ellipsoid = None, deg: bool
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, ell: Ellipsoid = None, deg: bool = True):
"""
converts from parametric latitude to geodetic latitude
=====================================
src/pymap3d/los.py
=====================================
@@ -1,7 +1,6 @@
""" Line of sight intersection of space observer to ellipsoid """
from __future__ import annotations
-import typing
try:
from numpy import pi, nan, sqrt, atleast_1d
@@ -12,21 +11,18 @@ from .aer import aer2enu
from .ecef import enu2uvw, geodetic2ecef, ecef2geodetic
from .ellipsoid import Ellipsoid
-if typing.TYPE_CHECKING:
- from numpy import ndarray
-
__all__ = ["lookAtSpheroid"]
def lookAtSpheroid(
- lat0: ndarray,
- lon0: ndarray,
- h0: ndarray,
- az: ndarray,
- tilt: ndarray,
+ lat0,
+ lon0,
+ h0,
+ az,
+ tilt,
ell: Ellipsoid = None,
deg: bool = True,
-) -> tuple[ndarray, ndarray, ndarray]:
+) -> tuple:
"""
Calculates line-of-sight intersection with Earth (or other ellipsoid) surface from above surface / orbit
=====================================
src/pymap3d/lox.py
=====================================
@@ -1,7 +1,6 @@
""" isometric latitude, meridian distance """
from __future__ import annotations
-import typing
try:
from numpy import radians, degrees, cos, arctan2 as atan2, tan, array, broadcast_arrays
@@ -23,9 +22,6 @@ from .latitude import (
)
from .utils import sph2cart, cart2sph
-if typing.TYPE_CHECKING:
- from numpy import ndarray
-
__all__ = [
"loxodrome_inverse",
"loxodrome_direct",
@@ -39,7 +35,7 @@ __all__ = [
COS_EPS = 1e-9
-def meridian_dist(lat: ndarray, ell: Ellipsoid = None, deg: bool = True) -> float:
+def meridian_dist(lat, ell: Ellipsoid = None, deg: bool = True) -> float:
"""
Computes the ground distance on an ellipsoid from the equator to the input latitude.
@@ -60,7 +56,7 @@ def meridian_dist(lat: ndarray, ell: Ellipsoid = None, deg: bool = True) -> floa
return meridian_arc(0.0, lat, ell, deg)
-def meridian_arc(lat1, lat2: ndarray, ell: Ellipsoid = None, deg: bool = True) -> float:
+def meridian_arc(lat1, lat2, ell: Ellipsoid = None, deg: bool = True) -> float:
"""
Computes the ground distance on an ellipsoid between two latitudes.
@@ -89,10 +85,10 @@ def meridian_arc(lat1, lat2: ndarray, ell: Ellipsoid = None, deg: bool = True) -
def loxodrome_inverse(
- lat1: ndarray,
- lon1: ndarray,
- lat2: ndarray,
- lon2: ndarray,
+ lat1,
+ lon1,
+ lat2,
+ lon2,
ell: Ellipsoid = None,
deg: bool = True,
) -> tuple[float, float]:
@@ -181,13 +177,13 @@ def loxodrome_inverse(
def loxodrome_direct(
- lat1: float | ndarray,
- lon1: float | ndarray,
- rng: float | ndarray,
- a12: float,
+ lat1,
+ lon1,
+ rng,
+ a12,
ell: Ellipsoid = None,
deg: bool = True,
-) -> tuple[float | ndarray, float | ndarray]:
+) -> tuple:
"""
Given starting lat, lon with arclength and azimuth, compute final lat, lon
@@ -224,12 +220,12 @@ def loxodrome_direct(
try:
lat1, rng, a12 = broadcast_arrays(lat1, rng, a12)
- if (abs(lat1) > pi / 2).any(): # type: ignore
+ if (abs(lat1) > pi / 2).any():
raise ValueError("-90 <= latitude <= 90")
- if (rng < 0).any(): # type: ignore
+ if (rng < 0).any():
raise ValueError("ground distance must be >= 0")
except NameError:
- if abs(lat1) > pi / 2: # type: ignore
+ if abs(lat1) > pi / 2:
raise ValueError("-90 <= latitude <= 90")
if rng < 0:
raise ValueError("ground distance must be >= 0")
@@ -266,9 +262,7 @@ def loxodrome_direct(
return lat2, lon2
-def departure(
- lon1: ndarray, lon2: ndarray, lat: ndarray, ell: Ellipsoid = None, deg: bool = True
-) -> float:
+def departure(lon1, lon2, lat, ell: Ellipsoid = None, deg: bool = True) -> float:
"""
Computes the distance along a specific parallel between two meridians.
@@ -296,9 +290,7 @@ def departure(
return rcurve.parallel(lat, ell=ell, deg=False) * ((lon2 - lon1) % pi)
-def meanm(
- lat: ndarray, lon: ndarray, ell: Ellipsoid = None, deg: bool = True
-) -> tuple[ndarray, ndarray]:
+def meanm(lat, lon, ell: Ellipsoid = None, deg: bool = True) -> tuple:
"""
Computes geographic mean for geographic points on an ellipsoid
=====================================
src/pymap3d/ned.py
=====================================
@@ -1,19 +1,13 @@
""" Transforms involving NED North East Down """
from __future__ import annotations
-import typing
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
-
-def aer2ned(
- az: ndarray, elev: ndarray, slantRange: ndarray, deg: bool = True
-) -> tuple[ndarray, ndarray, ndarray]:
+def aer2ned(az, elev, slantRange, deg: bool = True) -> tuple:
"""
converts azimuth, elevation, range to target from observer to North, East, Down
@@ -43,9 +37,7 @@ def aer2ned(
return n, e, -u
-def ned2aer(
- n: ndarray, e: ndarray, d: ndarray, deg: bool = True
-) -> tuple[ndarray, ndarray, ndarray]:
+def ned2aer(n, e, d, deg: bool = True) -> tuple:
"""
converts North, East, Down to azimuth, elevation, range
@@ -75,15 +67,15 @@ def ned2aer(
def ned2geodetic(
- n: ndarray,
- e: ndarray,
- d: ndarray,
- lat0: ndarray,
- lon0: ndarray,
- h0: ndarray,
+ n,
+ e,
+ d,
+ lat0,
+ lon0,
+ h0,
ell: Ellipsoid = None,
deg: bool = True,
-) -> tuple[ndarray, ndarray, ndarray]:
+) -> tuple:
"""
Converts North, East, Down to target latitude, longitude, altitude
@@ -124,15 +116,15 @@ def ned2geodetic(
def ned2ecef(
- n: ndarray,
- e: ndarray,
- d: ndarray,
- lat0: ndarray,
- lon0: ndarray,
- h0: ndarray,
+ n,
+ e,
+ d,
+ lat0,
+ lon0,
+ h0,
ell: Ellipsoid = None,
deg: bool = True,
-) -> tuple[ndarray, ndarray, ndarray]:
+) -> tuple:
"""
North, East, Down to target ECEF coordinates
@@ -170,15 +162,15 @@ def ned2ecef(
def ecef2ned(
- x: ndarray,
- y: ndarray,
- z: ndarray,
- lat0: ndarray,
- lon0: ndarray,
- h0: ndarray,
+ x,
+ y,
+ z,
+ lat0,
+ lon0,
+ h0,
ell: Ellipsoid = None,
deg: bool = True,
-) -> tuple[ndarray, ndarray, ndarray]:
+) -> tuple:
"""
Convert ECEF x,y,z to North, East, Down
@@ -219,15 +211,15 @@ def ecef2ned(
def geodetic2ned(
- lat: ndarray,
- lon: ndarray,
- h: ndarray,
- lat0: ndarray,
- lon0: ndarray,
- h0: ndarray,
+ lat,
+ lon,
+ h,
+ lat0,
+ lon0,
+ h0,
ell: Ellipsoid = None,
deg: bool = True,
-) -> tuple[ndarray, ndarray, ndarray]:
+) -> tuple:
"""
convert latitude, longitude, altitude of target to North, East, Down from observer
@@ -267,9 +259,7 @@ def geodetic2ned(
return n, e, -u
-def ecef2nedv(
- x: float, y: float, z: float, lat0: float, lon0: float, deg: bool = True
-) -> tuple[float, float, float]:
+def ecef2nedv(x, y, z, lat0, lon0, deg: bool = True) -> tuple[float, float, float]:
"""
for VECTOR between two points
=====================================
src/pymap3d/rcurve.py
=====================================
@@ -1,7 +1,6 @@
"""compute radii of curvature for an ellipsoid"""
from __future__ import annotations
-import typing
try:
from numpy import sin, cos, sqrt
@@ -11,13 +10,10 @@ except ImportError:
from .ellipsoid import Ellipsoid
from .utils import sanitize
-if typing.TYPE_CHECKING:
- from numpy import ndarray
-
__all__ = ["parallel", "meridian", "transverse", "geocentric_radius"]
-def geocentric_radius(geodetic_lat: ndarray, ell: Ellipsoid = None, deg: bool = True) -> ndarray:
+def geocentric_radius(geodetic_lat, ell: Ellipsoid = None, deg: bool = True):
"""
compute geocentric radius at geodetic latitude
@@ -37,7 +33,7 @@ def geocentric_radius(geodetic_lat: ndarray, ell: Ellipsoid = None, deg: bool =
)
-def parallel(lat: float | ndarray, ell: Ellipsoid = None, deg: bool = True) -> float:
+def parallel(lat, ell: Ellipsoid = None, deg: bool = True) -> float:
"""
computes the radius of the small circle encompassing the globe at the specified latitude
@@ -63,7 +59,7 @@ def parallel(lat: float | ndarray, ell: Ellipsoid = None, deg: bool = True) -> f
return cos(lat) * transverse(lat, ell, deg=False)
-def meridian(lat: ndarray, ell: Ellipsoid = None, deg: bool = True) -> ndarray:
+def meridian(lat, ell: Ellipsoid = None, deg: bool = True):
"""computes the meridional radius of curvature for the ellipsoid
like Matlab rcurve('meridian', ...)
@@ -90,7 +86,7 @@ def meridian(lat: ndarray, ell: Ellipsoid = None, deg: bool = True) -> ndarray:
return f1 / sqrt(f2 ** 3)
-def transverse(lat: float | ndarray, ell: Ellipsoid = None, deg: bool = True) -> ndarray:
+def transverse(lat, ell: Ellipsoid = None, deg: bool = True):
"""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
=====================================
src/pymap3d/rsphere.py
=====================================
@@ -1,7 +1,6 @@
""" compute radii of auxiliary spheres"""
from __future__ import annotations
-import typing
try:
from numpy import radians, sin, cos, log, sqrt, degrees, asarray
@@ -12,9 +11,6 @@ from .ellipsoid import Ellipsoid
from . import rcurve
from .vincenty import vdist
-if typing.TYPE_CHECKING:
- from numpy import ndarray
-
__all__ = [
"eqavol",
"authalic",
@@ -93,13 +89,13 @@ def rectifying(ell: Ellipsoid = None) -> float:
def euler(
- lat1: ndarray,
- lon1: ndarray,
- lat2: ndarray,
- lon2: ndarray,
+ lat1,
+ lon1,
+ lat2,
+ lon2,
ell: Ellipsoid = None,
deg: bool = True,
-) -> ndarray:
+):
"""computes the Euler radii of curvature at the midpoint of the
great circle arc defined by the endpoints (lat1,lon1) and (lat2,lon2)
@@ -143,7 +139,7 @@ def euler(
return rho * nu / den
-def curve(lat: ndarray, ell: Ellipsoid = None, deg: bool = True, method: str = "mean") -> ndarray:
+def curve(lat, ell: Ellipsoid = None, deg: bool = True, method: str = "mean"):
"""computes the arithmetic average of the transverse and meridional
radii of curvature at a specified latitude point
=====================================
src/pymap3d/tests/test_rcurve.py
=====================================
@@ -12,12 +12,12 @@ A = ell.semimajor_axis
"lat,curvature", [(0, A), (90, 0), (-90, 0), (45.0, 4517590.87884893), (-45, 4517590.87884893)]
)
def test_rcurve_parallel(lat, curvature):
- assert rcurve.parallel(lat) == approx(curvature, abs=1e-9)
+ assert rcurve.parallel(lat) == approx(curvature, abs=1e-9, rel=1e-6)
def test_numpy_parallel():
pytest.importorskip("numpy")
- assert rcurve.parallel([0, 90]) == approx([A, 0], abs=1e-9)
+ assert rcurve.parallel([0, 90]) == approx([A, 0], abs=1e-9, rel=1e-6)
@pytest.mark.parametrize(
=====================================
src/pymap3d/utils.py
=====================================
@@ -3,7 +3,6 @@
all assume radians"""
from __future__ import annotations
-import typing
from math import pi
from .ellipsoid import Ellipsoid
@@ -13,7 +12,7 @@ try:
except ImportError:
from math import atan2, hypot, cos, sin, radians # type: ignore
- def sign(x: float) -> float: # type: ignore
+ def sign(x) -> float: # type: ignore
"""signum function"""
if x < 0:
y = -1.0
@@ -25,23 +24,20 @@ except ImportError:
return y
-if typing.TYPE_CHECKING:
- from numpy import ndarray
-
__all__ = ["cart2pol", "pol2cart", "cart2sph", "sph2cart", "sign"]
-def cart2pol(x: float, y: float) -> tuple[float, float]:
+def cart2pol(x, y) -> tuple:
"""Transform Cartesian to polar coordinates"""
return atan2(y, x), hypot(x, y)
-def pol2cart(theta: float, rho: float) -> tuple[float, float]:
+def pol2cart(theta, rho) -> tuple:
"""Transform polar to Cartesian coordinates"""
return rho * cos(theta), rho * sin(theta)
-def cart2sph(x: ndarray, y: ndarray, z: ndarray) -> tuple[ndarray, ndarray, ndarray]:
+def cart2sph(x, y, z) -> tuple:
"""Transform Cartesian to spherical coordinates"""
hxy = hypot(x, y)
r = hypot(hxy, z)
@@ -50,7 +46,7 @@ def cart2sph(x: ndarray, y: ndarray, z: ndarray) -> tuple[ndarray, ndarray, ndar
return az, el, r
-def sph2cart(az: ndarray, el: ndarray, r: ndarray) -> tuple[ndarray, ndarray, ndarray]:
+def sph2cart(az, el, r) -> tuple:
"""Transform spherical to Cartesian coordinates"""
rcos_theta = r * cos(el)
x = rcos_theta * cos(az)
@@ -59,9 +55,7 @@ def sph2cart(az: ndarray, el: ndarray, r: ndarray) -> tuple[ndarray, ndarray, nd
return x, y, z
-def sanitize(
- lat: float | ndarray, ell: typing.Optional[Ellipsoid], deg: bool
-) -> tuple[float | ndarray, Ellipsoid]:
+def sanitize(lat, ell: Ellipsoid | None, deg: bool) -> tuple:
if ell is None:
ell = Ellipsoid()
=====================================
src/pymap3d/vincenty.py
=====================================
@@ -3,7 +3,7 @@ Vincenty's methods for computing ground distance and reckoning
"""
from __future__ import annotations
-import typing
+
import logging
from math import nan, pi
from copy import copy
@@ -28,19 +28,17 @@ except ImportError:
from .ellipsoid import Ellipsoid
from .utils import sign
-if typing.TYPE_CHECKING:
- from numpy import ndarray
__all__ = ["vdist", "vreckon", "track2"]
def vdist(
- Lat1: float | ndarray,
- Lon1: float | ndarray,
- Lat2: float | ndarray,
- Lon2: float | ndarray,
+ Lat1,
+ Lon1,
+ Lat2,
+ Lon2,
ell: Ellipsoid = None,
-) -> tuple[ndarray, ndarray]:
+) -> tuple:
"""
Using the reference ellipsoid, compute the distance between two points
within a few millimeters of accuracy, compute forward azimuth,
@@ -277,8 +275,12 @@ def vdist(
def vreckon(
- Lat1: float | ndarray, Lon1: float | ndarray, Rng: ndarray, Azim: ndarray, ell: Ellipsoid = None
-) -> tuple[ndarray, ndarray]:
+ Lat1,
+ Lon1,
+ Rng,
+ Azim,
+ ell: Ellipsoid = None,
+) -> tuple:
"""
This is the Vincenty "forward" solution.
@@ -457,14 +459,14 @@ def vreckon(
def track2(
- lat1: ndarray,
- lon1: ndarray,
- lat2: ndarray,
- lon2: ndarray,
+ lat1,
+ lon1,
+ lat2,
+ lon2,
ell: Ellipsoid = None,
npts: int = 100,
deg: bool = True,
-) -> tuple[list[ndarray], list[ndarray]]:
+) -> tuple[list, list]:
"""
computes great circle tracks starting at the point lat1, lon1 and ending at lat2, lon2
View it on GitLab: https://salsa.debian.org/debian-gis-team/pymap3d/-/compare/8dbf96c15aaadf395847c8fd195facc2fe095ffb...c52770f3cde00eff7149104bb0a4ee67eaec9d80
--
View it on GitLab: https://salsa.debian.org/debian-gis-team/pymap3d/-/compare/8dbf96c15aaadf395847c8fd195facc2fe095ffb...c52770f3cde00eff7149104bb0a4ee67eaec9d80
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/20220410/9b2c33e2/attachment-0001.htm>
More information about the Pkg-grass-devel
mailing list