lair.soundings.Sounding#
- class lair.soundings.Sounding(path)[source]#
Upper air sounding data.
One sounding file, as
download_sounding()saves it: a CSV named<station>_<YYYYmmddHH>.csvfor the UTC hour of the sounding, one row per level, with the station’s attributes repeated in columns of their own.- Parameters:
path (str) – The path to the sounding file. The station and time are read from its name.
- Variables:
path (str) – The path to the sounding data.
filename (str) – The filename of the sounding data.
station (str) – The station identifier.
time (datetime) – The date and time of the sounding.
data (pd.DataFrame) – The sounding data, one row per level in the order of the file. Heights that wrap at 10 km are unwrapped as the file is read.
units (dict[str, str]) – The unit of each column of
dataand of each station attribute, keyed by name:pressurein hPa;heightandelevationin meters;temperatureanddewpointin degrees Celsius (degC);direction,latitudeandlongitudein degrees;speed,u_windandv_windin knots;pwin millimeters.download_sounding()saves every file in these units.
See also
get_soundingsA station’s soundings for a period, on the same heights.
Examples
A made-up sounding with two levels, saved as Wyoming’s are:
>>> import pathlib >>> import tempfile >>> import pandas as pd >>> from lair.soundings import Sounding >>> folder = pathlib.Path(tempfile.mkdtemp()) >>> levels = pd.DataFrame( ... { ... "pressure": [870.0, 700.0], ... "height": [1289.0, 3000.0], ... "temperature": [-5.0, -12.0], ... "dewpoint": [-8.0, -20.0], ... "direction": [180.0, 270.0], ... "speed": [5.0, 10.0], ... "u_wind": [0.0, 10.0], ... "v_wind": [5.0, 0.0], ... "station": "SLC", ... "time": "2024-01-15 12:00", ... "elevation": 1289.0, ... } ... ) >>> levels.to_csv(folder / "SLC_2024011512.csv", index=False) >>> sounding = Sounding(str(folder / "SLC_2024011512.csv")) >>> sounding.station, sounding.time, float(sounding.elevation) ('SLC', datetime.datetime(2024, 1, 15, 12, 0), 1289.0) >>> list(sounding.data.columns) ['pressure', 'height', 'temperature', 'dewpoint', 'direction', 'speed', 'u_wind', 'v_wind']
Methods
|
Interpolate sounding data to regular height levels. |
|
Plot the sounding (not implemented yet). |