We have an ncSOS server with a get observation example that works:
http://geoport-dev.whoi.edu/thredds/sos/usgs/data2/notebook/1211-A1H.cdf?service=SOS&version=1.0.0&request=GetObservation&responseFormat=text%2Fxml%3Bsubtype%3D%22om%2F1.0.0%22&offering=1211-A1H&observedProperty=u_1205&procedure=urn:ioos:station:gov.usgs:1211-A1H
But can we formulate, request and process this same query (and others like it) using OWSlib and Pyoos?
In [1]:
    
from owslib.sos import SensorObservationService
import pdb
#from owslib.etree import etree
import pandas as pd
import datetime as dt
    
In [2]:
    
#url = 'http://sdf.ndbc.noaa.gov/sos/server.php?request=GetCapabilities&service=SOS&version=1.0.0'
#ndbc = SensorObservationService(url)
    
In [3]:
    
# usgs woods hole
# buoy data (single current meter)
url='http://geoport-dev.whoi.edu/thredds/sos/usgs/data2/notebook/1211-A1H.cdf'
usgs = SensorObservationService(url)
contents = usgs.contents
    
In [4]:
    
usgs.contents
    
    Out[4]:
In [5]:
    
off = usgs.offerings[1]
off.name
    
    Out[5]:
In [6]:
    
off.response_formats
    
    Out[6]:
In [7]:
    
off.observed_properties
    
    Out[7]:
In [8]:
    
# the get observation request below works.  How can we recreate this using OWSLib?
# http://geoport-dev.whoi.edu/thredds/sos/usgs/data2/notebook/1211-A1H.cdf?service=SOS&version=1.0.0&request=GetObservation&responseFormat=text%2Fxml%3Bsubtype%3D%22om%2F1.0.0%22&offering=1211-A1H&observedProperty=u_1205&procedure=urn:ioos:station:gov.usgs:1211-A1H
    
In [9]:
    
#pdb.set_trace()
response = usgs.get_observation(offerings=['1211-A1H'],
                                 responseFormat='text/xml;schema="om/1.0.0"',
                                 observedProperties=['u_1205'],
                                 procedure='urn:ioos:station:gov.usgs:1211-A1H')
    
In [10]:
    
print response[0:4000]
    
    
In [11]:
    
def parse_om_xml(response):
    # extract data and time from OM-XML response
    root = etree.fromstring(response)
    # root.findall(".//{%(om)s}Observation" % root.nsmap )
    values = root.find(".//{%(swe)s}values" % root.nsmap )
    date_value = array( [ (dt.datetime.strptime(d,"%Y-%m-%dT%H:%M:%SZ"),float(v))
            for d,v in [l.split(',') for l in values.text.split()]] )
    time = date_value[:,0]
    data = date_value[:,1]
    return data,time
    
In [12]:
    
data, time = parse_om_xml(response)
    
    
In [ ]:
    
ts = pd.Series(data,index=time)
    
In [ ]:
    
ts.plot(figsize(12,4));
    
In [ ]:
    
from pyoos.utils.etree import etree
from pyoos.parsers.ioos.one.timeseries import TimeSeries
    
In [ ]:
    
from pyoos.parsers.ioos.get_observation import IoosGetObservation
ob = IoosGetObservation(swe)
stations = ob.observations[0].feature
# 'stations' should be a Paegan 'StationCollection'
    
In [ ]: