Spaces:
Sleeping
Sleeping
rmm
commited on
Commit
·
4fd1e53
1
Parent(s):
f500b17
chore: added docstring to decimal_coords func
Browse files- src/input_handling.py +14 -0
src/input_handling.py
CHANGED
|
@@ -194,6 +194,20 @@ def get_image_datetime(image_file: UploadedFile) -> str | None:
|
|
| 194 |
return None
|
| 195 |
|
| 196 |
def decimal_coords(coords:tuple, ref:str) -> Fraction:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 197 |
# https://stackoverflow.com/a/73267185
|
| 198 |
decimal_degrees = coords[0] + coords[1] / 60 + coords[2] / 3600
|
| 199 |
if ref == "S" or ref =='W':
|
|
|
|
| 194 |
return None
|
| 195 |
|
| 196 |
def decimal_coords(coords:tuple, ref:str) -> Fraction:
|
| 197 |
+
"""
|
| 198 |
+
Converts coordinates from degrees, minutes, and seconds to decimal degrees.
|
| 199 |
+
|
| 200 |
+
Args:
|
| 201 |
+
coords (tuple): A tuple containing three elements representing degrees, minutes, and seconds.
|
| 202 |
+
ref (str): A string representing the reference direction ('N', 'S', 'E', 'W').
|
| 203 |
+
|
| 204 |
+
Returns:
|
| 205 |
+
Fraction: The coordinates in decimal degrees. Negative if the reference is 'S' or 'W'.
|
| 206 |
+
|
| 207 |
+
Example:
|
| 208 |
+
decimal_coords((40, 26, 46), 'N') -> 40.44611111111111
|
| 209 |
+
decimal_coords((40, 26, 46), 'W') -> -40.44611111111111
|
| 210 |
+
"""
|
| 211 |
# https://stackoverflow.com/a/73267185
|
| 212 |
decimal_degrees = coords[0] + coords[1] / 60 + coords[2] / 3600
|
| 213 |
if ref == "S" or ref =='W':
|