NCEPLIBS-w3emc 2.12.0
Loading...
Searching...
No Matches
getgbemn.f File Reference

Finds and unpacks a grib message. More...

Go to the source code of this file.

Functions/Subroutines

subroutine getgbemn (lugb, lugi, jf, j, jpds, jgds, jens, mbuf, cbuf, nlen, nnum, mnum, kf, k, kpds, kgds, kens, lb, f, nbitss, iret)
 Find and unpack a grib message.
 

Detailed Description

Finds and unpacks a grib message.

Author
Mark Iredell
Date
1994-04-01

Definition in file getgbemn.f.

Function/Subroutine Documentation

◆ getgbemn()

subroutine getgbemn (   lugb,
  lugi,
  jf,
  j,
integer, dimension(200)  jpds,
integer, dimension(200)  jgds,
integer, dimension(200)  jens,
  mbuf,
character, dimension(mbuf)  cbuf,
  nlen,
  nnum,
  mnum,
  kf,
  k,
integer, dimension(200)  kpds,
integer, dimension(200)  kgds,
integer, dimension(200)  kens,
logical*1, dimension(jf)  lb,
real, dimension(jf)  f,
  nbitss,
  iret 
)

Find and unpack a grib message.

Read a grib index file (or optionally the grib file itself) to get the index buffer (i.e. table of contents) for the grib file. Find in the index buffer a reference to the grib message requested. The grib message request specifies the number of messages to skip and the unpacked pds and gds parameters. (A requested parameter of -1 means to allow any value of this parameter to be found.) If the requested grib message is found, then it is read from the grib file and unpacked. Its message number is returned along with the unpacked pds and gds parameters, the unpacked bitmap (if any), and the unpacked data. If the grib message is not found, then the return code will be nonzero.

Program history log:

  • Mark Iredell 1994-04-01
  • Mark Iredell 1995-10-31 Modularized portions of code into subprograms and allowed for unspecified index file
  • Chuang 2004-07-22 add packing bit number nbitss in the argument list because eta grib files need it to repack grib file
Parameters
[in]lugbinteger unit of the unblocked grib data file.
[in]lugiinteger unit of the unblocked grib index file (=0 to get index buffer from the grib file).
[in]jfinteger maximum number of data points to unpack.
[in]jinteger number of messages to skip (=0 to search from beginning) (<0 to read index buffer and skip -1-j messages).
[in]jpdsinteger (200) pds parameters for which to search (=-1 for wildcard).
  • 1: id of center.
  • 2: generating process id number.
  • 3: grid definition.
  • 4: gds/bms flag (right adj copy of octet 8).
  • 5: indicator of parameter.
  • 6: type of level.
  • 7: height/pressure , etc of level.
  • 8: year including (century-1).
  • 9: month of year.
  • 10: day of month.
  • 11: hour of day.
  • 12: minute of hour.
  • 13: indicator of forecast time unit.
  • 14: time range 1.
  • 15: time range 2.
  • 16: time range flag.
  • 17: number included in average.
  • 18: version nr of grib specification.
  • 19: version nr of parameter table.
  • 20: nr missing from average/accumulation.
  • 21: century of reference time of data.
  • 22: units decimal scale factor.
  • 23: subcenter number.
  • 24: pds byte 29, for nmc ensemble products.
    • 128 if forecast field error.
    • 64 if bias corrected fcst field.
    • 32 if smoothed field.
    • Warning: can be combination of more than 1.
  • 25: pds byte 30, not used.
[in]jgdsinteger (200) gds parameters for which to search (only searched if jpds(3)=255) (=-1 for wildcard).
  • 1: data representation type.
  • 19: number of vertical coordinate parameters.
  • 20: octet number of the list of vertical coordinate parameters or octet number of the list of numbers of points in each row or 255 if neither are present.
  • 21: for grids with pl, number of points in grid.
  • 22: number of words in each row.
  • Latitude/longitude grids.
    • 2: n(i) nr points on latitude circle.
    • 3: n(j) nr points on longitude meridian.
    • 4: la(1) latitude of origin.
    • 5: lo(1) longitude of origin.
    • 6: resolution flag (right adj copy of octet 17).
    • 7: la(2) latitude of extreme point.
    • 8: lo(2) longitude of extreme point.
    • 9: di longitudinal direction of increment.
    • 10: dj latitudinal direction increment.
    • 11: scanning mode flag (right adj copy of octet 28).
  • Gaussian grids.
    • 2: n(i) nr points on latitude circle.
    • 3: n(j) nr points on longitude meridian.
    • 4: la(1) latitude of origin.
    • 5: lo(1) longitude of origin.
    • 6: resolution flag (right adj copy of octet 17).
    • 7: la(2) latitude of extreme point.
    • 8: lo(2) longitude of extreme point.
    • 9: di longitudinal direction of increment.
    • 10: n - nr of circles pole to equator.
    • 11: scanning mode flag (right adj copy of octet 28).
    • 12: nv - nr of vert coord parameters.
    • 13: pv - octet nr of list of vert coord parameters or pl - location of the list of numbers of points in each row (if no vert coord parameters are present) or 255 if neither are present
  • Polar stereographic grids.
    • 2: n(i) nr points along lat circle.
    • 3: n(j) nr points along lon circle.
    • 4: la(1) latitude of origin.
    • 5: lo(1) longitude of origin.
    • 6: resolution flag (right adj copy of octet 17).
    • 7: lov grid orientation.
    • 8: dx - x direction increment.
    • 9: dy - y direction increment.
    • 10: projection center flag.
    • 11: scanning mode (right adj copy of octet 28).
  • Spherical harmonic coefficients.
    • 2: j pentagonal resolution parameter.
    • 3: k pentagonal resolution parameter.
    • 4: m pentagonal resolution parameter.
    • 5: representation type.
    • 6: coefficient storage mode.
  • Mercator grids.
    • 2: n(i) nr points on latitude circle.
    • 3: n(j) nr points on longitude meridian.
    • 4: la(1) latitude of origin.
    • 5: lo(1) longitude of origin.
    • 6: resolution flag (right adj copy of octet 17).
    • 7: la(2) latitude of last grid point.
    • 8: lo(2) longitude of last grid point.
    • 9: latit - latitude of projection intersection.
    • 10: reserved.
    • 11: scanning mode flag (right adj copy of octet 28).
    • 12: longitudinal dir grid length.
    • 13: latitudinal dir grid length.
  • Lambert conformal grids.
    • 2: nx nr points along x-axis.
    • 3: ny nr points along y-axis.
    • 4: la1 lat of origin (lower left).
    • 5: lo1 lon of origin (lower left).
    • 6: resolution (right adj copy of octet 17).
    • 7: lov - orientation of grid.
    • 8: dx - x-dir increment.
    • 9: dy - y-dir increment.
    • 10: projection center flag.
    • 11: scanning mode flag (right adj copy of octet 28).
    • 12: latin 1 - first lat from pole of secant cone inter.
    • 13: latin 2 - second lat from pole of secant cone inter.
[in]jensinteger (200) ensemble pds parms for which to search (only searched if jpds(23)=2) (=-1 for wildcard).
  • 1: application identifier.
  • 2: ensemble type.
  • 3: ensemble identifier.
  • 4: product identifier.
  • 5: smoothing flag.
[in]mbufinteger length of index buffer in bytes.
[in]nbitssinteger.
[in,out]cbufcharacter*1 (mbuf) index buffer (initialize by setting j=-1).
[in,out]nleninteger length of each index record in bytes (initialize by setting j=-1).
[in,out]nnuminteger number of index records (initialize by setting j=-1).
[in,out]mnuminteger number of index records skipped (initialize by setting j=-1).
[out]kfinteger number of data points unpacked.
[out]kinteger message number unpacked (can be same as j in calling program in order to facilitate multiple searches).
[out]kpdsinteger (200) unpacked pds parameters.
[out]kgdsinteger (200) unpacked gds parameters.
[out]kensinteger (200) unpacked ensemble pds parms.
[out]lblogical*1 (kf) unpacked bitmap if present.
[out]freal (kf) unpacked data.
[out]iretinteger return code.
  • 0 all ok.
  • 96 error reading index file.
  • 97 error reading grib file.
  • 98 number of data points greater than jf.
  • 99 request not found.
  • other w3fi63 grib unpacker return code.
Note
Specify an index file if feasible to increase speed. Subprogram can be called from a multiprocessing environment. Do not engage the same logical unit from more than one processor.
Author
Mark Iredell
Date
1994-04-01

Definition at line 183 of file getgbemn.f.