Re: netcdf 3, java, combining with java.util.zip

Ken Pavelle wrote:

John,

I'm having two problems upgrading my applet to the new jar file. (Same results for ncCore-2.0.06 and 2.0.09). First, I get the following runtime exception at the line where I set up my IndexIterator:

Exception in thread "AWT-EventQueue-2" java.lang.IncompatibleClassChangeError
    at RFCPanel.paintComponent(RFCPanel.java:691)


Any thoughts? Does this imply I don't have my array defined properly? Has something changed with ucar.ma2.Array, ucar.ma2.IndexIterator, ucar.nc2.NetcdfFile or ucar.nc2.Variable? Note, the same code works when I use netcdf.jar version 2.1beta.

there were some changes in 2.2.09. It sounds like you should recompile all your code against the new library. You may see some minor API changes.


Second, my main goal in upgrading to 2.2 is to be able to read .nc.gz files. My original idea was to open the file with a GZIPInputStream, read the data into a byte[] array, and then use NetcdfFile.openInMemory. Looking through the javadoc for 2.2, I get the impression that NetcdfFile.open takes the .gz extension into account, meaning I don't have to go through the GZIPInputStream to buffer to OpenInMemory. Is my impression correct?

NetcdfFile.open will look for compressed files like gz, decompress them onto disk, and then open the decompressed file. SInce you are trying to do everything in memory, it looks like you will need to keep doing that yourself.


One final question. Any idea when you'll be ready to launch a beta version of 2.2? I'm hearing concerns about putting code into production that is based on alpha versions.

A valid concern. Its because of the the minor API tweaks that we are still calling it alpha. The tweak was needed to improve performance to an acceptable level for a certain special case. Otherwise the code is getting pretty good testing, and there are several production packages using it, including the IDV. Typically whatever changes made are minor, and a recompile will discover and quickly fix them.

By the end of the month we'll probably go to beta, although there may be some sections of the library that will remain alpha code, maybe the "higher level" data types and the UI.

Thanks for your patience.


Thanks (again) for your time and help.  Regards,
Ken Pavelle


John Caron wrote:

Ken Pavelle wrote:

John,

Can you help point me in the right direction? We have only one novice Java programmer here, and I'm not even sure how big my project is.

We have a Java applet that reads netCDF files and interactively displays the data ( http://www.srh.noaa.gov/abrfc/precip/zoom.php ). I want to save user bandwith by reading gzipped netcdf files instead. I can read the zipped file using java.util.zip, but the netCDF Java library only reads from netCDF files, not from a memory buffer.

How hard will it be for a decent Java programmer to extend the netCDF java library (specifically NetcdfFile?) to read from buffer instead of file?

Thank you for your time. (....even moreso if you have the time to reply!)

Regards,
Ken Pavelle
NOAA, National Weather Service



Hi Ken:

unzip the file into a byte array, then call

 NetcdfFile.openInMemory(String location, byte[] data)

then it should work as usual

make sure you have the latest version (2.2.06)