`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.`

`python`

`>>> import netCDF4 as nc`

`>>> q = nc.Dataset('tempdata.nc')`

`>>> print q.dimensions.keys()`

`>>> print q.variables.keys()`

`>>> t=q.variables['temp']`

`>>> p=q.variables['p']`

`>>> 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.`

`>>> t.shape[0]`

`12`

`>>> t.shape[1]`

`45`

`>>> t.shape[2]`

`49`

`>>> t.shape[3]`

`65`

` `

` `