-
-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
309 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
from .ecef import Ellipsoid, geodetic2ecef, ecef2geodetic, ecef2enuv, ecef2enu, enu2uvw, uvw2enu, enu2ecef # noqa: F401 | ||
from .enu import enu2aer, aer2enu, enu2geodetic, geodetic2enu # noqa: F401 | ||
from .aer import aer2ecef, ecef2aer, geodetic2aer, aer2geodetic # noqa: F401 | ||
from .ned import aer2ned, ned2aer, ned2geodetic, ned2ecef, ecef2ned, geodetic2ned, ecef2nedv # noqa: F401 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,270 @@ | ||
""" Transforms involving NED North East Down """ | ||
from .enu import geodetic2enu, aer2enu, enu2aer | ||
from .ecef import ecef2geodetic, ecef2enuv, ecef2enu, enu2ecef, Ellipsoid | ||
from typing import Tuple | ||
|
||
__all__ = ['aer2ned', 'ned2aer', 'ned2geodetic', 'ned2ecef', 'ecef2ned', 'geodetic2ned', 'ecef2nedv'] | ||
|
||
|
||
def aer2ned(az: float, elev: float, slantRange: float, | ||
deg: bool = True) -> Tuple[float, float, float]: | ||
""" | ||
converts azimuth, elevation, range to target from observer to North, East, Down | ||
Parameters | ||
----------- | ||
az : float | ||
azimuth | ||
elev : float | ||
elevation | ||
slantRange : float | ||
slant range [meters] | ||
deg : bool, optional | ||
degrees input/output (False: radians in/out) | ||
Results | ||
------- | ||
n : float | ||
North NED coordinate (meters) | ||
e : float | ||
East NED coordinate (meters) | ||
d : float | ||
Down NED coordinate (meters) | ||
""" | ||
e, n, u = aer2enu(az, elev, slantRange, deg=deg) | ||
|
||
return n, e, -u | ||
|
||
|
||
def ned2aer(n: float, e: float, d: float, | ||
deg: bool = True) -> Tuple[float, float, float]: | ||
""" | ||
converts North, East, Down to azimuth, elevation, range | ||
Parameters | ||
---------- | ||
n : float | ||
North NED coordinate (meters) | ||
e : float | ||
East NED coordinate (meters) | ||
d : float | ||
Down NED coordinate (meters) | ||
deg : bool, optional | ||
degrees input/output (False: radians in/out) | ||
Results | ||
------- | ||
az : float | ||
azimuth | ||
elev : float | ||
elevation | ||
slantRange : float | ||
slant range [meters] | ||
""" | ||
return enu2aer(e, n, -d, deg=deg) | ||
|
||
|
||
def ned2geodetic(n: float, e: float, d: float, | ||
lat0: float, lon0: float, h0: float, | ||
ell: Ellipsoid = None, deg: bool = True) -> Tuple[float, float, float]: | ||
""" | ||
Converts North, East, Down to target latitude, longitude, altitude | ||
Parameters | ||
---------- | ||
n : float | ||
North NED coordinate (meters) | ||
e : float | ||
East NED coordinate (meters) | ||
d : float | ||
Down NED coordinate (meters) | ||
lat0 : float | ||
Observer geodetic latitude | ||
lon0 : float | ||
Observer geodetic longitude | ||
h0 : float | ||
observer altitude above geodetic ellipsoid (meters) | ||
ell : Ellipsoid, optional | ||
reference ellipsoid | ||
deg : bool, optional | ||
degrees input/output (False: radians in/out) | ||
Results | ||
------- | ||
lat : float | ||
target geodetic latitude | ||
lon : float | ||
target geodetic longitude | ||
h : float | ||
target altitude above geodetic ellipsoid (meters) | ||
""" | ||
x, y, z = enu2ecef(e, n, -d, lat0, lon0, h0, ell, deg=deg) | ||
|
||
return ecef2geodetic(x, y, z, ell, deg=deg) | ||
|
||
|
||
def ned2ecef(n: float, e: float, d: float, | ||
lat0: float, lon0: float, h0: float, | ||
ell: Ellipsoid = None, deg: bool = True) -> Tuple[float, float, float]: | ||
""" | ||
North, East, Down to target ECEF coordinates | ||
Parameters | ||
---------- | ||
n : float | ||
North NED coordinate (meters) | ||
e : float | ||
East NED coordinate (meters) | ||
d : float | ||
Down NED coordinate (meters) | ||
lat0 : float | ||
Observer geodetic latitude | ||
lon0 : float | ||
Observer geodetic longitude | ||
h0 : float | ||
observer altitude above geodetic ellipsoid (meters) | ||
ell : Ellipsoid, optional | ||
reference ellipsoid | ||
deg : bool, optional | ||
degrees input/output (False: radians in/out) | ||
Results | ||
------- | ||
x : float | ||
ECEF x coordinate (meters) | ||
y : float | ||
ECEF y coordinate (meters) | ||
z : float | ||
ECEF z coordinate (meters) | ||
""" | ||
return enu2ecef(e, n, -d, lat0, lon0, h0, ell, deg=deg) | ||
|
||
|
||
def ecef2ned(x: float, y: float, z: float, | ||
lat0: float, lon0: float, h0: float, | ||
ell: Ellipsoid = None, deg: bool = True) -> Tuple[float, float, float]: | ||
""" | ||
Convert ECEF x,y,z to North, East, Down | ||
Parameters | ||
---------- | ||
x : float | ||
ECEF x coordinate (meters) | ||
y : float | ||
ECEF y coordinate (meters) | ||
z : float | ||
ECEF z coordinate (meters) | ||
lat0 : float | ||
Observer geodetic latitude | ||
lon0 : float | ||
Observer geodetic longitude | ||
h0 : float | ||
observer altitude above geodetic ellipsoid (meters) | ||
ell : Ellipsoid, optional | ||
reference ellipsoid | ||
deg : bool, optional | ||
degrees input/output (False: radians in/out) | ||
Results | ||
------- | ||
n : float | ||
North NED coordinate (meters) | ||
e : float | ||
East NED coordinate (meters) | ||
d : float | ||
Down NED coordinate (meters) | ||
""" | ||
e, n, u = ecef2enu(x, y, z, lat0, lon0, h0, ell, deg=deg) | ||
|
||
return n, e, -u | ||
|
||
|
||
def geodetic2ned(lat: float, lon: float, h: float, | ||
lat0: float, lon0: float, h0: float, | ||
ell: Ellipsoid = None, deg: bool = True) -> Tuple[float, float, float]: | ||
""" | ||
convert latitude, longitude, altitude of target to North, East, Down from observer | ||
Parameters | ||
---------- | ||
lat : float | ||
target geodetic latitude | ||
lon : float | ||
target geodetic longitude | ||
h : float | ||
target altitude above geodetic ellipsoid (meters) | ||
lat0 : float | ||
Observer geodetic latitude | ||
lon0 : float | ||
Observer geodetic longitude | ||
h0 : float | ||
observer altitude above geodetic ellipsoid (meters) | ||
ell : Ellipsoid, optional | ||
reference ellipsoid | ||
deg : bool, optional | ||
degrees input/output (False: radians in/out) | ||
Results | ||
------- | ||
n : float | ||
North NED coordinate (meters) | ||
e : float | ||
East NED coordinate (meters) | ||
d : float | ||
Down NED coordinate (meters) | ||
""" | ||
e, n, u = geodetic2enu(lat, lon, h, lat0, lon0, h0, ell, deg=deg) | ||
|
||
return n, e, -u | ||
|
||
|
||
def ecef2nedv(x: float, y: float, z: float, | ||
lat0: float, lon0: float, | ||
deg: bool = True) -> Tuple[float, float, float]: | ||
""" | ||
for VECTOR between two points | ||
Parameters | ||
---------- | ||
x : float | ||
ECEF x coordinate (meters) | ||
y : float | ||
ECEF y coordinate (meters) | ||
z : float | ||
ECEF z coordinate (meters) | ||
lat0 : float | ||
Observer geodetic latitude | ||
lon0 : float | ||
Observer geodetic longitude | ||
deg : bool, optional | ||
degrees input/output (False: radians in/out) | ||
Results | ||
------- | ||
(Vector) | ||
n : float | ||
North NED coordinate (meters) | ||
e : float | ||
East NED coordinate (meters) | ||
d : float | ||
Down NED coordinate (meters) | ||
""" | ||
e, n, u = ecef2enuv(x, y, z, lat0, lon0, deg=deg) | ||
|
||
return n, e, -u |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters