Below are steps to install the Python netCDF4 package:
srun -p build --time=2:00:00 --mem=100G --pty /bin/bash
module load anaconda_2.4
pip install netCDF4 --user
Below are steps to use the Python netCDF4 package.
Here tempdata.nc is some netCDF file.
>>> import netCDF4 as nc
>>> q = nc.Dataset('tempdata.nc')
>>> print q.dimensions.keys()
>>> print q.variables.keys()
>>> p[1,2,3,4] #access element (1,2,3,4) of the netCDF variable p
Note that t and p are netCDF variable objects similar to a numpy multi-dimensional array.
(Indexing starts at 0 like in numpy but different from Matlab where indexing starts from 1.
Also the order of the indices in Python is reverse of the order in Matlab for the same netcdf file variable.)
Below tells you about the size of each axis.