Lecture 3: Installing ncview

ncview is an easy to use netCDF file viewer for linux and OS X.  It can read any netCDF file, including wrf input and output files.

You can find the source code for these files on the web, but I have them downloaded already, so just copy from me.

#Make the directory software in your home directory
mkdir ~/software

#PRELIMINARIES
#need to temporarily disable anaconda python -- conflicting netCDF libraries
#Comment out the line in your $HOME/.bashrc file that adds anaconda to the path
#export PATH="/home/snesbitt/anaconda2/bin:$PATH"
#then log out and log back in

#load NETCDF 
module load netcdf

#1. Obtain and install expat
#You can copy the file from me
cp /oasis/scratch/snesbitt/temp_project/expat-2.1.0.tar.gz .
tar xvf expat-2.1.0.tar.gz
cd expat-2.1.0
./configure --prefix=$HOME/software
make install
cd $HOME
#2. Obtain and install udunits2, need to explicitly link to expat
#You can copy the file from me 
cp /oasis/scratch/snesbitt/temp_project/udunits-2.2.20.tar.gz . 
tar xvf udunits-2.2.20.tar.gz 
cd udunits-2.2.20 
export CFLAGS="-L$HOME/software/lib -lexpat -I$HOME/software/include"
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/software/lib
./configure --prefix=$HOME/software 
make install 
cd $HOME

#3. Obtain and install ncview 
cp /oasis/scratch/snesbitt/temp_project/ncview-2.1.6.tar.gz . 
tar xvf ncview-2.1.6.tar.gz 
cd ncview-2.1.6
export CC=mpicc
./configure --with-udunits2_incdir=$HOME/software/include --with-udunits2_libdir=$HOME/software/lib --prefix=$HOME/software
make install 
#If successful, you should see ncview executable in ~/software/bin 

#4. Add path to ncview to your default path edit the file 
#~/.bash_profile edit the PATH line to be: PATH=$PATH:$HOME/bin:$HOME/software/bin 
#Save the file. 
#Now, make the changes active for this session (they will be for future sessions) 
source ~/.bash_profile 
#Now you can type 
ncview whatever.nc 
#and you can run ncview

#When you're done, uncomment the python line in your .bashrc
#Also add the following line anywhere in your .bashrc
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/software/lib
#To make these changes effective, you can log out and log back in again, or do source $HOME/.bashrc