@@ -1063,11 +1063,73 @@ def estimate_matching_threshold(coords_to_assign):
10631063 return 2 * max (abs (r ) for r in get_resolution (coords_to_assign .T ))
10641064
10651065
1066- def degree_to_km (deg ):
1067- return np .deg2rad (deg ) * EARTH_RADIUS_KM
1066+ def degree_to_km (degree ):
1067+ """
1068+ Convert an angle from degrees to kilometers.
1069+
1070+ This function converts a given angle in degrees to its equivalent distance in
1071+ kilometers on the Earth's surface. It assumes a spherical Earth with a constant
1072+ radius.
1073+
1074+ Parameters
1075+ ----------
1076+ degree : float or array_like
1077+ The angle(s) in degrees to convert.
1078+
1079+ Returns
1080+ -------
1081+ float or ndarray
1082+ The equivalent distance(s) in kilometers.
1083+
1084+ See Also
1085+ --------
1086+ km_to_degree : The inverse function to convert kilometers to degrees.
1087+
1088+ Notes
1089+ -----
1090+ The conversion is based on the formula: $distance = angle_{radians} \\ times R$,
1091+ where $R$ is the Earth's radius.
1092+
1093+ Examples
1094+ --------
1095+ >>> degree_to_km(1.0)
1096+ 111.19492664455822
1097+ """
1098+ return np .deg2rad (degree ) * EARTH_RADIUS_KM
10681099
10691100
10701101def km_to_degree (km ):
1102+ """
1103+ Convert a distance from kilometers to degrees.
1104+
1105+ This function converts a given distance in kilometers on the Earth's surface
1106+ to its equivalent angle in degrees. It assumes a spherical Earth with a
1107+ constant radius.
1108+
1109+ Parameters
1110+ ----------
1111+ km : float or array_like
1112+ The distance(s) in kilometers to convert.
1113+
1114+ Returns
1115+ -------
1116+ float or ndarray
1117+ The equivalent angle(s) in degrees.
1118+
1119+ See Also
1120+ --------
1121+ degree_to_km : The inverse function to convert degrees to kilometers.
1122+
1123+ Notes
1124+ -----
1125+ The conversion is based on the formula: $angle_{radians} = distance / R$,
1126+ where $R$ is the Earth's radius.
1127+
1128+ Examples
1129+ --------
1130+ >>> km_to_degree(111.195)
1131+ 1.0000030589140416
1132+ """
10711133 return np .rad2deg (km / EARTH_RADIUS_KM )
10721134
10731135
0 commit comments