Re: java-netcdf2.2v9, grib vs netcdf

Heiko Klein wrote:

Hi John,

I'm currently trying the java-netcdf 2.2v9 library. I have the task of converting some netcdf-files from GDV or in-house conventions to CF-1.0 convention and thought of using the new library, though it still is alpha.

I recognized the following problem:

a) NetcdfFileWriteable.addVariable(..., ArrayList dims)
I guess instead of ArrayList, the List interface should be used, as returned by the getDimension methods

b) NetcdfFileWriteable.create is deprecated
this might only be in jdk1.5.0. I had a look at the sources and recognized, that the function in front of create: addVariableAttribute got first deprecated and then commented out, thus moving the deprecated tag to create. Deleting the addVariableAttribute block solved the problem.

c) throws exeception: 'Not a netcdf file' when creating a new file., fill) worked fine.

d) since I had to copy a lot of attributes, I found the current methods for addGlobalAttribute(String name, *** value) quite inconvenient since I allways had to test the type of value being Array/String/Number.
Variable.addAttribute(attr) was much nicer to work with.

The conversion has to do with a new EU project called GEMS (Global and regional Earth-system (Atmosphere) Monitoring using Satellite and in-situ data) . I only play a minor role in this project, but I would like to convince the collaboration on using netcdf CF-1.0 instead of BUFR / GRIB . Do you have some good arguments I could use?

Best regards,


Hi Heiko:

Thanks for your feedback, The NetcdfFileWriteable() API is quite old and clunky. I will refactor and incorporate your ideas when i get a chance.

I would reccommend you move to version 2.2.10 when possible, as it has a lot of bug fixes.

BUFR/GRIB has more efficient storage (compression), while netcdf is much easier to read, and with CF, has (mostly) equivilent semantics. nj22 can read many GRIB files directly, and make it look like a netcdf CF-1.0 file, so that gives the best of both worlds at least to Java users. Also the new NetCDF4/HDF5 format _may_ give similar compression efficiencies compared to GRIB/BUFR, so thats worth considering also.

Thanks for your feedback!