add_station_lat_lon#

metpy.io.add_station_lat_lon(df, stn_var=None)[source]#

Lookup station information to add the station latitude and longitude to the DataFrame.

This function will add two columns to the DataFrame (‘latitude’ and ‘longitude’) after looking up all unique station identifiers available in the DataFrame.

Parameters:
  • df (pandas.DataFrame) – The DataFrame that contains the station observations

  • stn_var (str, optional) – The string of the variable name that represents the station in the DataFrame. If not provided, ‘station’, ‘stid’, and ‘station_id’ are tried in that order.

Returns:

  • pandas.DataFrame that contains original Dataframe now with the latitude and longitude

  • values for each location found in station_info.