In [18]:
import netCDF4
import pandas as pd
import datetime as dt
In [19]:
url='http://dods.ndbc.noaa.gov/thredds/dodsC/data/pwind/44066/44066p9999.nc'
nc = netCDF4.Dataset(url).variables
print nc.keys()
print nc['gust_spd']
In [22]:
time_var = nc['time']
jd = netCDF4.num2date(time_var[:],time_var.units)
start = dt.datetime(2013,6,13,10,0,0)
stop = dt.datetime(2013,6,14,0,0,0)
istart = netCDF4.date2index(start,time_var,select='nearest')
istop = netCDF4.date2index(stop,time_var,select='nearest')
gust = nc['gust_spd'][istart:istop,:,:].flatten()
jd = jd[istart:istop]
In [25]:
df = pd.Series(gust[:],index=jd)
df.plot(figsize=(12,4),style='ro')
Out[25]:
In [24]:
gust
Out[24]:
In [ ]: