Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion src/pymap3d/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,17 @@
geoc2geod,
)

from .nvector import geodetic2nvector, nvector2geodetic, ecef2nvector, nvector2ecef
from .nvector import (
geodetic2nvector,
nvector2geodetic,
ecef2nvector,
nvector2ecef,
nvector_distance,
nvector_interpolate,
nvector_mean,
nvector_cross_track_distance,
nvector_intersection,
)

from .rcurve import parallel, meridian, transverse, geocentric_radius

Expand Down Expand Up @@ -158,6 +168,11 @@
"dca2geodetic",
"aer2dca",
"dca2aer",
"nvector_distance",
"nvector_interpolate",
"nvector_mean",
"nvector_cross_track_distance",
"nvector_intersection",
]


Expand Down
37 changes: 33 additions & 4 deletions src/pymap3d/aer.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,23 @@ def aer2geodetic(
return ecef2geodetic(x, y, z, ell=ell, deg=deg)


def eci2aer(x, y, z, lat0, lon0, h0, t: datetime, *, deg: bool = True) -> tuple:
def eci2aer(
x,
y,
z,
lat0,
lon0,
h0,
t: datetime,
*,
deg: bool = True,
delta_ut1: float = 0.0,
xp: float = 0.0,
yp: float = 0.0,
) -> tuple:
"""
takes Earth Centered Inertial x,y,z ECI coordinates of point and gives az, el, slant range from Observer
takes Earth Centered Inertial x,y,z ECI coordinates of point and gives az, el,
slant range from Observer

Parameters
----------
Expand All @@ -193,6 +207,12 @@ def eci2aer(x, y, z, lat0, lon0, h0, t: datetime, *, deg: bool = True) -> tuple:
Observation time
deg : bool, optional
true: degrees, false: radians
delta_ut1 : float, optional
UT1-UTC in seconds for the pure-Python path. Defaults to ``0.0``.
xp : float, optional
Polar motion x coordinate in arcseconds for the pure-Python path.
yp : float, optional
Polar motion y coordinate in arcseconds for the pure-Python path.

Returns
-------
Expand All @@ -204,7 +224,7 @@ def eci2aer(x, y, z, lat0, lon0, h0, t: datetime, *, deg: bool = True) -> tuple:
slant range [meters]
"""

xe, ye, ze = eci2ecef(x, y, z, t)
xe, ye, ze = eci2ecef(x, y, z, t, delta_ut1=delta_ut1, xp=xp, yp=yp)

return ecef2aer(xe, ye, ze, lat0, lon0, h0, deg=deg)

Expand All @@ -220,6 +240,9 @@ def aer2eci(
ell: Ellipsoid | None = None,
*,
deg: bool = True,
delta_ut1: float = 0.0,
xp: float = 0.0,
yp: float = 0.0,
) -> tuple:
"""
gives ECI of a point from an observer at az, el, slant range
Expand All @@ -244,6 +267,12 @@ def aer2eci(
reference ellipsoid
deg : bool, optional
degrees input/output (False: radians in/out)
delta_ut1 : float, optional
UT1-UTC in seconds for the pure-Python path. Defaults to ``0.0``.
xp : float, optional
Polar motion x coordinate in arcseconds for the pure-Python path.
yp : float, optional
Polar motion y coordinate in arcseconds for the pure-Python path.

Returns
-------
Expand All @@ -260,7 +289,7 @@ def aer2eci(

x, y, z = aer2ecef(az, el, srange, lat0, lon0, h0, ell, deg=deg)

return ecef2eci(x, y, z, t)
return ecef2eci(x, y, z, t, delta_ut1=delta_ut1, xp=xp, yp=yp)


def aer2ecef(
Expand Down
12 changes: 10 additions & 2 deletions src/pymap3d/azelradec.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ def azel2radec(
lon_deg: float,
time: datetime,
force_non_astropy: bool = False,
*,
delta_ut1: float = 0.0,
) -> tuple[float, float]:
"""
viewing angle (az, el) to sky coordinates (ra, dec)
Expand Down Expand Up @@ -56,7 +58,9 @@ def azel2radec(
"""

if force_non_astropy or "astropy" not in sys.modules:
return vazel2radec(az_deg, el_deg, lat_deg, lon_deg, time)
return vazel2radec(
az_deg, el_deg, lat_deg, lon_deg, time, delta_ut1=delta_ut1
)
else:
return azel2radec_astropy(az_deg, el_deg, lat_deg, lon_deg, time)

Expand Down Expand Up @@ -85,6 +89,8 @@ def radec2azel(
lon_deg: float,
time: datetime,
force_non_astropy: bool = False,
*,
delta_ut1: float = 0.0,
) -> tuple[float, float]:
"""
sky coordinates (ra, dec) to viewing angle (az, el)
Expand Down Expand Up @@ -113,7 +119,9 @@ def radec2azel(
"""

if force_non_astropy or "astropy" not in sys.modules:
return vradec2azel(ra_deg, dec_deg, lat_deg, lon_deg, time)
return vradec2azel(
ra_deg, dec_deg, lat_deg, lon_deg, time, delta_ut1=delta_ut1
)
else:
return radec2azel_astropy(ra_deg, dec_deg, lat_deg, lon_deg, time)

Expand Down
Loading