In [1]:
import urllib
from owslib.sos import SensorObservationService

In [2]:
sos_endpoint = 'http://opendap.co-ops.nos.noaa.gov/ioos-dif-sos/SOS?service=SOS&request=GetCapabilities&version=1.0.0'
coops = SensorObservationService(sos_endpoint)

In [14]:
coops.identification.title


Out[14]:
'NOAA.NOS.CO-OPS SOS'

In [15]:
coops.get_operation_by_name('getobservation').parameters['responseFormat']['values']


Out[15]:
['text/csv',
 'text/tab-separated-values',
 'text/xml;schema="ioos/0.6.1"',
 'application/ioos+xml;version=0.6.1',
 'application/vnd.google-earth.kml+xml']

In [16]:
response = coops.get_observation(offerings=['urn:ioos:station:NOAA.NOS.CO-OPS:8447930'],
                                 responseFormat='text/csv',
                                 observedProperties=['water_surface_height_above_reference_datum'],
                                 eventTime='2013-06-13T00:00:00Z/2013-06-14T00:00:00Z')


  File "<string>", line unknown
XMLSyntaxError: Start tag expected, '<' not found, line 1, column 1

In [3]:
sos_endpoint = 'http://sdf.ndbc.noaa.gov/sos/server.php?request=GetCapabilities&service=SOS'

In [4]:
urllib.urlretrieve(sos_endpoint,'sos_ndbc_getcapabilities.xml')
xml = open('sos_ndbc_getcapabilities.xml').read()
ndbc = SensorObservationService(None, xml=xml)

In [7]:
ndbc.get_operation_by_name('getobservation').parameters['responseFormat']['values']


Out[7]:
['text/xml;subtype="om/1.0.0"',
 'text/csv',
 'text/tab-separated-values',
 'application/vnd.google-earth.kml+xml',
 'text/xml;schema="ioos/0.6.1"',
 'application/ioos+xml;version=0.6.1']

In [10]:
sta = ndbc.contents['station-44066']

In [13]:
sta.


Out[13]:
['http://mmisw.org/ont/cf/parameter/air_temperature',
 'http://mmisw.org/ont/cf/parameter/air_pressure_at_sea_level',
 'http://mmisw.org/ont/cf/parameter/sea_water_temperature',
 'http://mmisw.org/ont/cf/parameter/waves',
 'http://mmisw.org/ont/cf/parameter/winds']

In [ ]: