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.
Hiya Ravi, As Ethan mentioned, using the netCDF-java API eliminates the need to deal with the many details of the Grib format. As a test case, one file was downloaded from the ftp site and it opened fine in the ToolsUI program. Also, the file was dumped using the Grib2Dump grib library utility. This is working below the netCDF API so I don't suggest using these programs. % java -Xmx256m ucar.grib.grib2.Grib2Dump ruc2.t00z.bgrb13anl.grib2 Looking at your code snipet, it appears that the opened RandomAccessFile never set the order to RandomAccessFile.BIG_ENDIAN so the data wasn't read correctly. This a code extraction from the Grib2Dump program: raf = new RandomAccessFile(args[0], "r"); raf.order(RandomAccessFile.BIG_ENDIAN); // Create Grib2Input instance Grib2Input g2i = new Grib2Input(raf); // boolean params getProductsOnly, oneRecord g2i.scan(false, false); // record contains objects for all 8 Grib2 sections List records = g2i.getRecords(); for (int i = 0; i < records.size(); i++) { Grib2Record record = (Grib2Record) records.get(i); Grib2IndicatorSection is = record.getIs(); Grib2IdentificationSection id = record.getId(); Grib2GridDefinitionSection gds = record.getGDS(); Grib2ProductDefinitionSection pds = record.getPDS(); } Again it will save yourself much time working at the netCDF API level. RObb... Ticket Details =================== Ticket ID: QDJ-903556 Department: Support netCDF Java Priority: Normal Status: Open