Try this notebook in Binder.

[1]:
!test -f syn_new.bufr || wget https://get.ecmwf.int/repository/test-data/pdbufr/test-data/syn_new.bufr

Synop: overview

[2]:
import pdbufr

The input BUFR data contains three Synop observations. In this notebook we will read this file with the synop reader, which uses pre-defined parameters instead of the ecCodes BUFR keys. Parameter is a high-level concept in pdbufr enabling data extraction without knowing the actual BUFR encoding and allowing more tailor-made access to specific data types.

The default settings

By default the “stnid”, “lat”, “lon”, “elevation”, “time” (see station parameters for details) and the default observed parameters are extracted.

[3]:
df = pdbufr.read_bufr("syn_new.bufr", reader="synop")
[4]:
df.T
[4]:
0 1 2
stnid 91948 11766 56257
lat -23.13017 49.77722 30.0
lon -134.96533 17.54194 100.27
elevation 91.0 748.1 3950.0
time 2020-03-15 00:00:00 2020-03-15 00:00:00 2020-03-15 00:00:00
t2m 300.45 269.25 276.35
rh2m 73 65 37
td2m 295.15 263.55 263.05
wind10m_speed 1.6 4.0 2.5
wind10m_dir 100 60 229
max_wgust_speed_10min 5.3 NaN NaN
max_wgust_dir_10min 110.0 NaN NaN
max_wgust_speed_60min 5.3 NaN NaN
max_wgust_dir_60min 110.0 NaN NaN
max_wgust_speed_360min 7.6 NaN NaN
max_wgust_dir_360min 130.0 NaN NaN
max_wgust_speed_nan NaN NaN NaN
max_wgust_dir_nan NaN NaN NaN
max_wgust_speed_720min NaN NaN 8.9
max_wgust_dir_720min NaN NaN 193.0
present_weather 2 508 0
past_weather_1_1h 0.0 NaN NaN
past_weather_2_1h 0.0 NaN NaN
past_weather_1_6h 0.0 10.0 NaN
past_weather_2_6h 0.0 10.0 NaN
past_weather_1_12h NaN NaN 0.0
past_weather_2_12h NaN NaN 0.0
precipitation_1h 0.0 0.0 NaN
precipitation_3h 0.0 NaN NaN
precipitation_6h 0.0 0.0 0.0
precipitation_12h 0.0 NaN 0.0
precipitation_24h 0.0 NaN 0.0
min_t2m_60min NaN NaN NaN
min_t2m_0h 296.45 NaN 272.65
max_t2m_60min 300.75 NaN NaN
max_t2m_nan NaN NaN NaN
max_t2m_0h NaN NaN 288.35
mslp 101320.0 NaN 100440.0
pressure 100310.0 93680.0 63030.0
cloud_cover 25.0 NaN 0.0
snow_depth NaN NaN 0.0
visibility NaN 30000.0 30000.0

Using parameter groups

[5]:
df = pdbufr.read_bufr("syn_new.bufr", reader="synop", columns="station")
[6]:
df.T
[6]:
0 1 2
stnid 91948 11766 56257
lat -23.13017 49.77722 30.0
lon -134.96533 17.54194 100.27
elevation 91.0 748.1 3950.0
time 2020-03-15 00:00:00 2020-03-15 00:00:00 2020-03-15 00:00:00
[7]:
df = pdbufr.read_bufr("syn_new.bufr", reader="synop", columns="location")
[8]:
df.T
[8]:
0 1 2
lat -23.13017 49.77722 30.00
lon -134.96533 17.54194 100.27
[9]:
df = pdbufr.read_bufr("syn_new.bufr", reader="synop", columns="geometry")
[10]:
df.T
[10]:
0 1 2
lat -23.13017 49.77722 30.00
lon -134.96533 17.54194 100.27
elevation 91.00000 748.10000 3950.00

Using individual parameters

[11]:
df = pdbufr.read_bufr("syn_new.bufr", reader="synop", columns="t2m")
[12]:
df.T
[12]:
0 1 2
t2m 300.45 269.25 276.35
[13]:
df = pdbufr.read_bufr("syn_new.bufr", reader="synop", columns=["station", "t2m", "td2m", "total_sunshine"])
[14]:
df.T
[14]:
0 1 2
stnid 91948 11766 56257
lat -23.13017 49.77722 30.0
lon -134.96533 17.54194 100.27
elevation 91.0 748.1 3950.0
time 2020-03-15 00:00:00 2020-03-15 00:00:00 2020-03-15 00:00:00
t2m 300.45 269.25 276.35
td2m 295.15 263.55 263.05
total_sunshine_1h 39.0 NaN NaN
total_sunshine_24h 535.0 486.0 NaN

Adding level columns

[15]:
df = pdbufr.read_bufr("syn_new.bufr", reader="synop",
                      columns=["station", "t2m", "td2m"],
                      level_columns=True)
[16]:
df.T
[16]:
0 1 2
stnid 91948 11766 56257
lat -23.13017 49.77722 30.0
lon -134.96533 17.54194 100.27
elevation 91.0 748.1 3950.0
time 2020-03-15 00:00:00 2020-03-15 00:00:00 2020-03-15 00:00:00
t2m 300.45 269.25 276.35
t2m_level 1.5 2.0 1.5
td2m 295.15 263.55 263.05
td2m_level 1.5 2.0 1.5

Adding units columns

[17]:
df = pdbufr.read_bufr("syn_new.bufr", reader="synop",
                      columns=["station", "t2m", "td2m"],
                      units_columns=True)
[18]:
df.T
[18]:
0 1 2
stnid 91948 11766 56257
lat -23.13017 49.77722 30.0
lat_units deg deg deg
lon -134.96533 17.54194 100.27
lon_units deg deg deg
elevation 91.0 748.1 3950.0
elevation_units m m m
time 2020-03-15 00:00:00 2020-03-15 00:00:00 2020-03-15 00:00:00
t2m 300.45 269.25 276.35
t2m_units K K K
td2m 295.15 263.55 263.05
td2m_units K K K
[ ]: