This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.
|
Has anyone used the Java NetCDF library to define and write structures
(e.g., point observation data)? Is there a tutorial or cookbook example
documented anywhere? I naively tried the following (code snippet): Structure struct = new Structure(ncFile, null, null, "obs");
ncFile.addVariable("obs", DataType.STRUCTURE, new Dimension[] {iDim});
// more stuff happens
ncFile.create();
But received the following disconcerting run-time error:Exception in thread "main" java.lang.IllegalStateException: unknown DataType == Structure
at ucar.nc2.N3header.getType(N3header.java:434)
at ucar.nc2.N3header.writeVars(N3header.java:627)
at ucar.nc2.N3header.create(N3header.java:487)
at ucar.nc2.N3iosp.create(N3iosp.java:299)
at ucar.nc2.NetcdfFileWriteable.create(NetcdfFileWriteable.java:320)
So I'm not at all clear whether structures are fully implemented in
version 2.2.14 or what the proper sequence of netCDF API calls are that
I need to be making. Can anyone offer me guidance?Thanks in advance! Cheers -- Mark |