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.
Tobias: You have a simple classpath problem. Try putting netcdfAll-4.3.jar on your classpath. John > Full Name: Tobias Schug > Email Address: address@hidden > Organization: private > Package Version: > Operating System: > Hardware: > Description of problem: > > I'm trying, to extract data from a GRIB2 File downloaded from the NOMADS > ftp server using netCDF 4.3. > > When I do open the file with toolsUI 4.3 the data is beeing displayed > nicely. So the file is OK. > > While trying to open the same file in my code with: > > GridDataset gridDataset = GridDataset.open(filename); > > I get a NoClassDefFoundError for ucar.unidata.geoloc.ProjectionRect. > This is confusing since I can see the ProjectionRect class within the > imported netcdf-4.3.jar... > > What do I have to do, in order to make this work. I couldn't find any > solution in the web which is why I'm hoping that you can help me out > with that. > > I did included the following jars in my project: > > netcdf-4.3.jar > grib-4.3.jar > jdom-1.1.2.jar > joda-time-2.0.jar > protobuf-java-2.4.1.jar > slf4j-api-1.6.4.jar > slf4j-log4j12-1.6.4.jar > > and imported the following class files: > > import ucar.grib.GribNumbers; > import ucar.grib.grib1.Grib1Tables; > import ucar.grib.grib2.Grib2Data; > import ucar.grib.grib2.Grib2GDSVariables; > import ucar.grib.grib2.Grib2GridDefinitionSection; > import ucar.grib.grib2.Grib2IdentificationSection; > import ucar.grib.grib2.Grib2IndicatorSection; > import ucar.grib.grib2.Grib2Input; > import ucar.grib.grib2.Grib2Record; > import ucar.grib.grib2.Grib2Tables; > import ucar.nc2.dt.grid.GridDataset; > import ucar.unidata.io.RandomAccessFile; > > Some of those I'm successfully using while dumping grib2 data to text > which works just fine: > > SimpleDateFormat dateFormat = new > SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'"); > dateFormat.setTimeZone(java.util.TimeZone.getTimeZone("GMT")); > RandomAccessFile gribfile = new ucar.unidata.io.RandomAccessFile(filename, > "r"); > gribfile.order(RandomAccessFile.BIG_ENDIAN); > Grib2Input gribInput = new Grib2Input(gribfile); > gribInput.scan(false, false); > ... > > Ticket Details =================== Ticket ID: IEX-641190 Department: Support netCDF Java Priority: Normal Status: Open