[1]:
!test -f temp.bufr || wget https://get.ecmwf.int/repository/test-data/pdbufr/test-data/sample-data/temp.bufr
Generic: radiosonde data
[2]:
import pdbufr
The input BUFR data contains radiosonde observations. Each message represents a given station and contains vertical profiles on a set of pressure levels.
In this notebook we read this data with the generic reader, which is the default reader.
Example 1
Getting the WMO station ID and location for each message. Notice that since “WMO_station_id” is a computed key it appears as the last column in the resulting dataframe.
[3]:
df = pdbufr.read_bufr("temp.bufr",
columns=("WMO_station_id", "latitude", "longitude"))
df.head()
[3]:
| latitude | longitude | WMO_station_id | |
|---|---|---|---|
| 0 | 58.47 | -78.08 | 71907 |
| 1 | 53.75 | -73.67 | 71823 |
| 2 | -90.00 | 0.00 | 89009 |
| 3 | 18.43 | -69.88 | 78486 |
| 4 | 21.98 | -159.33 | 91165 |
Example 2
Extracting the same data but only for a given station.
[4]:
df = pdbufr.read_bufr("temp.bufr",
columns=("WMO_station_id", "latitude", "longitude"),
filters={"WMO_station_id": 71907},)
df
[4]:
| latitude | longitude | WMO_station_id | |
|---|---|---|---|
| 0 | 58.47 | -78.08 | 71907 |
Example 3
Getting temperature profiles for two stations.
[5]:
df = pdbufr.read_bufr("temp.bufr",
columns=("WMO_station_id", "data_datetime", "pressure", "airTemperature"),
filters={"WMO_station_id": [71823, 71907]})
df.head()
[5]:
| pressure | airTemperature | data_datetime | WMO_station_id | |
|---|---|---|---|---|
| 0 | 100300.0 | 258.3 | 2008-12-08 12:00:00 | 71907 |
| 1 | 100000.0 | 259.7 | 2008-12-08 12:00:00 | 71907 |
| 2 | 99800.0 | 261.1 | 2008-12-08 12:00:00 | 71907 |
| 3 | 99100.0 | 261.7 | 2008-12-08 12:00:00 | 71907 |
| 4 | 92500.0 | 258.1 | 2008-12-08 12:00:00 | 71907 |
[6]:
df.tail()
[6]:
| pressure | airTemperature | data_datetime | WMO_station_id | |
|---|---|---|---|---|
| 44 | 30000.0 | 218.9 | 2008-12-08 12:00:00 | 71823 |
| 45 | 29700.0 | 218.9 | 2008-12-08 12:00:00 | 71823 |
| 46 | 25000.0 | 221.1 | 2008-12-08 12:00:00 | 71823 |
| 47 | 23200.0 | 223.1 | 2008-12-08 12:00:00 | 71823 |
| 48 | 20500.0 | 221.5 | 2008-12-08 12:00:00 | 71823 |
Example 4
Extracting temperature profiles for a given station only on standard pressure levels when temperature >= -30 C.
[7]:
df = pdbufr.read_bufr("temp.bufr",
columns=("WMO_station_id", "data_datetime", "pressure", "airTemperature"),
filters={"WMO_station_id": 71907,
"verticalSoundingSignificance": 32,
"airTemperature": slice(243.16, None)})
df
[7]:
| pressure | airTemperature | data_datetime | WMO_station_id | |
|---|---|---|---|---|
| 0 | 100000.0 | 259.7 | 2008-12-08 12:00:00 | 71907 |
| 1 | 92500.0 | 258.1 | 2008-12-08 12:00:00 | 71907 |
| 2 | 85000.0 | 253.1 | 2008-12-08 12:00:00 | 71907 |
Example 5
Extracting temperature, dewpoint and wind values on 500 hPa in the tropics:
[8]:
df = pdbufr.read_bufr("temp.bufr",
columns=("latitude", "longitude", "pressure", "airTemperature", "dewpointTemperature", "windDirection", "windSpeed"),
filters={"latitude": slice(-20, 20), "pressure": 50000})
df
[8]:
| latitude | longitude | pressure | airTemperature | dewpointTemperature | windDirection | windSpeed | |
|---|---|---|---|---|---|---|---|
| 0 | 18.43 | -69.88 | 50000.0 | 267.5 | 247.5 | 275 | 4.0 |
| 1 | 18.03 | -63.12 | 50000.0 | 267.5 | 244.5 | 340 | 5.0 |
| 2 | 13.47 | 144.78 | 50000.0 | 270.3 | 249.3 | 110 | 12.0 |
| 3 | 7.08 | 171.38 | 50000.0 | 268.9 | 226.9 | 220 | 6.0 |
| 4 | 7.45 | 151.83 | 50000.0 | 269.9 | 249.9 | 50 | 18.0 |
| ... | ... | ... | ... | ... | ... | ... | ... |
| 69 | -10.17 | 123.67 | 50000.0 | 269.5 | 267.0 | 70 | 11.0 |
| 70 | -1.18 | 136.12 | 50000.0 | 264.1 | 262.6 | 80 | 8.0 |
| 71 | -2.17 | 106.13 | 50000.0 | 268.9 | 263.9 | 135 | 6.0 |
| 72 | 2.83 | -60.70 | 50000.0 | 267.5 | 258.5 | 90 | 8.0 |
| 73 | -3.67 | -69.67 | 50000.0 | 266.7 | 266.6 | 350 | 4.0 |
74 rows × 7 columns