In [52]:
import netCDF4
from pylab import *

In [63]:
#aggregation
url='http://opendap.co-ops.nos.noaa.gov/thredds/dodsC/SJROFS/fmrc/Aggregated_7_day_SJROFS_Fields_Forecast_best.ncd'
#non aggregation
url='http://opendap.co-ops.nos.noaa.gov/thredds/dodsC/NOAA/SJROFS/MODELS/201405/nos.sjrofs.fields.forecast.20140506.t17z.nc'
nc = netCDF4.Dataset(url)
ncv = nc.variables

check out the time bounds:


In [64]:
t=ncv['time'][:]
plot(t,'o-')


Out[64]:
[<matplotlib.lines.Line2D at 0x37bce10>]

In [65]:
plot(diff(t),'o-')


Out[65]:
[<matplotlib.lines.Line2D at 0x43d0ed0>]

In [66]:
dt= diff(t)

In [73]:
dt[:10]*3600*24  # delta t in seconds


Out[73]:
array([ 3601.7578125 ,  3599.12109375,  3599.12182617,  3601.7578125 ,
        3599.12109375,  3599.11962891,  3601.7578125 ,  3599.12109375,
        3599.12109375,  3601.7578125 ], dtype=float32)

Check out the lon/lat bounds:


In [68]:
lon = ncv['lon'][:]
lat = ncv['lat'][:]

In [69]:
lon.min()


Out[69]:
-81.761909

In [70]:
lon.max()


Out[70]:
0.1

In [71]:
lat.min()


Out[71]:
-85.488747

In [72]:
lat.max()


Out[72]:
30.497652

In [76]:
shape(lon)


Out[76]:
(105, 188)

In [77]:
lon[0:2,0:2
]


Out[77]:
array([[ 0.,  0.],
       [ 0.,  0.]], dtype=float32)

In [89]:
lon=ma.masked_where(lon>=0,lon)
lat=ma.masked_where(lat<=0,lat)

In [90]:
lon.min()


Out[90]:
-81.761909

In [91]:
lon.max()


Out[91]:
-81.307274

In [92]:
lat.min()


Out[92]:
29.56171

In [93]:
lat.max()


Out[93]:
30.497652

In [96]:
plot(lon,lat,lon.T,lat.T);



In [ ]: