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

Re: decoders] Grib File Data Extraction



On Mon, 4 Aug 2008, Don McGregor wrote:


I'm having problems spotting the necessary information in the indexer output.

I ran the indexer and got the output attached at the end.

Presumably this contains the necessary data for input to Grib1GetData,
namely the byte offset,

Grib1GetData [gribFile] [byte offset] [scale] [BMSExists]

Don

on the decoders page

http://www.unidata.ucar.edu/software/decoders/grib/javadoc/IndexFormat.txt

section 3  gives the definition of all the fields.


for your data example with your index

java -Xmx256m ucar/grib/grib1/Grib1GetData <datafile> 54 2 false


there is also a toolsUI program at:

http://www.unidata.ucar.edu/software/netcdf-java/

that will let display or look at the data values, it's a in-house tool so the documentation is sparce.

Robb...





But I can't spot the offset for the data section in the output of the indexer.
Where is it?


Indexer output:

index_version = 6.0
grid_edition = 1
location = data/seaTemp1
length = 390002
created = 2008-08-04T17:16:15Z
center = 58
sub_center = 0
table_version = 3
tiles = 1
thin = false
ensemble = false
--------------------------------------------------------------------
0 0 -1 80 78 1 0.0 255 0.0 2008-07-30T12:00:00Z 0 24011925 54 390002 2 false 58 0 3
--------------------------------------------------------------------
GDSkey = 24011925
grid_type = 0
grid_name = Latitude/Longitude Grid
grid_shape_code = 0
grid_shape = spherical
grid_radius_spherical_earth = 6367.47
Nx = 720
Ny = 361
La1 = -90.0
Lo1 = 0.0
ResCompFlag = 128
Winds = Relative
La2 = 90.0
Lo2 = -0.5
Dx = 0.5
Dy = 0.5
ScanningMode = 64


I want to extract data from the data record. Presmumably the Grib1GetData
class does this.


On Aug 2, 2008, at 8:57 AM, Robb Kambic wrote:

On Fri, 1 Aug 2008, Don McGregor wrote:

I'm looking for some examples of extracting data from grib files using
the Java decoders.
The Grib1Dump utility shows the output at the bottom of this message.
However, when I
load the file using the code below, I get zero records. I'm new to
grib files, and my understanding
is that there should be a record for each parameter.


Hiya,

GribDump is just to dump the headers of the Grib files, most Grib data is large so we use the index approach and a utility GribGetData ie

Grib(1|2)Indexer to index the records in the Grib file


# Grib(1|2)GetData to extract the data on a parameter basis.
# Parameter and level lookup routines. See Parameters

on the page:

http://www.unidata.ucar.edu/software/decoders/

there are Java docs that explain the routines in detail and what parameters to use.

Robb...



            ucar.unidata.io.RandomAccessFile raf = new
ucar.unidata.io.RandomAccessFile("data/seaTemp1","r");
            Grib1Input gribInput = new Grib1Input(raf);
            System.out.println("GRIB version is " +
gribInput.getEdition());

            List records = gribInput.getRecords();
            System.out.println("Number of records is " +
records.size());

Dump of the GRIB file:

                      Header : GRIB1
                  Discipline : 0 Meteorological Products
                GRIB Edition : 1
                 GRIB length : 390002
          Originating Center : 58 U.S. Navy Fleet Numerical
Meteorology and Oceanography Center
      Originating Sub-Center : 0 WMO Secretariat
          Product Definition : 0 Forecast/Uninitialized Analysis/
Image Product
          Parameter Category : -1 Meteorological Parameters
              Parameter Name : 80 var80 temperature of sea  water
             Parameter Units : deg_K
              Reference Time : 2008-07-30T12:00:00Z
                  Time Units : hour
        Time Range Indicator : product valid at RT + P1
                 Time 1 (P1) : 0
                 Time 2 (P2) : 0
     Generating Process Type : 78 126 wave triangular, 28 layer
Spectral model from Medium Range Forecast run
                  Level Type : 1 surface
               Level Value 1 : 0.0
               Level Value 2 : 0.0
                  GDS Exists : true
                  BMS Exists : false
       Number of data points : 259920
                   Grid Name : Latitude/Longitude Grid
                   Grid Shape: 0 spherical
       Spherical earth radius: 6367.47
                          Nx : 720
                          Ny : 361
                         La1 : -90.0
                         Lo1 : 0.0
Resolution & Component flags : 128
                       Winds : Relative
                         La2 : 90.0
                         Lo2 : -0.5
                          Dx : 0.5
                          Dy : 0.5
               Scanning mode : 64


_______________________________________________
decoders mailing list
address@hidden
For list information or to unsubscribe, visit: http://www.unidata.ucar.edu/mailing_lists/


===============================================================================
Robb Kambic                                Unidata Program Center
Software Engineer III Univ. Corp for Atmospheric Research
address@hidden             WWW: http://www.unidata.ucar.edu/
===============================================================================

===============================================================================
Robb Kambic                                Unidata Program Center
Software Engineer III                      Univ. Corp for Atmospheric Research
address@hidden             WWW: http://www.unidata.ucar.edu/
===============================================================================