[NetCDF][] (Network Common Data Form) is an open standard for self-describing, machine-independent data formats for array-oriented scientific data. The standard and a good deal of associated software are developed by the [Unidata][] program at the [University Corporation for Atmospheric Research][UCAR] (UCAR). I needed one of their libraries ([ucar.ma2][]) to build [[HDFView]] from source. Because I have very little [[Java]] experience, figuring out how to do this took the better part of today. Here are my notes, so things will be faster the next time around… Note that the `hdf-java` source (containing the HDFView source) comes with a few precompiled JARs, including `netcdf.jar`. However, Gentoo [wants to compile everything from source][why-source]), so we remove those JARs before compiling `hdf-java`, forcing a reliance on versions that have already been installed from source using [Portage][]. Java develoment kit ------------------- You'll need both a Java development kit (JDK, think "compiler") and runtime environment (JRE, think "bytecode interpreter"). Install the default implementations with # emerge virtual/jdk The [Gentoo Java team][team] publishes a [Java guide][guide] with more details if you're interested. Maven ----- You'll also need [Maven][], [Apache]'s Java pacakge manager. # emerge dev-java/maven-bin There's a from-source [dev-java/maven] in [java-overlay][], but I'll wait until that has been merged into the main Portage tree before checking it out. NetCDF will probabaly not depend on any bleeding-edge Maven features. NetCDF ------ NetCDF is currently versioned with [[Git]] ([hosted on GitHub][github]), so you can grab the source with $ git clone git://github.com/Unidata/thredds.git Unfortunately, this repository bundles a number of related Unidata packages besides netCDF, so the 95 megabyte cdm directory comes with an additional 432 megabytes of additional stuff. This means that it's a good idea to run the clone over a fast connection, and probably useful to use `git clone --depth 10` or similar to limit the amount of history you clone. Now that you've got the source, just tell Maven to install it for you. First, you'll need to install the `common utilities: $ cd thredds/common $ mvn-2.2 install Next, install the `cdm` module itself $ cd thredds $ mvn-2.2 install For more details, see the [netCDF documentation][docs] and [build instructions][build]. Compiling HDFView ----------------- To install HDFView on Gentoo, just emerge `dev-java/hdf-java` from my [[wtk overlay|Gentoo overlay]] with the `hdfview` `USE` flag enabled. [NetCDF]: http://www.unidata.ucar.edu/software/netcdf/ [Unidata]: http://www.unidata.ucar.edu/about/ [UCAR]: http://www2.ucar.edu/ [ucar.ma2]: http://www.unidata.ucar.edu/software/netcdf-java/v4.0/javadoc/ucar/ma2/package-summary.html [why-source]: http://www.gentoo.org/proj/en/java/why-build-from-source.xml [Portage]: http://www.gentoo.org/proj/en/portage/ [team]: http://www.gentoo.org/proj/en/java/ [guide]: http://www.gentoo.org/doc/en/java.xml [Maven]: http://maven.apache.org/ [Apache]: http://apache.org/ [dev-java/maven]: http://gpo.zugaina.org/dev-java/maven [java-overlay]: http://overlays.gentoo.org/proj/java/wiki/Overlays [github]: https://github.com/Unidata/thredds/ [docs]: http://www.unidata.ucar.edu/software/netcdf-java/documentation.htm [build]: http://www.unidata.ucar.edu/software/netcdf-java/tutorial/buildFromSource.html