Re: help with a NetcdfDataset

Viviane Vasconcellos de Menezes wrote:

 Hi,

I was using an old version from Netcdf Java API (ucar.netcdf) to read Netcdf files. Now, I'm doing an uptade in my program and I saw the new version from Netcdf Java API. I'm very interested in the feature "dataset" because this would do easier my job. I read the latest manual and so, I decided to test it. I've got a Netcdf file that follows COARDS convection (It was produced in ferret software), applied ncdump >> resulting in the file .cdl, put the attribute global :Convection="COARDS" in :history header, and finally I've created another nc file with ncgen.
So, in my java program I've wrote these line commands:

try {
Netcdf nc=ucar.nc2.dataset.NetcdfDataset.factory("c:\...\BFOR.nc",null);
NetcdfDataset ds=ucar.nc2.dataset.conv.Convection.factory(nc);
....
}catch(IOException e) {JOptionPane.showMessageDialog(null,"problems !!")} Well, the problem is that the program stopped in the line NetcdfDataset and Everything after this don't work. If I put anything before this line, it works fine. I've also tried with a nc file without Convection attribute and it didn't work too.

Am I doing everything wrong? I need some help. Sorry for my english ...

Thanks in advance

Viviane


hi viviane:

in general, print error messsages like

try {
Netcdf nc=ucar.nc2.dataset.NetcdfDataset.factory("c:\...\BFOR.nc",null);
NetcdfDataset ds=ucar.nc2.dataset.conv.Convection.factory(nc);
....
}catch(IOException e) {
 e.printStackTrace();
}
that will tell you what the error is
i think your problem are the backslashes, always use forward slashes in java:

"c:/.../BFOR.nc"

you may also be interested in the functionality you get from the geogrid package, in which case you would use:

public static GridDataset factory(java.lang.String netcdfFileURI) throws java.io.IOException






  • 2003 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdf-java archives: