script-publish.py: Add debugging output for the chunk stream
[mw2txt.git] / posts / netCDF.mdwn
1 [NetCDF][] (Network Common Data Form) is an open standard for
2 self-describing, machine-independent data formats for array-oriented
3 scientific data.  The standard and a good deal of associated software
4 are developed by the [Unidata][] program at the [University
5 Corporation for Atmospheric Research][UCAR] (UCAR).
6
7 I needed one of their libraries ([ucar.ma2][]) to build [[HDFView]]
8 from source.  Because I have very little [[Java]] experience, figuring
9 out how to do this took the better part of today.  Here are my notes,
10 so things will be faster the next time around…
11
12 Note that the `hdf-java` source (containing the HDFView source) comes
13 with a few precompiled JARs, including `netcdf.jar`.  However, Gentoo
14 [wants to compile everything from source][why-source]), so we remove
15 those JARs before compiling `hdf-java`, forcing a reliance on versions
16 that have already been installed from source using [Portage][].
17
18 Java develoment kit
19 -------------------
20
21 You'll need both a Java development kit (JDK, think "compiler") and
22 runtime environment (JRE, think "bytecode interpreter").  Install the
23 default implementations with
24
25     # emerge virtual/jdk
26
27 The [Gentoo Java team][team] publishes a [Java guide][guide] with more
28 details if you're interested.
29
30 Maven
31 -----
32
33 You'll also need [Maven][], [Apache]'s Java pacakge manager.
34
35     # emerge dev-java/maven-bin
36
37 There's a from-source [dev-java/maven] in [java-overlay][], but I'll
38 wait until that has been merged into the main Portage tree before
39 checking it out.  NetCDF will probabaly not depend on any
40 bleeding-edge Maven features.
41
42 NetCDF
43 ------
44
45 NetCDF is currently versioned with [[Git]] ([hosted on
46 GitHub][github]), so you can grab the source with
47
48     $ git clone git://github.com/Unidata/thredds.git
49
50 Unfortunately, this repository bundles a number of related Unidata
51 packages besides netCDF, so the 95 megabyte cdm directory comes with
52 an additional 432 megabytes of additional stuff.  This means that it's
53 a good idea to run the clone over a fast connection, and probably
54 useful to use `git clone --depth 10` or similar to limit the amount of
55 history you clone.
56
57 Now that you've got the source, just tell Maven to install it for you.
58 First, you'll need to install the `common utilities:
59
60     $ cd thredds/common
61     $ mvn-2.2 install
62
63 Next, install the `cdm` module itself
64
65     $ cd thredds
66     $ mvn-2.2 install
67
68 For more details, see the [netCDF documentation][docs] and [build
69 instructions][build].
70
71 Compiling HDFView
72 -----------------
73
74 To install HDFView on Gentoo, just emerge `dev-java/hdf-java` from my
75 [[wtk overlay|Gentoo overlay]] with the `hdfview` `USE` flag enabled.
76
77 [NetCDF]: http://www.unidata.ucar.edu/software/netcdf/
78 [Unidata]: http://www.unidata.ucar.edu/about/
79 [UCAR]: http://www2.ucar.edu/
80 [ucar.ma2]: http://www.unidata.ucar.edu/software/netcdf-java/v4.0/javadoc/ucar/ma2/package-summary.html
81 [why-source]: http://www.gentoo.org/proj/en/java/why-build-from-source.xml
82 [Portage]: http://www.gentoo.org/proj/en/portage/
83 [team]: http://www.gentoo.org/proj/en/java/
84 [guide]: http://www.gentoo.org/doc/en/java.xml
85 [Maven]: http://maven.apache.org/
86 [Apache]: http://apache.org/
87 [dev-java/maven]: http://gpo.zugaina.org/dev-java/maven
88 [java-overlay]: http://overlays.gentoo.org/proj/java/wiki/Overlays
89 [github]: https://github.com/Unidata/thredds/
90 [docs]: http://www.unidata.ucar.edu/software/netcdf-java/documentation.htm
91 [build]: http://www.unidata.ucar.edu/software/netcdf-java/tutorial/buildFromSource.html