In [56]:
import json, requests
url = 'http://erddap.marine.rutgers.edu/erddap/search/advanced.json'
params = dict(
page='1',
itemsPerPage='1000',
searchFor='',
protocol='(ANY)',
cdm_data_type='(ANY)',
institution='(ANY)',
ioos_category='(ANY)',
keywords='(ANY)',
long_name='(ANY)',
standard_name='sea_water_temperature',
variableName='(ANY)',
maxLat='37.78803',
minLon='-75.5659',
maxLon='-74.2846',
minLat='37.0371',
minTime='2013-09-23T00%3A00%3A00Z',
maxTime='2013-10-18T00%3A00%3A00Z'
)
In [57]:
resp = requests.get(url=url, params=params)
data = json.loads(resp.text)
In [58]:
data['table']['rows'][0][:]
Out[58]:
Tell ERDDAP to save as NetCDF CF-1.6 multidimensional array
In [88]:
url='http://erddap.marine.rutgers.edu/erddap/tabledap/ru22-20130924T2010.ncCF?time,latitude,longitude,depth,temperature&trajectory=%22ru22-20130924T2010%22'
In [89]:
import urllib
In [90]:
urllib.urlretrieve(url,'glider.nc')
Out[90]:
In [91]:
import netCDF4
In [92]:
nc = netCDF4.Dataset('glider.nc')
ncv = nc.variables
print ncv.keys()
In [97]:
print unique(ncv['profile_id'][:])
print unique(ncv['trajectoryIndex'][:])
In [ ]:
import pandas as pd
In [96]:
print shape(ncv['latitude'])
print shape(ncv['temperature'])
print shape(ncv['depth'])
In [80]:
t = np.squeeze(ncv['temperature'][:,:,:])
d = np.squeeze(ncv['depth'][:,:,:])
lon = np.squeeze(ncv['longitude'][:,:])
lat = np.squeeze(ncv['latitude'][:,:])
In [81]:
shape(t)
Out[81]:
In [87]:
pcolormesh(lon.T,d.T,t.T);
Out[87]:
In [ ]: