Coverage for pyguymer3/geo/max_distSrc/max_dist_geodesic.py: 83%

12 statements  

« prev     ^ index     » next       coverage.py v7.9.2, created at 2025-07-08 18:47 +0000

1#!/usr/bin/env python3 

2 

3# Define function ... 

4def max_dist_geodesic( 

5 lons, 

6 lats, 

7 midLon, 

8 midLat, 

9 /, 

10 *, 

11 eps = 1.0e-12, 

12 nIter = 100, 

13): 

14 # Import special modules ... 

15 try: 

16 import numpy 

17 except: 

18 raise Exception("\"numpy\" is not installed; run \"pip install --user numpy\"") from None 

19 

20 # Import sub-functions ... 

21 from ..calc_dist_between_two_locs import calc_dist_between_two_locs 

22 

23 # ************************************************************************** 

24 

25 # Check arguments ... 

26 assert isinstance(lons, numpy.ndarray), "\"lons\" is not a NumPy array" 

27 assert isinstance(lats, numpy.ndarray), "\"lats\" is not a NumPy array" 

28 

29 # ************************************************************************** 

30 

31 # Find the maximum Geodesic distance from the middle to any location ... 

32 maxDist = 0.0 # [m] 

33 for iLoc in range(lons.size): 

34 maxDist = max( 

35 maxDist, 

36 calc_dist_between_two_locs( 

37 midLon, 

38 midLat, 

39 lons[iLoc], 

40 lats[iLoc], 

41 eps = eps, 

42 nIter = nIter, 

43 )[0], 

44 ) # [m] 

45 

46 # Return answer ... 

47 return maxDist