Skip to content

Commit 94c2ebb

Browse files
committed
type anno
1 parent bef328b commit 94c2ebb

File tree

5 files changed

+16
-11
lines changed

5 files changed

+16
-11
lines changed

Examples/lox_stability.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import logging
44
from pathlib import Path
55
from math import isclose, nan
6-
import numpy as np
76

87
from pymap3d.lox import loxodrome_direct
98

@@ -20,13 +19,13 @@
2019
raise EnvironmentError("Matlab does not have Mapping Toolbox")
2120

2221

23-
def matlab_func(lat1, lon1, rng, az) -> tuple[float, float]:
22+
def matlab_func(lat1: float, lon1: float, rng: float, az: float) -> tuple[float, float]:
2423
"""Using Matlab Engine to do same thing as Pymap3d"""
2524
return eng.reckon("rh", lat1, lon1, rng, az, eng.wgs84Ellipsoid(), nargout=2) # type: ignore
2625

2726

2827
lat_last, lon_last = nan, nan
29-
clat, clon, rng = np.array(40.0), np.array(-80.0), np.array(10.0) # arbitrary
28+
clat, clon, rng = 40.0, -80.0, 10.0 # arbitrary
3029

3130
for i in range(20):
3231
azi = 90.0 + 10.0 ** (-i)

src/pymap3d/latitude.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,9 @@ def geocentric2geodetic(
164164
return degrees(geodetic_lat) if deg else geodetic_lat
165165

166166

167-
def geodetic2isometric(geodetic_lat: ndarray, ell: Ellipsoid = None, deg: bool = True) -> float:
167+
def geodetic2isometric(
168+
geodetic_lat: float | ndarray, ell: Ellipsoid = None, deg: bool = True
169+
) -> float:
168170
"""
169171
computes isometric latitude on an ellipsoid
170172
@@ -345,7 +347,9 @@ def geodetic2conformal(geodetic_lat: ndarray, ell: Ellipsoid = None, deg: bool =
345347

346348

347349
# %% rectifying
348-
def geodetic2rectifying(geodetic_lat: ndarray, ell: Ellipsoid = None, deg: bool = True) -> float:
350+
def geodetic2rectifying(
351+
geodetic_lat: float | ndarray, ell: Ellipsoid = None, deg: bool = True
352+
) -> float:
349353
"""
350354
converts from geodetic latitude to rectifying latitude
351355

src/pymap3d/lox.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,10 +164,10 @@ def loxodrome_inverse(
164164

165165

166166
def loxodrome_direct(
167-
lat1: ndarray,
168-
lon1: ndarray,
169-
rng: ndarray,
170-
a12: float,
167+
lat1: float | ndarray,
168+
lon1: float | ndarray,
169+
rng: float | ndarray,
170+
a12: float | float,
171171
ell: Ellipsoid = None,
172172
deg: bool = True,
173173
) -> tuple[ndarray, ndarray]:

src/pymap3d/rcurve.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def meridian(lat: ndarray, ell: Ellipsoid = None, deg: bool = True) -> ndarray:
9292
return f1 / sqrt(f2 ** 3)
9393

9494

95-
def transverse(lat: ndarray, ell: Ellipsoid = None, deg: bool = True) -> ndarray:
95+
def transverse(lat: float | ndarray, ell: Ellipsoid = None, deg: bool = True) -> ndarray:
9696
"""computes the radius of the curve formed by a plane
9797
intersecting the ellipsoid at the latitude which is
9898
normal to the surface of the ellipsoid

src/pymap3d/utils.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,9 @@ def sph2cart(az: ndarray, el: ndarray, r: ndarray) -> tuple[ndarray, ndarray, nd
6060
return x, y, z
6161

6262

63-
def sanitize(lat: ndarray, ell: typing.Optional[Ellipsoid], deg: bool) -> tuple[ndarray, Ellipsoid]:
63+
def sanitize(
64+
lat: float | ndarray, ell: typing.Optional[Ellipsoid], deg: bool
65+
) -> tuple[float | ndarray, Ellipsoid]:
6466
if ell is None:
6567
ell = Ellipsoid()
6668
if asarray is not None:

0 commit comments

Comments
 (0)