def validate_location(location):  
if isinstance(location, np.ndarray)or (pd is not None and isinstance(location, pd.DataFrame)):<EOL><INDENT>location = np.squeeze(location).tolist()<EOL><DEDENT>if not hasattr(location, '<STR_LIT>'):<EOL><INDENT>raise TypeError('<STR_LIT>'<EOL>'<STR_LIT>'<EOL>'<STR_LIT>'.format(location, type(location)))<EOL><DEDENT>if len(location) != <NUM_LIT:2>:<EOL><INDENT>raise ValueError('<STR_LIT>'<EOL>'<STR_LIT>'.format(location))<EOL><DEDENT>try:<EOL><INDENT>coords = (location[<NUM_LIT:0>], location[<NUM_LIT:1>])<EOL><DEDENT>except (TypeError, KeyError):<EOL><INDENT>raise TypeError('<STR_LIT>'<EOL>'<STR_LIT>'<EOL>.format(location, type(location)))<EOL><DEDENT>for coord in coords:<EOL><INDENT>try:<EOL><INDENT>float(coord)<EOL><DEDENT>except (TypeError, ValueError):<EOL><INDENT>raise ValueError('<STR_LIT>'<EOL>'<STR_LIT>'<EOL>.format(coord, type(coord)))<EOL><DEDENT>if math.isnan(float(coord)):<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT><DEDENT>return [float(x) for x in coords]<EOL>
Validate a single lat/lon coordinate pair and convert to a list

    Validate that location:
    * is a sized variable
    * with size 2
    * allows indexing (i.e. has an ordering)
    * where both values are floats (or convertible to float)
    * and both values are not NaN

    Returns
    -------
    list[float, float]