def dms2dec(dms):
    """
    Convert latitude from degrees,minutes,seconds in string or 3-array
   format to decimal degrees.
    """
    DEGREE = 360.
    HOUR = 24.
    MINUTE = 60.
    SECOND = 3600.

    # Be careful here, degree needs to be a float so that negative zero
    # can have its signbit set:
    # http://docs.scipy.org/doc/numpy-1.7.0/reference/c-api.coremath.html#NPY_NZERO

    if isstring(dms):
        degree,minute,second = np.array(re.split('[dms]',hms))[:3].astype(float)
    else:
        degree,minute,second = dms.T

    sign = np.copysign(1.0,degree)
    decimal = np.abs(degree) + minute * 1./MINUTE + second * 1./SECOND
    decimal *= sign
    return decimal
Convert latitude from degrees,minutes,seconds in string or 3-array
   format to decimal degrees.