Experimenting with NOAA NDBC Buoy Data from ERDDAP

Exploring use of Python to formulate ERDDAP image and data REST requests and process the responses.


In [1]:
from IPython.display import IFrame
IFrame('http://www.neracoos.org/erddap/tabledap/A01_met_all.graph', width='100%', height=450)


Out[1]:

In [2]:
##Initialize

In [3]:
import urllib2
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
%matplotlib inline

Obtain data from ERDDAP


In [4]:
start='2014-07-01T00:00:00Z'
stop='2014-07-11T00:00:00Z'

In [5]:
# Construct URL for CSV data:
url='http://www.neracoos.org/erddap/tabledap/A01_met_all\
.csv?station,time,\
air_temperature,wind_speed,wind_direction,\
longitude,latitude\
&time>=%s&time<=%s' % (start,stop)

In [6]:
# Load the CSV data directly into Pandas
df = pd.read_csv(url,index_col='time',parse_dates=True,skiprows=[1])  # skip the units row

In [7]:
# List last ten records
df.tail(10)


Out[7]:
station air_temperature wind_speed wind_direction longitude latitude
time
2014-07-10 22:30:00 A01 21.04 1.151 159.7 -70.56606 42.518253
2014-07-10 22:40:00 A01 21.51 0.796 167.0 -70.56606 42.518253
2014-07-10 22:50:00 A01 21.51 1.826 195.3 -70.56606 42.518253
2014-07-10 23:00:00 A01 21.82 1.493 215.3 -70.56606 42.518253
2014-07-10 23:10:00 A01 22.10 1.455 197.6 -70.56606 42.518253
2014-07-10 23:20:00 A01 20.45 2.547 162.3 -70.56606 42.518253
2014-07-10 23:30:00 A01 19.97 3.316 168.3 -70.56606 42.518253
2014-07-10 23:40:00 A01 19.81 3.094 179.3 -70.56606 42.518253
2014-07-10 23:50:00 A01 19.51 2.593 179.5 -70.56606 42.518253
2014-07-11 00:00:00 A01 19.21 2.446 177.6 -70.56606 42.518253

In [8]:
df[['wind_speed','air_temperature']].plot(figsize=(12,4));



In [8]: