In [1]:
import netCDF4

In [2]:
url='http://data.nodc.noaa.gov/thredds/dodsC/ndbc/cmanwx/2013/06/NDBC_41013_201306_D2_v00.nc'

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


---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
<ipython-input-3-b04991578635> in <module>()
----> 1 nc = netCDF4.Dataset(url)

/home/local/python27_epd/lib/python2.7/site-packages/netCDF4.so in netCDF4.Dataset.__init__ (netCDF4.c:15904)()

RuntimeError: NetCDF: String match to name in use

In [3]:
url='/usgs/data2/rsignell/data/waves/NDBC_41013_201308_D2_v00.nc'

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

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


Out[5]:
[u'time', u'time10', u'timem', u'time_wpm_20', u'wave_wpm', u'wave_wpm_bnds']

In [6]:
print nc


<type 'netCDF4.Dataset'>
root group (NETCDF4 file format):
    id: 41013
    naming_authority: WMO
    geospatial_vertical_datum: urn:ogc:def:datum:epsg::5113
    ioos_id: urn:ioos:station:wmo:41013
    wmo_id: 41013
    institution: National Data Buoy Center
    institution_abbreviation: NDBC
    title: Meteorological and Oceanographic Data Collected from the National Data Buoy Center's Coastal Marine Automated Network and Weather Buoys
    summary: The Coastal-Marine Automated Network (C-MAN) was established by NDBC for the NWS in the early 1980's. Approximately 50 stations make up the C-MAN and have been installed on lighthouses, at capes and beaches, on near shore islands, and on offshore platforms.  Over 100 moored weather buoys have been deployed in U.S. coastal and offshore waters.  C-MAN and weather buoy data typically include barometric pressure, wind direction, speed and gust, and air temperature; however, some C-MAN stations are equipped to also measure sea water temperature, waves, and relative humidity. Weather buoys also measure wave energy spectra from which significant wave height, dominant wave period, and average wave period are derived. The direction of wave propagation is also measured on many moored weather buoys.
    station_name: Frying Pan Shoals, NC Buoy
    sea_floor_depth_below_sea_level: 23.5
    site_elevation: 0.0
    qc_manual: http://www.ndbc.noaa.gov/NDBCHandbookofAutomatedDataQualityControl2009.pdf
    keywords: Atmospheric Pressure, Sea level Pressure, Atmospheric Temperature, Surface Temperature, Dewpoint Temperature, Humidity, Surface Winds, Ocean Winds, Ocean Temperature, Sea Surface Temperature, Ocean Waves,  Wave Height, Wave Period, Wave Spectra, Longwave Radiation, Shortwave Radiation, Conductivity, Salinity,  Ocean Currents
    keywords_vocabulary: GCMD Science Keywords
    standard_name_vocabulary: CF-16.0
    scientific_project: None
    restrictions: There are no restrictions placed on these data.
    Metadata_Conventions: Unidata Dataset Discovery v1.0
    cdm_data_type: station
    history: NDBC_41013_201308_D2_history.txt
    format_version: 
    processing_level: 0
    distribution_statement: There are no restrictions placed on these data.
    citation: The National Data Buoy Center should be cited as the source of these data if used in any publication.
    publisher_name: NDBC
    publisher_url: http://www.ndbc.noaa.gov
    publisher_email: webmaster.ndbc@noaa.gov
    nominal_latitude: 33.436
    nominal_longitude: -77.743
    geospatial_lat_min: 33.436
    geospatial_lat_max: 33.436
    geospatial_lat_units: degrees
    geospatial_lon_min: -77.743
    geospatial_lon_max: -77.743
    geospatial_lon_units: degrees
    geospatial_vertical_min: 0.0
    geospatial_vertical_max: 0.0
    geospatial_vertical_positive: up
    geospatial_vertial_units: meters above mean sea level
    time_coverage_start: 2013-08-01T00:50:00Z
    time_coverage_end: 2013-08-31T23:50:00Z
    date_created: 2013-09-03T14:12:46Z
    date_modified: 
    creator_url: http://www.ndbc.noaa.gov
    creator_email: webmaster.ndbc@noaa.gov
    dimensions = (u'time', u'time10', u'timem', u'time_wpm_20', u'wave_wpm', u'wave_wpm_bnds')
    variables = (u'time', u'time10', u'timem', u'time_wpm_20', u'wave_wpm', u'wave_wpm_bnds')
    groups = (u'payload_1',)


In [7]:
nc.groups


Out[7]:
OrderedDict([(u'payload_1', <netCDF4.Group object at 0x4363850>)])

In [9]:
print nc.groups['payload_1']


<type 'netCDF4.Group'>
group /payload_1:
    payload_id: 41013
    description: AMPS ELECTRONICS UNIT, BUOY W/INTERNAL COMPASS
    manufacturer: NDBC
    part_number: 300000-002
    serial_number: 047
    install_date: 2011-08-09T00:00:00Z
    hull_id: 3DV17
    dimensions = ()
    variables = ()
    groups = (u'anemometer_1', u'anemometer_2', u'barometer_1', u'barometer_2', u'air_temperature_sensor_1', u'air_temperature_sensor_2', u'humidity_sensor_1', u'ocean_temperature_sensor_1', u'gps_1', u'wave_sensor_1')


In [10]:
pay1=nc.groups['payload_1']

In [13]:
wave1=pay1.groups['wave_sensor_1']

In [14]:
print wave1.variables['


Out[14]:
[u'significant_wave_height',
 u'significant_wave_height_qc',
 u'significant_wave_height_detail_qc',
 u'significant_wave_height_release',
 u'dominant_period',
 u'dominant_period_qc',
 u'dominant_period_detail_qc',
 u'dominant_period_release',
 u'average_period',
 u'average_period_qc',
 u'average_period_detail_qc',
 u'average_period_release',
 u'mean_wave_direction',
 u'mean_wave_direction_qc',
 u'mean_wave_direction_detail_qc',
 u'mean_wave_direction_release',
 u'c11',
 u'c11m',
 u'alpha1',
 u'alpha2',
 u'r1',
 u'r2',
 u'rhq',
 u'gamma2',
 u'gamma3',
 u'phih']

In [ ]: