Compare 1-min Water Levels from Tsunami Capable Tide Stations

using NOAA CO-OPS SOS Rest Service + Pandas.


In [1]:
import pandas as pd

In [2]:
from IPython.core.display import HTML
HTML('<iframe src=http://tidesandcurrents.noaa.gov/tsunami/ width=900 height=600></iframe>')


Out[2]:

In [3]:
def coops2df(sta='8447930',start='2013-06-13T18:30:00Z',stop='2013-06-13T23:00:00Z'):
    url='http://opendap.co-ops.nos.noaa.gov/ioos-dif-sos/SOS?\
request=GetObservation&service=SOS&responseFormat=text/csv&version=1.0.0&\
offering=urn:ioos:station:NOAA.NOS.CO-OPS:%s&\
observedProperty=water_surface_height_above_reference_datum&\
dataType=PreliminaryOneMinute&\
eventTime=%s/%s' % (sta,start,stop)
    df = pd.read_csv(url,index_col='date_time',parse_dates=True)  
    print url
    return df

In [4]:
stas = {}
stas['montauk']='8510560'
stas['woods hole']='8447930'
stas['nantucket']='8449130'
stas['newport']='8452660'
stas['atlantic city']='8534720'
stas['sandy hook']='8531680'
stas['quonset']='8454049'
stas['mystic']='8465705'
stas['battery']='8518750'
stas['lewes']='8557380'
df={}
for sta_name,sta_id in stas.iteritems():
    df[sta_name]=coops2df(sta=sta_id,start='2013-06-13T17:30:00Z',stop='2013-06-13T22:00:00Z')
#     df[sta_name]=coops2df(sta=sta_id,start='2013-04-11T03:00:00Z',stop='2013-04-11T09:00:00Z')


http://opendap.co-ops.nos.noaa.gov/ioos-dif-sos/SOS?request=GetObservation&service=SOS&responseFormat=text/csv&version=1.0.0&offering=urn:ioos:station:NOAA.NOS.CO-OPS:8447930&observedProperty=water_surface_height_above_reference_datum&dataType=PreliminaryOneMinute&eventTime=2013-06-13T17:30:00Z/2013-06-13T22:00:00Z
http://opendap.co-ops.nos.noaa.gov/ioos-dif-sos/SOS?request=GetObservation&service=SOS&responseFormat=text/csv&version=1.0.0&offering=urn:ioos:station:NOAA.NOS.CO-OPS:8518750&observedProperty=water_surface_height_above_reference_datum&dataType=PreliminaryOneMinute&eventTime=2013-06-13T17:30:00Z/2013-06-13T22:00:00Z
http://opendap.co-ops.nos.noaa.gov/ioos-dif-sos/SOS?request=GetObservation&service=SOS&responseFormat=text/csv&version=1.0.0&offering=urn:ioos:station:NOAA.NOS.CO-OPS:8465705&observedProperty=water_surface_height_above_reference_datum&dataType=PreliminaryOneMinute&eventTime=2013-06-13T17:30:00Z/2013-06-13T22:00:00Z
http://opendap.co-ops.nos.noaa.gov/ioos-dif-sos/SOS?request=GetObservation&service=SOS&responseFormat=text/csv&version=1.0.0&offering=urn:ioos:station:NOAA.NOS.CO-OPS:8534720&observedProperty=water_surface_height_above_reference_datum&dataType=PreliminaryOneMinute&eventTime=2013-06-13T17:30:00Z/2013-06-13T22:00:00Z
http://opendap.co-ops.nos.noaa.gov/ioos-dif-sos/SOS?request=GetObservation&service=SOS&responseFormat=text/csv&version=1.0.0&offering=urn:ioos:station:NOAA.NOS.CO-OPS:8449130&observedProperty=water_surface_height_above_reference_datum&dataType=PreliminaryOneMinute&eventTime=2013-06-13T17:30:00Z/2013-06-13T22:00:00Z
http://opendap.co-ops.nos.noaa.gov/ioos-dif-sos/SOS?request=GetObservation&service=SOS&responseFormat=text/csv&version=1.0.0&offering=urn:ioos:station:NOAA.NOS.CO-OPS:8452660&observedProperty=water_surface_height_above_reference_datum&dataType=PreliminaryOneMinute&eventTime=2013-06-13T17:30:00Z/2013-06-13T22:00:00Z
http://opendap.co-ops.nos.noaa.gov/ioos-dif-sos/SOS?request=GetObservation&service=SOS&responseFormat=text/csv&version=1.0.0&offering=urn:ioos:station:NOAA.NOS.CO-OPS:8510560&observedProperty=water_surface_height_above_reference_datum&dataType=PreliminaryOneMinute&eventTime=2013-06-13T17:30:00Z/2013-06-13T22:00:00Z
http://opendap.co-ops.nos.noaa.gov/ioos-dif-sos/SOS?request=GetObservation&service=SOS&responseFormat=text/csv&version=1.0.0&offering=urn:ioos:station:NOAA.NOS.CO-OPS:8454049&observedProperty=water_surface_height_above_reference_datum&dataType=PreliminaryOneMinute&eventTime=2013-06-13T17:30:00Z/2013-06-13T22:00:00Z
http://opendap.co-ops.nos.noaa.gov/ioos-dif-sos/SOS?request=GetObservation&service=SOS&responseFormat=text/csv&version=1.0.0&offering=urn:ioos:station:NOAA.NOS.CO-OPS:8557380&observedProperty=water_surface_height_above_reference_datum&dataType=PreliminaryOneMinute&eventTime=2013-06-13T17:30:00Z/2013-06-13T22:00:00Z
http://opendap.co-ops.nos.noaa.gov/ioos-dif-sos/SOS?request=GetObservation&service=SOS&responseFormat=text/csv&version=1.0.0&offering=urn:ioos:station:NOAA.NOS.CO-OPS:8531680&observedProperty=water_surface_height_above_reference_datum&dataType=PreliminaryOneMinute&eventTime=2013-06-13T17:30:00Z/2013-06-13T22:00:00Z

