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]:
#start='2012-06-30T09:30:00Z'
#stop='2012-06-30T15:00:00Z'
start='2013-06-13T16:30:00Z'
stop='2013-06-13T23:00:00Z'

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=start,stop=stop)

#    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-13T16:30:00Z/2013-06-13T23: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-13T16:30:00Z/2013-06-13T23: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-13T16:30:00Z/2013-06-13T23: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-13T16:30:00Z/2013-06-13T23: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-13T16:30:00Z/2013-06-13T23: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-13T16:30:00Z/2013-06-13T23: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-13T16:30:00Z/2013-06-13T23: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-13T16:30:00Z/2013-06-13T23: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-13T16:30:00Z/2013-06-13T23: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-13T16:30:00Z/2013-06-13T23: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=(14,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=start,stop=stop)


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-13T16:30:00Z/2013-06-13T23:00:00Z

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


Out[11]:
<matplotlib.axes.AxesSubplot at 0x32e1050>

In [12]:
df_event1=df_dart['2013-6-13 16:45:00':'2013-6-13 17:45:00']
df_event1['sea_floor_depth_below_sea_surface (m)'].plot(figsize=(14,6))


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

In [13]:
df_event2=df_dart['2013-6-13 19:45:00':'2013-6-13 20:45:00']
df_event2['sea_floor_depth_below_sea_surface (m)'].plot(figsize=(14,6))


Out[13]:
<matplotlib.axes.AxesSubplot at 0x3706c50>

In [13]: