NOTE: The decoders
mailing list is no longer active. The list archives are made available for historical reasons.
On Tue, 14 Feb 2006, Carl Drews wrote: > Robb - > > I'm looking over your GribJava documentation, and trying to determine > the best way to process all the grib records in a grib file for > conversion to MDV. Is this the recommended procedure? > > 1. Open up the grib file as a RandomAccessFile. > 2. Scan the file using Grib2Input. > 3. Get an ArrayList of all the records. > 4. Step through that array and process the records. in the original API the records contained the data but not anymore because the data in a 500 meg Grib file caused memory faults. the products contain the metadata and the info needed to get the data by creating the index. thus there is Grib(1|2)Indexer routines to create the indexes. it would be much easier to create an index and then see what data is requested and get the data, also it permits you to get the data is a particular order. here's part of an index, there is a header, mid section where each line represents a record in the grib file. this line contains enough info to describe the parameter and extract the data using GribGetData. the ending descibes the Grid info. i would suggest looking at IndexFormat.txt in the on-line doc for the details. robb... index_version = 2.1 grid_edition = 1 location = RUC.wmo length = 1094344 created = 2005-10-17T15:48:40Z version = 1.0 center = 7 sub_center = 0 table_version = 2 tiles = 1 thin = false ensemble = false -------------------------------------------------------------------- 0 0 -1 39 100 300 255 0 2002-12-02T22:00:00Z 0 2453164079 110 3596 1 true 0 0 -1 39 100 500 255 0 2002-12-02T22:00:00Z 0 2453164079 3710 8278 1 true 0 0 -1 39 100 200 255 0 2002-12-02T22:00:00Z 0 2453164079 8392 11878 1 true ... 0 0 -1 39 100 700 255 0 2002-12-02T22:00:00Z 0 2453164079 11992 17102 1 true0 0 -1 7 100 400 255 0 2002-12-02T22:00:00Z 3 2453164079 1088148 1094340 0 true -------------------------------------------------------------------- GDSkey = 2453164079 grid_type = 3 grid_name = Lambert Conformal grid_shape_code = 0 grid_shape = spherical grid_radius_spherical_earth = 6367.47 Nx = 93 Ny = 65 La1 = 12.19 Lo1 = -133.459 ResCompFlag = 8 LoV = -95.0 Dx = 81271.0 Dy = 81271.0 ProjFlag = 0.0 ScanningMode = 64 Latin1 = 25.0 Latin2 = 25.0 SpLat = 0.0 SpLon = 0.0 > > In code, those steps look like this: > > ucar.unidata.io.RandomAccessFile raf > = new ucar.unidata.io.RandomAccessFile(filename, "r"); > > Grib2Input input2 = new Grib2Input(raf); > input2.scan(false, false); > ArrayList products = input2.getProducts(); > display("There are " + products.size() + " products in the > file.", _kVerbose); > ArrayList records = input2.getRecords(); > display("There are " + records.size() + " records in the > file.", _kVerbose); > > // loop through the array of records > > Do I have the basic approach correct? You have some indexing classes, > but I gather that those are for netCDF. > > Carl > ============================================================================== Robb Kambic Unidata Program Center Software Engineer III Univ. Corp for Atmospheric Research rkambic@xxxxxxxxxxxxxxxx WWW: http://www.unidata.ucar.edu/ ==============================================================================
decoders
archives: