get_station_metadata()

Get metadata for all weather stations.

Usage

Source

get_station_metadata(
    *,
    include_timezone=True,
    force_refresh=False,
)

Downloads and parses the ISD history file containing information about all weather stations in the database.

Parameters

include_timezone: bool = True

Whether to look up timezone names based on station coordinates. This adds a tz_name column. Default is True.

force_refresh: bool = False
Force re-download of station data even if cached. Default is False.

Returns

pl.DataFrame
A DataFrame with station metadata.

Columns

The returned DataFrame contains the following columns:

  • id: Station ID (USAF-WBAN format)
  • usaf: USAF station identifier
  • wban: WBAN station identifier
  • name: Station name
  • country_code: ISO 3166-1 alpha-2 country code
  • country: Country name
  • state: US state code (if applicable)
  • icao: ICAO identifier
  • lat: Latitude in degrees
  • lon: Longitude in degrees
  • elev: Elevation in meters
  • begin_date: Date of first available data
  • end_date: Date of last available data
  • tz_name: Timezone name (only included if include_timezone=True)

Examples

Get metadata for all weather stations:

import weathervault as wv
stations = wv.get_station_metadata()
stations.head()
shape: (5, 14)
idusafwbannamecountry_codecountrystateicaolatlonelevbegin_dateend_datetz_name
strstrstrstrstrstrstrstrf64f64f64datedatestr
"007018-99999""007018""99999""WXPOD 7018"nullnull""""0.00.07018.02011-03-092013-07-30"Etc/GMT"
"007026-99999""007026""99999""WXPOD 7026""AF""Afghanistan"""""0.00.07026.02012-07-132017-08-22"Etc/GMT"
"007070-99999""007070""99999""WXPOD 7070""AF""Afghanistan"""""0.00.07070.02014-09-232015-09-26"Etc/GMT"
"008260-99999""008260""99999""WXPOD8270"nullnull""""0.00.00.02005-01-012012-07-31"Etc/GMT"
"008268-99999""008268""99999""WXPOD8278""AF""Afghanistan"""""32.9565.5671156.72010-05-192012-03-23"Asia/Kabul"