Grabbing the DOSTA Data Product


In [ ]:
# Make it so notebook knows how to access ooitk from the notebook dir
import sys
import os
sys.path.append(os.path.dirname(os.getcwd()))

In [2]:
erddap_url = 'http://erddap-test.oceanobservatories.org:8080/erddap/tabledap/ecd800399ab14c59b7cfa6a29163c37d.html'

In [3]:
from ooitk.session import ERDDAPSession
session = ERDDAPSession(erddap_url)

In [4]:
session.open()

In [8]:
from datetime import datetime
def convert_time(t,p):
    dtg = datetime.utcfromtimestamp(t)
    return dtg.isoformat()

In [9]:
steps = len(session.dimensions['row'])
n = 45
time = session.variables['time'][::steps/n]
oxy = session.variables['sci_oxy4_oxygen'][::steps/n]
sat = session.variables['sci_oxy4_saturation'][::steps/n]

In [21]:
from matplotlib import ticker
pylab.rcParams['figure.figsize'] = (10., 8.)

ax = plt.subplot(211)
ax.set_title(session.title)
ax.set_ylabel(session.variables['sci_oxy4_oxygen'].long_name)
ax.plot(time, oxy, color='g')

ax = plt.subplot(212)
ax.set_ylabel(session.variables['sci_oxy4_saturation'].long_name)
ax.plot(time, oxy, color='r')
ax.get_xaxis().set_major_formatter(ticker.FuncFormatter(convert_time))
plt.setp(plt.subplot(212).get_xticklabels(), rotation=15)
ax.set_xlabel('Time (s)')

plt.show()



In [ ]: