"""Synthetic coordinate exercise. PK-Research, MIT license; see LICENSE.txt."""
from datetime import datetime, timezone, timedelta

def dms(degrees, minutes, seconds, hemisphere):
    if degrees < 0 or not 0 <= minutes < 60 or not 0 <= seconds < 60:
        raise ValueError('Use positive degrees and minutes/seconds in [0, 60).')
    if hemisphere not in ('N', 'S', 'E', 'W'):
        raise ValueError('Hemisphere must be N, S, E or W.')
    limit = 90 if hemisphere in ('N', 'S') else 180
    value = degrees + minutes / 60 + seconds / 3600
    if value > limit:
        raise ValueError('Coordinate exceeds geographic range.')
    return -value if hemisphere in ('S', 'W') else value

if __name__ == '__main__':
    print('Latitude:', dms(13, 30, 0, 'N'))
    print('Longitude:', dms(100, 15, 0, 'E'))
    utc = datetime(2026, 9, 7, 20, 30, tzinfo=timezone.utc)
    print('Thailand:', utc.astimezone(timezone(timedelta(hours=7))).strftime('%Y-%m-%d %H:%M %z'))
    print('120 ft:', 120 * 0.3048, 'm')
    print('Altitude:', 120 + 30, 'm MSL (same datum assumed)')
