dms_to_dd

ssapy.utils.dms_to_dd(dms)[source][source]

Converts coordinates from Degree-Minute-Second (DMS) format to Decimal Degrees (DD).

Parameters:

dms (str or list of str): A single DMS string (e.g., “12:34:56”) or a list of DMS strings

(e.g., [“12:34:56”, “-45:30:15”]). Each string should represent degrees, minutes, and seconds separated by colons.

Returns:

float or list of float:
  • If the input is a single DMS string or a list with one element, returns a single float representing the decimal degree value.

  • If the input is a list of multiple DMS strings, returns a list of floats representing the decimal degree values.

Notes:

  • Negative degrees are handled correctly, ensuring that the minutes and seconds are also treated as negative when converting to decimal degrees.

  • The function supports both single DMS strings and lists of DMS strings for batch conversion.

Example:

>>> dms_to_dd("12:34:56")
12.582222222222223
>>> dms_to_dd(["12:34:56", "-45:30:15"])
[12.582222222222223, -45.50416666666667]