JCDF

Overview

JCDF is a pure java library capable of reading files in the Common Data Format defined by NASA. It runs within the J2SE1.5 (or later), but other than that has no dependencies, neither the official CDF C library nor any other java class libraries.

Documentation

The classes are provided with comprehensive javadocs. Start reading at the CdfContent class for high-level access to CDF data and metadata, or CdfReader for low-level access to the CDF internal records.

Comparison with the official CDF library

JCDF is a completely separate implementation from the Java interface to the official CDF library, which uses native code via JNI. It was written mainly with reference to the CDF Internal Format Description document (v3.4).

The main benefit of using JCDF, and the reason for developing it, is that it's pure java, so it can be deployed using only the JCDF jar file. There is no need to install the system-dependent official CDF library.

The API is very different from that of the official CDF library. JCDF gives you a simple view of the CDF file, in terms of its global attributes, variable attributes and variables. This is fairly easy to use, but may or may not suit your purposes. It's also possible to get a low-level view of the CDF file as a sequence of CDF records.

JCDF offers no capabilities for writing or editing CDF files, it only reads them.

JCDF is based on NIO mapped ByteBuffers, it's expected to be reasonably fast, but I haven't done any benchmarking.

Implementation Status

Support for the CDF format is almost, but not totally, complete. In particular:

Utilities

The library comes with a couple of simple utilities for examining CDF files:

CdfList:
displays the metadata and data from a CDF file, along the lines of the cdfdump command in the official CDF distribution. If the -data flag is supplied, record data as well as metadata is shown. See CdfList examples.
CdfDump:
displays a dump of the sequence of low-level CDF records found in the CDF file, along the lines of the cdfirsdump command in the official CDF distribution. If the -fields flag is supplied, field information from each record is shown. If the -html flag is supplied, the output is in HTML with files offsets displayed as hyperlinks, which is nice for chasing pointers. See CdfDump examples.

Downloads

The source code is hosted on github at https://github.com/mbtaylor/jcdf. It comes with a makefile that can be used to build the jar file, javadocs, and this documentation, and to run some tests.

Pre-built copies of the jar file and documentation for the current version (v1.0) can be found here:

Previous versions may be available at ftp://andromeda.star.bris.ac.uk/pub/star/jcdf/.

History

Version 0.1 (28 Jun 2013)
Initial release. Tested, documented and believed working, though could use some more testing and perhaps functionality related to time-related DataTypes. Support for some time types not complete.
Version 1.0 (13 Aug 2013)

Context

This software was written by Mark Taylor at the University of Bristol at the request of, and funded by, the science archive group at ESA's European Space Astronomy Centre (ESAC).

It is used within TOPCAT/STILTS/STIL to enable access to CDF tables alongside other tabular data formats by that software. It is also under consideration (Aug 2014) for use within ESA's ODI project.

It is licenced under the LGPL, though if you need a different licence I can probably fix it.

My thanks to Michael Liu and Robert Candey at the NASA CDF office for encouragement and help with some of the testing and implementation.

Bugs, questions, feedback, enhancement requests welcome to m.b.taylor@bristol.ac.uk.


Mark Taylor -- Astrophysics Group, School of Physics, Bristol University