Bob Simons wrote:
Ultimately, I want to use the java netcdf 2.2 library to generate an .nc
file which, when viewed with opendap, appears to have a sequence.
My reading of the netcdf java library leads me to believe I need to
create a Structure. Does anyone have sample code showing how to create a
.nc file with a Structure using the java netcdf library?
Netcdf-3 files are limited in what they can represent; Netcdf-4, when available
will be able to represent the entire CDM.
The only possible structure in a Netcdf-3 file is by using the unlimited
dimension. See this doc for details:
All the variables that have the unlimited dimension get put into the "record"
structure, and if you call netcdfFile.addRecordStructure(), a Structure is added. The
TDS-OpenDAP server, for example, will serve this as an Array of Structures. Since the
length of it is known, theres no reason to make it into a Sequence. Currently theres no
way to get nested Sequences.
So the "when viewed with opendap" part depends on what opendap server you use.
A Sequence is special because you are promising to allow relational constraint
expressions on the fields. So your server has to deal with that, which is
non-trivial. We are still considering if its possible to support sequences in
I have experimented with netcdfFile.addRecordStructure(), but can't
figure out how to access the Structure in order to call
addMemberVariable in order to add the variables to it.
Note that you can create an in-memory NetcdfFile with addMemberVariable() etc,
but you cannot save this to a netcdf-3 file. As I said, netcdf-4 will allow
other things, including (I think) variable length nested Structures, which are
Sequences, but the question of supporting relational constraint expressions