Skip Navigation Links www.nws.noaa.gov 
NOAA logo - Click to go to the NOAA home page National Weather Service   NWS logo - Click to go to the NWS home page
Climate Prediction Center
 
 

 
About Us
   Our Mission
   Who We Are

Contact Us
   CPC Information
   CPC Web Team

 
HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2api: grb2_inq
 

wgrib2api: grb2_inq(..)

Introduction

To read grib using wgrib2api, you first need to an index or inventory file. Then you call grb2_inq(..) with the appropriate search terms and the data and metadata that you want.

Usage

    iret = grb2_inq(GRB2, INV, (list of search terms), (list of options))
    iret:  integer
           number of matchs to the search term
           -1 if some error
    GRB2: character (len=*) grib2 file
    INV:  character (len=*) index file
                            created by grb2_mk_inv(..)
                                    or wgrib2 GRB -Match_inv >INV
                            If you use an index file created by wgrib2 GRB > INV
                             then the search terms will be appropriate to that index file.
                             The *_date and *_edate optional arguments may not work.
    search term: character (len=*)
                 search term matches "wgrib2 GRB2 -Match_inv"
                 you are allowed 0 to 20 search terms
                 Normally the search is a straight text match.  You
                 can enable regex searches.
    IN Optional Arguments:
               debug: integer
                      0      - no debug statements
                      /= 0   - debug statements

               end_date: integer (kind=8) YYYYMMDDHH search
               end_edate: integer (kind=8) YYYYMMDDHHmmss search
               ref_date: integer (kind=8) YYYYMMDDHH search
               ref_edate: integer (kind=8) YYYYMMDDHHmmss search
               start_date: integer (kind=8) YYYYMMDDHH search
               start_edate: integer (kind=8) YYYYMMDDHHmmss search
               verf_date: integer (kind=8) YYYYMMDDHH search
               verf_edate: integer (kind=8) YYYYMMDDHHmmss search

               lastuse: integer
                        0    - nothing (default)
                        /= 0 - close GRB and INV files after use
               sequential: integer
                           0    - rewind INV before reading, stop after 1st match
                           /= 0 - do not rewind INV before reading, stop after 1st match
               regex: integer
                      0      - fixed string search (default)
                      /= 0   - regex search
               copy: character (len=*) filename
                     copies matches to file
               order: character (len=*) scan order of grid
                      'we:sn'   - grid will be in we:sn order (default)
                      'we:ns'   - grid will be in we:ns order
                      'raw'     - grid will be in raw order
                                  order as encoded in grib
                      note: lat, lon only work with we:sn order
    OUT Optional Arguments:
               grid: real allocatable (:,:)
                     grid point values
               lat:  real allocatable (:,:)
                     latitude values for the grid
               lon:  real allocatable (:,:)
                     longitude values for the grid
               nx:   integer, grid(nx,ny)
               ny:   integer, grid(nx,ny)
               npts: integer, number of grid points (nx*ny)
               nmatch: integer
                       number of matches                     
               msgno: integer
                      grib message of last match
               submsg: integer
                       submessage number of last match

               The following options return a wgrib2 inventory option
               You are limited to 18.

               desc: character, (len=*)
                          same as wgrib2 -S   (record number and byte location are not included)
               grid_desc: character, (len=*)
                          same as wgrib2 -grid
               get_ref_edate: integer (kind=8)
                          same as wgrib2 -T
               get_start_edate: integer (kind=8)
                          same as wgrib2 -start_FT
               get_end_edate: integer (kind=8)
                          same as wgrib2 -end_FT  or wgrib2 -VT

NOAA/ National Weather Service
National Centers for Environmental Prediction
Climate Prediction Center
5830 University Research Court
College Park, Maryland 20740
Climate Prediction Center Web Team
Page last modified: Feb 21, 2017
Disclaimer Privacy Policy