[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[netCDFJava #QDJ-903556]: error when reading grib2 files

Hi Ravi,

I'm going to let Robb answer your first question. I'll try to answer your 
second question.

Through the netCDF-java API, you would not access the GRIB records directly. 
The library maps the GRIB data into netCDF variables and other supporting GRIB 
information into netCDF attributes. All the data records for the same parameter 
on the same grid will be in a single 3-D (x,y,t) or 4-D (x,y,z,t) variable 
depending on the data. The grid information is available in several coordinate 

To get a better idea of what this looks like, you could take a look at your 
data in our ToolsUI applications that use the netCDF-Java library. ToolsUI is 
available as a jar or webstart from the netCDF-Java page 
(http://www.unidata.ucar.edu/software/netcdf-java/). In the "Feature Types" - 
"Grids" panel, enter your file location and hit return.


> Ethan/Robb,
> Thanks for your replies. I have 2 questiions:
> 1. I tried out the option using Grib2Input :
> RandomAccessFile random =  new 
> RandomAccessFile("C:\\temp\\ruc2.t00z.bgrb20f01.grib2","r");
> Grib2Input input = new Grib2Input(random);
> boolean success= input.scan(true, false);
> System.out.println("success= "+success);
> java.util.List<Grib2Record> records = input.getRecords();
> System.out.println("rec.size = "+records.size());
> success is true, but rec.size is 0. Please suggest a solution.
> 2. The other question I have is if I use NetcdfFile.open to read the grib file
> then after reading in the file how do you extract the grib from the NetcdfFile
> object. How do I get a reference to the different sections of the grib.
> thanks,
> Ravi

Ticket Details
Ticket ID: QDJ-903556
Department: Support netCDF Java
Priority: Normal
Status: Open

NOTE: All email exchanges with Unidata User Support are recorded in the Unidata inquiry tracking system and then made publicly available through the web. If you do not want to have your interactions made available in this way, you must let us know in each email you send to us.