Code to read netcdf file from OPeNDAP server
Read netcdf data from OPeNDAP using python
The important bits are:import netCDF4 opendap_dir = 'http://dapds00.nci.org.au/thredds/dodsC/ub7/access-s1/hc/calibrated_5km/atmos' fname = '{opendap_dir}/{var}/daily/{ens_num}/da5_{var}_{mod_start_date}_{ens_num}.nc'.format( opendap_dir=opendap_dir, var='tasmax', ens_num='e01', mod_start_date='19900101') dataset = netCDF4.Dataset(fname) # extract the lat/lon points: lats = dataset.variables['lat'][:] lons = dataset.variables['lon'][:] # extract the horizontal data at a single time data_2d = dataset.variables['tasmax'][0, :, :] # extract a time series at a single point tseries = dataset.variables['tasmax'][:, 300, 200]This reads in maximum daily temperature for the model starting on 1st January 1990 and extracts the data at the first time step and a time series at the point (300,200).
For the full python code
Command:
Source code: here
$> plot_single_ens.py 'tasmax' '19900501' 1 '19900512' --map_bounds 148. 152. -35 -32.5Output:

Source code: here