NDBC Latest Data Request

This example shows how to use siphon’s simplewebswervice support query the most recent observations from all of the NDBC buoys at once.

import cartopy.crs as ccrs
import cartopy.feature as cfeature
import matplotlib.pyplot as plt

from siphon.simplewebservice.ndbc import NDBC

Get a pandas data frame of all of the observations

station latitude longitude wind_direction wind_speed wind_gust wave_height dominant_wave_period average_wave_period dominant_wave_direction pressure 3hr_pressure_tendency air_temperature water_temperature dewpoint visibility water_level_above_mean time
0 13001 12.00 -23.000 30.0 7.9 9.4 NaN NaN NaN NaN 1013.2 NaN 22.4 24.2 NaN NaN NaN 2025-04-03 15:00:00+00:00
1 15009 0.00 -3.051 20.0 1.7 NaN NaN NaN NaN NaN 1009.4 NaN 26.7 29.4 NaN NaN NaN 2025-04-03 15:00:00+00:00
2 1801593 37.35 -122.840 340.0 9.7 11.4 2.7 10.0 NaN NaN 1016.0 NaN 10.7 11.8 7.6 NaN NaN 2025-04-03 15:30:00+00:00
3 22101 37.24 126.020 260.0 4.0 NaN 0.0 5.0 NaN NaN NaN NaN 6.0 7.0 NaN NaN NaN 2025-04-03 16:00:00+00:00
4 22102 34.79 125.780 0.0 2.0 NaN 0.5 6.0 NaN NaN NaN NaN 7.2 8.2 NaN NaN NaN 2025-04-03 16:00:00+00:00


In this case I’m going to drop buoys that do not have water temperature measurements.

df.dropna(subset=['water_temperature'], inplace=True)

Let’s make a simple plot of the buoy positions and color by water temperature

proj = ccrs.LambertConformal(central_latitude=45., central_longitude=-100.,
                             standard_parallels=[30, 60])

fig = plt.figure(figsize=(17., 11.))
ax = plt.axes(projection=proj)
ax.coastlines('50m', edgecolor='black')
ax.add_feature(cfeature.OCEAN.with_scale('50m'))
ax.add_feature(cfeature.LAND.with_scale('50m'))
ax.set_extent([-85, -75, 25, 30], ccrs.PlateCarree())

ax.scatter(df['longitude'], df['latitude'], c=df['water_temperature'],
           transform=ccrs.PlateCarree())

plt.show()
latest request

Total running time of the script: (0 minutes 10.043 seconds)

Gallery generated by Sphinx-Gallery