In [5]:
panel = pd.Panel(df)

In [6]:
slice = panel.minor_xs('water_surface_height_above_reference_datum (m)')

In [7]:
slice[['woods hole','atlantic city','montauk']].plot(figsize=(20,6),title='East Coast water levels (m)');



In [8]:
# NDBC Rest
def ndbc2df(sta='8447930',start='2013-06-13T18:30:00Z',stop='2013-06-13T23:00:00Z'):
    url='http://sdf.ndbc.noaa.gov/sos/server.php?request=GetObservation&service=SOS&version=1.0.0&\
offering=urn:ioos:station:wmo:%s&\
observedproperty=sea_floor_depth_below_sea_surface&responseformat=text/csv&\
eventtime=%s/%s' % (sta,start,stop)
    df = pd.read_csv(url,index_col='date_time',parse_dates=True)  
    print url
    return df

In [9]:
# Dart Buoy in 1500m water, northeast of Hudson Canyon
sta_id='44402'

In [10]:
df_dart=ndbc2df(sta=sta_id,start='2013-06-13T13:00:00Z',stop='2013-06-13T23:00:00Z')


http://sdf.ndbc.noaa.gov/sos/server.php?request=GetObservation&service=SOS&version=1.0.0&offering=urn:ioos:station:wmo:44402&observedproperty=sea_floor_depth_below_sea_surface&responseformat=text/csv&eventtime=2013-06-13T13:00:00Z/2013-06-13T23:00:00Z

In [11]:
df_dart.head()


Out[11]:
&ltclass 'pandas.core.frame.DataFrame'>
DatetimeIndex: 5 entries, 2013-06-13 13:00:00 to 2013-06-13 14:00:00
Data columns (total 6 columns):
station_id                               5  non-null values
sensor_id                                5  non-null values
latitude (degree)                        5  non-null values
longitude (degree)                       5  non-null values
sea_floor_depth_below_sea_surface (m)    5  non-null values
averaging interval (s)                   5  non-null values
dtypes: float64(3), int64(1), object(2)

In [12]:
df_dart['sea_floor_depth_below_sea_surface (m)'].plot(figsize=(20,6))


Out[12]:
<matplotlib.axes.AxesSubplot at 0x30d8e50>

In [12]: