Skip to content

NDBC

Seebuoy provide's three main pieces of functionality for interacting with the NDBC:

  1. Stations: Information about all NDBC stations, buoys, and gliders.
  2. Available data: What data is available for each buoy.
  3. Get data: Retrieve data for the given buoy and dataset.

Stations

The get information about NDBC's 1800+ stations you can use the stations method:

from seebuoy import NBDC

ndbc = NDBC()

df_buoys = ndbc.stations()

In addition to the data available from NDBC, seebuoy also adds on the closest cities, states, and the owner of the buoy. If you just want the raw data you can set the following arguements to false:

df_buoys = ndbc.stations(closest_cities=False, owners=False)

If you already know the buoy you are looking for, you can also pass that as a keyword argument:

df_buoys = ndbc.stations(station_id="41002")

Available Data

Not all buoys have the same data available and some data that NDBC provides is from ADCPs. For this reason, it is useful to see what data is available for what buoys. You can access this through the available_data method below.

df_available = ndbc.available_data()

This will return the available data for all buoys for the default dataset. If you want to list all available data, you can use pass dataset="all":

df_available = ndbc.available_data(dataset="all")

You can also subset the data to specific buoy by passing in a station_id:

df_available = ndbc.available_data(dataset="oceanographic", station_id="41002")

Get Data

Finally when you are ready to retrieve data, you can use the get_data method:

station_id = "41002"
ndbc.get_data(station_id)

Similarly you can also specify a dataset you are interested in pulling:

ndbc.get_data(station_id, dataset="oceanographic")

The get data function also renames columns by default. For example, in the raw files from NDBC they pass "wvht" which maps to "wave_height". If you want the raw headers from the files, you can pass rename_cols=False:

ndbc.get_data(station_id, dataset="oceanographic", rename_cols=False)

Historical Data

By default, seebuoy will default to only pulling real time data. If you want to pull historical data as well, you can initialize the class with timeframe="historical".

from seebuoy import NBDC

ndbc = NDBC(timeframe="historical")

This pulls all available data, so be kind the NDBC servers. For example, to get all data going back to 1973 for buoy 41002, you can simply call the following:

df_avail = ndbc.available_data(station_id="41002")
df_data = ndbc.get_station("41002")

The above examples retrieves close to a half million observations. You can view the jupyter notebook for this example here.

Reference

NDBC

Main interface to the National Data Buoy Center.

NDBC provides the following datasets. Note that each station has a subset of this data and not all data is continuous. Buoys can go down from time to time.

  • adcp: Acoustic Doppler Current Profiler Current Year Historical Data [adcp]
  • adcp2: Acoustic Doppler Current Profiler Current Year Historical Data [adcp2]
  • continuous_wind: Continuous Winds Current Year Historical Data [cwind]
  • water_col_height: Water Column Height (DART) Current Year Historical Data [dart]
  • mmbcur: No description available [mmbcur]
  • oceanographic: Oceanographic Current Year Historical Data [ocean]
  • rain_hourly: Hourly Rain Current Year Historical Data [rain]
  • rain_10_min: 10 Minute Rain Current Year Historical Data [rain10]
  • rain_24_hr: 24 Hour Rain Current Year Historical Data [rain24]
  • solar_radiation: Solar Radiation Current Year Historical Data [srad]
  • standard: Standard Meteorological Current Year Historical Data [stdmet]
  • supplemental: Supplemental Measurements Current Year Historical Data [supl]
  • raw_spectral: Raw Spectral Wave Current Year Historical Data [swden]
  • spectral_alpha1: Spectral Wave Current Year Historical Data (alpha1) [swdir]
  • spectral_alpha2: Spectral Wave Current Year Historical Data (alpha2) [swdir2]
  • spectral_r1: Spectral Wave Current Year Historical Data (r1) [swr1]
  • spectral_r2: Spectral Wave Current Year Historical Data (r2) [swr2]
  • tide: Tide Current Year Historical Data [wlevel]

__init__(timeframe='real_time')

Initialize NDBC for a specific time frame.

Parameters:

Name Type Description Default
timeframe str

The timeframe for which to pull data. Can be 'real_time', 'historical', 'historical_only', 'current_year_only'.

'real_time'

stations(station_id=None, closest_cities=True, owners=True)

Pull data for all NDBC stations.

Parameters:

Name Type Description Default
station_id str

The id of the station.

None
closest_cities bool

Joins on the closest cities and states.

True
owners bool

Joins on the owners of the buoys.

True

Returns:

Type Description

Pandas dataframe of station information.

available_data(dataset='standard', station_id=None)

Lists the available data for the given parameters.

Parameters:

Name Type Description Default
dataset str

The dataset to pull. Can be a specific dataset or pass "all" to pull all available data.

'standard'
station_id str

The station_id to return. If None, returns data for all stations.

None

Returns:

Type Description

Pandas dataframe of availble data.

get_data(station_id, dataset='standard', rename_cols=True, drop_duplicates=True)

Pull data for a single station.

Parameters:

Name Type Description Default
station_id str

The station_id to for which to pull data. dataset (str): The dataset to pull.

required
rename_cols bool

Rename the columns to more readable titles.

True
drop_duplicates bool

If pulling historical data, there can be duplicate records in the current year and real time datasets. This argument only keeps one

True

Returns:

Type Description

Pandas dataframe of data for the given station.