lair.soundings.download_sounding#

lair.soundings.download_sounding(station, date, dst=None)[source]#

Download an upper air sounding from the Wyoming archive.

Parameters:
  • station (str) – The 3-letter station identifier (e.g. 'SLC') passed to the Wyoming service via siphon. Also used as the file-name prefix.

  • date (datetime) – The date and time. A time without a time zone follows the UTC rule; one with a time zone is converted to UTC. Wyoming reads the time as UTC, and the file is named for the UTC hour (SLC_2024011512.csv for 12 UTC).

  • dst (str) – The destination directory. Defaults to $LAIR_SOUNDING_DIR/<station>.

Returns:

str – The path to the downloaded sounding data.

Raises:

ValueError – If the unit siphon reports for speed, u_wind or v_wind is missing or is not a speed unit that pint knows. No file is written.

Return type:

str

Notes

Every file is saved in the units of Sounding.units, whatever Wyoming sent. Wyoming sends the winds in m/s today and sent knots before, so speed, u_wind and v_wind are converted to knots from the unit siphon reports for each. Wyoming no longer sends the station’s elevation, so it is saved as the height of the first level, the ground. pw and station_number are saved only if Wyoming sends them, which it no longer does. A file that is already in dst is not downloaded again or changed.

See also

download_soundings

Every sounding of a period.

Sounding

Reads the file.

Examples

The 12 UTC sounding of Salt Lake City on 2024-01-15, into a folder of your own. It needs the network, so it is not run when the docs build:

>>> import datetime as dt
>>> from lair.soundings import download_sounding
>>> download_sounding(
...     "SLC", dt.datetime(2024, 1, 15, 12), dst="soundings/SLC"
... )
'soundings/SLC/SLC_2024011512.csv'