-
Notifications
You must be signed in to change notification settings - Fork 15
Patching NetCDF
- download a copy of the NetCDF 4.2 source. The package that we built the patch against was build on Oct 24, 2011 The NetCDF Java download website is here: http://www.unidata.ucar.edu/downloads/netcdf/netcdf-java-4/index.jsp
An ftp link for the package we used for the patch can be found here: ftp://ftp.unidata.ucar.edu/pub/netcdf-java/v4.2/ncSrc-4.2.zip
We downloaded the zip file with this command
wget ftp://ftp.unidata.ucar.edu/pub/netcdf-java/v4.2/ncSrc-4.2.zip
and we downloaded that file into this directory
/install/netcdf42
-
unzip your zip file. Our commagit checkout -b scihadoop hub/scihadoop/masternd looked like this
unzip ncSrc-4.2.zip
-
download the NetCDF patch from github a) install git. On Ubuntu this command does the trick
sudo apt-get install git
b) configure git via these two commands
git config --global user.name "Joe Smith"
git config --global user.email "[email protected]"
c) create a directory to hold the source code. Ours is at /hub/SciHadoop
d) cd into that directory
e) run git init
f) add the remote repository like so (we named the remote repo scihadoop)
git remote add hub/scihadoop git://github.com/four2five/SciHadoop.git
git fetch hub/scihadoop
git checkout -b scihadoop hub/scihadoop/master
g) copy the NetCDF patch into the NetCDF source directory, in our case that is /install/netcdf42
cp netcdf_patch/netcdf42.diff /install/netcdf42/
h) install ant. On Ubuntu, this command will do that
sudo apt-get install ant
i) cd into the netcdf42 directory, which for us is at /install/netcdf42
and apply the patch to the netcdf code like this
patch -p2 < netcdf42.diff
the output from the patch command should look like this
patching file cdm//src/main/java/ucar/nc2/iosp/AbstractIOServiceProvider.java
patching file cdm//src/main/java/ucar/nc2/iosp/IOServiceProvider.java
patching file cdm//src/main/java/ucar/nc2/iosp/netcdf3/N3iosp.java
patching file cdm//src/main/java/ucar/nc2/NetcdfFile.java
patching file cdm//src/main/java/ucar/nc2/Variable.java
j) now that the code is patched, cd into the cdm
directory within netcdf42 and build the NetCDF library with this command
ant makeMainComplete
if that does not work, try simply: ant
k) within the cdm directory, there should now be a directory named target
. Within target, there is a jar file named netcdfAll-4.2.jar
. This is the NetCDF library that SciHadoop will use.
l) add the NetCDF library to your CLASSPATH and HADOOP_CLASSPATH environment variables.
In your ~/.bashrc file, add this line (assuming you build the NetCDF library in /install/netcdf
):
CLASSPATH=$CLASSPATH:/install/netcdf/cdm/target/netcdfAll-4.2.jar