def coords_to_float(coord):
    """Convert a latitude or longitude coordinate from a string to a float, taking into account N, E, S, W.

    For example, '48.2S' to -48.2

    Parameters
    ----------
    coord : str
        The string form of the coordinate

    Returns
    -------
    float
        The coordinate in float form
    """
    if coord != None:
        if str(coord)[-1] == 'N' or str(coord)[-1] == 'E':
            return float(str(coord)[:-1])
        elif str(coord)[-1] == 'S' or str(coord)[-1] == 'W': # removes the letter from '48.2S' and puts a negative
            return float(str(coord)[:-1]) * -1
        else:
            return coord
    else:
        return coord