mt_metadata.utils.location_helpers ================================== .. py:module:: mt_metadata.utils.location_helpers Functions --------- .. autoapisummary:: mt_metadata.utils.location_helpers.convert_position_float2str mt_metadata.utils.location_helpers.convert_position_str2float mt_metadata.utils.location_helpers.validate_position Module Contents --------------- .. py:function:: convert_position_float2str(position) Convert position float to a string in the format of DD:MM:SS.ms :param position: decimal degrees of latitude or longitude :type position: float | int :returns: latitude or longitude in format of DD:MM:SS.ms :rtype: str .. py:function:: convert_position_str2float(position_str) Convert a position string in the format of DD:MM:SS to decimal degrees :param position: latitude or longitude om DD:MM:SS.ms :type position: float :returns: latitude or longitude as a float :param position_str: latitude or longitude om DD:MM:SS.ms :type position_str: str :returns: latitude or longitude as a float :rtype: float :raises ValueError: If position string cannot be converted to a float or if the format is incorrect. .. py:function:: validate_position(value, position_type) Validate position value (latitude or longitude) and convert to float. :param value: The position value to validate and convert. :type value: str | float :param position_type: The type of position ('latitude' or 'longitude'). :type position_type: str :returns: The validated and converted position value. :rtype: float :raises ValueError: If the value is not a valid latitude or longitude.