import re


def convertLatitude(lat):
    """
    Convers a latitude in the format N59 10.123 to decimal format.
    """

    latitudePattern = '([NS])(\d+)\s+(\d+\.\d+)'
    m = re.search(latitudePattern, lat)
    assert(m)

    deglat = float(m.group(2)) + float(m.group(3))/60
    if m.group(1) == 'S': deglat = -deglat
    return deglat