Java netCDF 2.2.14 Structures API Example Code?

Mark Ohrenschall Mark.A.Ohrenschall at noaa.gov
Tue May 16 12:10:14 MDT 2006


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



More information about the Netcdf-java mailing list