In [7]:
from IPython.display import IFrame
IFrame('http://osmc.noaa.gov:8180/erddap/tabledap/OSMC_PROFILERS.html', width='100%', height=450)
Out[7]:
In [ ]:
##Initialize
In [12]:
import urllib2
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
%matplotlib inline
In [2]:
# dictionary for valid parameter_name
d={'sea_water_temperature':'ZTMP', 'sea_water_salinity':'ZSAL'}
In [3]:
# Specify variable to retrieve:
param=d['sea_water_temperature']
# Get data shallower than this water depth:
depth_max = 10
# Use ERDDAP's built-in relative time functionality to get last 48 hours:
start='now-24hours'
stop='now'
# or specify a specific period:
#start = '2013-05-06T00:00:00Z'
#stop = '2013-05-07T00:00:00Z'
In [8]:
# Construct URL for large PNG:
url='http://osmc.noaa.gov:8180/erddap/tabledap/OSMC_PROFILERS\
.largePng?longitude,latitude,observation_value\
&time>=%s&time<=%s¶meter_name="%s"&observation_depth<=%d&.trim=5&\
.draw=markers&.marker=5|6&.color=0x000000&.colorBar=|||||' % (start,stop,param,depth_max)
In [13]:
# Read the image
im = plt.imread(urllib2.urlopen(url),format='png')
In [14]:
# Display the image
plt.figure(figsize=(12,8))
plt.imshow(im)
plt.axis('off');
In [15]:
# Construct URL for CSV data:
url='http://osmc.noaa.gov:8180/erddap/tabledap/OSMC_PROFILERS\
.csv?time,longitude,latitude,observation_depth,observation_value\
&time>=%s&time<=%s¶meter_name="%s"&observation_depth<=%d' % (start,stop,param,depth_max)
In [16]:
# Load the CSV data directly into Pandas
df = pd.read_csv(url,index_col='time',parse_dates=True,skiprows=[1]) # skip the units row
In [17]:
# List last ten records
df.tail(10)
Out[17]:
In [18]:
df['longitude']
Out[18]:
In [19]:
df.plot()
Out[19]:
In [ ]: