In [12]:
import netCDF4

In [13]:
url = 'http://geoport.whoi.edu/thredds/dodsC/usgs/data2/rsignell/gdrive/nsf-alpha/Data/MIT_MSEAS/MSEAS_Tides_20140701/test_nc4.nc'

In [14]:
nc = netCDF4.Dataset(url)

In [15]:
nc.variables.keys()


Out[15]:
[u'imt',
 u'jmt',
 u'km',
 u'nt',
 u'lseg',
 u'misle',
 u'lbc',
 u'nfirst',
 u'nlast',
 u'nnergy',
 u'ntsout',
 u'ntsi',
 u'nmix',
 u'mxscan',
 u'mixvel',
 u'mixtrc',
 u'mixztd',
 u'am',
 u'ah',
 u'fkpm',
 u'fkph',
 u'nordv',
 u'ntimv',
 u'nfrqv',
 u'nordt',
 u'ntimt',
 u'nfrqt',
 u'nordp',
 u'ntimp',
 u'nfrqp',
 u'nordpb',
 u'ntimpb',
 u'nfrqpb',
 u'nordz',
 u'ntimz',
 u'nfrqz',
 u'dtts',
 u'dtuv',
 u'dtsf',
 u'sor',
 u'crit',
 u'acor',
 u'coord',
 u'rlngd',
 u'rlatd',
 u'delx',
 u'dely',
 u'thetad',
 u'rho0',
 u'smean',
 u'zc1',
 u'zc2',
 u'zref',
 u'zslope',
 u'dvbrlx',
 u'tvbrlx',
 u'dtbrlx',
 u'ttbrlx',
 u'dcsfrc',
 u'tcsfrc',
 u'dbtfrc',
 u'tbtfrc',
 u'iflag',
 u'iopt',
 u'iout',
 u'outlev',
 u'zclima',
 u'tclima',
 u'sclima',
 u'refz',
 u'hz',
 u'dxt',
 u'dyt',
 u'tbath',
 u'landt',
 u'landv',
 u'tgrid2',
 u'vgrid2',
 u'tgrid3',
 u'vgrid3',
 u'dzt',
 u'dzv',
 u'time',
 u'srfpress',
 u'vbaro']

In [17]:
vel = nc['vbaro']

In [20]:
vel


Out[20]:
<type 'netCDF4._netCDF4.Variable'>
float32 vbaro(time, vlat, vlon, vector)
    positions: vgrid2
    missing_value: 1e+35
    long_name: barotropic velocity
    units: centimeter second-1
    field: barotropic velocity, vector, series
    _FillValue: 1e+35
    least_significant_digit: 3
    _ChunkSize: [  1 433 516   1]
unlimited dimensions: time
current shape = (2209, 866, 1032, 2)
filling off

In [23]:
u_subset = vel[-1,:10,:10,1]

In [24]:
u_subset


Out[24]:
array([[-6.44921875, -6.6875    , -6.98144531, -6.8125    , -6.5078125 ,
        -6.65332031, -6.93847656, -6.7890625 , -6.53027344, -6.734375  ],
       [-6.88476562, -6.81054688, -6.76367188, -6.74707031, -6.72558594,
        -6.71582031, -6.70800781, -6.72265625, -6.76367188, -6.81835938],
       [-7.01855469, -6.79003906, -6.77929688, -6.74902344, -6.7265625 ,
        -6.70703125, -6.70214844, -6.71972656, -6.765625  , -6.80957031],
       [-6.73632812, -6.79394531, -6.78027344, -6.75878906, -6.72558594,
        -6.70605469, -6.6953125 , -6.71582031, -6.75976562, -6.79882812],
       [-6.59375   , -6.80859375, -6.79003906, -6.76367188, -6.73242188,
        -6.70410156, -6.69140625, -6.7109375 , -6.75683594, -6.79003906],
       [-6.91503906, -6.82421875, -6.80078125, -6.77539062, -6.74023438,
        -6.70898438, -6.69042969, -6.71191406, -6.75585938, -6.7890625 ],
       [-7.09570312, -6.84179688, -6.8203125 , -6.79296875, -6.75683594,
        -6.71875   , -6.70117188, -6.72460938, -6.77050781, -6.796875  ],
       [-6.81054688, -6.86230469, -6.84082031, -6.81835938, -6.78417969,
        -6.75292969, -6.73925781, -6.76074219, -6.79492188, -6.81347656],
       [-6.66894531, -6.88085938, -6.86425781, -6.84570312, -6.828125  ,
        -6.8125    , -6.80664062, -6.8125    , -6.82519531, -6.83300781],
       [-6.98925781, -6.90136719, -6.88671875, -6.87792969, -6.87304688,
        -6.87011719, -6.8671875 , -6.86328125, -6.85839844, -6.85449219]], dtype=float32)

In [ ]: