NCEPLIBS-w3emc 2.12.0
Loading...
Searching...
No Matches
getgbeh.f
Go to the documentation of this file.
1C> @file
2C> @brief Find a grib message.
3C> @author Mark Iredell @date 1995-10-31
4
5C> Read a grib index file (or optionally the grib file itself) to get
6C> the index buffer (i.e. table of contents) for the grib file. (The
7C> index buffer is saved for use by future prospective calls.) Find
8C> in the index buffer a reference to the grib message requested.
9C> The grib message request specifies the number of messages to skip
10C> and the unpacked pds and gds parameters. (A requested parameter of
11C> -1 means to allow any value of this parameter to be found.) If the
12C> requested grib message is found, then its message number is
13C> returned along with the unpacked pds and gds parameters. If the
14C> grib message is not found, then the return code will be nonzero.
15C>
16C> Program History:
17C> - 1995-10-31 Mark Iredell Modularized portions of code into subprograms
18C> and allowed for unspecified index file.
19C>
20C> @param[in] LUGB Integer unit of the unblocked grib data file.
21C> (only used if lugi=0)
22C> @param[in] LUGI Integer unit of the unblocked grib index file.
23C> (=0 to get index buffer from the grib file)
24C> @param[in] J Integer number of messages to skip.
25C> - (=0 to search from beginning)
26C> - (<0 to read index buffer and skip -1-j messages)
27C> @param[in] JPDS Integer (200) pds parameters for which to search (can
28C> be combination of more than 1).
29C> - -1 for wildcard.
30C> - 1 id of center.
31C> - 2 generating process id number.
32C> - 3 grid definition.
33C> - 4 gds/bms flag (right adj copy of octet 8).
34C> - 5 indicator of parameter.
35C> - 6 type of level.
36C> - 7 height/pressure , etc of level.
37C> - 8 year including (century-1).
38C> - 9 month of year.
39C> - 10 day of month.
40C> - 11 hour of day.
41C> - 12 minute of hour.
42C> - 13 indicator of forecast time unit.
43C> - 14 time range 1.
44C> - 15 time range 2.
45C> - 16 time range flag.
46C> - 17 number included in average.
47C> - 18 version nr of grib specification.
48C> - 19 version nr of parameter table.
49C> - 20 nr missing from average/accumulation.
50C> - 21 century of reference time of data.
51C> - 22 units decimal scale factor.
52C> - 23 subcenter number.
53C> - 24 pds byte 29, for nmc ensemble products.
54C> - 128 if forecast field error.
55C> - 64 if bias corrected fcst field.
56C> - 32 if smoothed field.
57C> - 25 pds byte 30, not used.
58C> @param[in] JGDS Integer (200) gds parameters for which to search.
59C> (only searched if jpds(3)=255)
60C> - -1 for wildcard.
61C> - 1 data representation type.
62C> - 19 number of vertical coordinate parameters.
63C> - 20 octet number of the list of vertical coordinate parameters.
64C> or octet number of the list of numbers of points in each row
65C> or 255 if neither are present.
66C> - 21 for grids with pl, number of points in grid.
67C> - 22 number of words in each row.
68C> - Latitude/longitude grids.
69C> - 2 n(i) nr points on latitude circle.
70C> - 3 n(j) nr points on longitude meridian.
71C> - 4 la(1) latitude of origin.
72C> - 5 lo(1) longitude of origin.
73C> - 6 resolution flag (right adj copy of octet 17).
74C> - 7 la(2) latitude of extreme point.
75C> - 8 lo(2) longitude of extreme point.
76C> - 9 di longitudinal direction of increment.
77C> - 10 dj latitudinal direction increment.
78C> - 11 scanning mode flag (right adj copy of octet 28).
79C> - Gaussian grids
80C> - 2 n(i) nr points on latitude circle.
81C> - 3 n(j) nr points on longitude meridian.
82C> - 4 la(1) latitude of origin.
83C> - 5 lo(1) longitude of origin.
84C> - 6 resolution flag (right adj copy of octet 17).
85C> - 7 la(2) latitude of extreme point.
86C> - 8 lo(2) longitude of extreme point.
87C> - 9 di longitudinal direction of increment.
88C> - 10 n - nr of circles pole to equator.
89C> - 11 scanning mode flag (right adj copy of octet 28).
90C> - 12 nv - nr of vert coord parameters.
91C> - 13 pv - octet nr of list of vert coord parameters or pl location
92C> of the list of numbers of points in each row (if no vert coord
93C> parameters are present or 255 if neither are present.
94C> - Polar stereographic grids.
95C> - 2 n(i) nr points along lat circle.
96C> - 3 n(j) nr points along lon circle.
97C> - 4 la(1) latitude of origin.
98C> - 5 lo(1) longitude of origin.
99C> - 6 resolution flag (right adj copy of octet 17).
100C> - 7 lov grid orientation.
101C> - 8 dx - x direction increment.
102C> - 9 dy - y direction increment.
103C> - 10 projection center flag.
104C> - 11 scanning mode (right adj copy of octet 28).
105C> - Spherical harmonic coefficients
106C> - 2 j pentagonal resolution parameter.
107C> - 3 k pentagonal resolution parameter.
108C> - 4 m pentagonal resolution parameter.
109C> - 5 representation type.
110C> - 6 coefficient storage mode.
111C> - Mercator grids
112C> - 2 n(i) nr points on latitude circle.
113C> - 3 n(j) nr points on longitude meridian.
114C> - 4 la(1) latitude of origin.
115C> - 5 lo(1) longitude of origin.
116C> - 6 resolution flag (right adj copy of octet 17).
117C> - 7 la(2) latitude of last grid point.
118C> - 8 lo(2) longitude of last grid point.
119C> - 9 latit - latitude of projection intersection.
120C> - 10 reserved.
121C> - 11 scanning mode flag (right adj copy of octet 28).
122C> - 12 longitudinal dir grid length.
123C> - 13 latitudinal dir grid length.
124C> - Lambert conformal grids
125C> - 2 nx nr points along x-axis.
126C> - 3 ny nr points along y-axis.
127C> - 4 la1 lat of origin (lower left).
128C> - 5 lo1 lon of origin (lower left).
129C> - 6 resolution (right adj copy of octet 17).
130C> - 7 lov - orientation of grid.
131C> - 8 dx - x-dir increment.
132C> - 9 dy - y-dir increment.
133C> - 10 projection center flag.
134C> - 11 scanning mode flag (right adj copy of octet 28).
135C> - 12 latin 1 - first lat from pole of secant cone inter.
136C> - 13 latin 2 - second lat from pole of secant cone inter.
137C> @param[in] JENS Integer (200) ensemble pds parms for which to
138C> search (only searched if jpds(23)=2).
139C> - -1 for wildcard.
140C> - 1 application identifier.
141C> - 2 ensemble type.
142C> - 3 ensemble identifier.
143C> - 4 product identifier.
144C> - 5 smoothing flag.
145C> @param[out] KG Integer number of bytes in the grib message.
146C> @param[out] KF Integer number of data points in the message.
147C> @param[out] K Integer message number unpacked (can be same as j in
148C> calling program in order to facilitate multiple searches).
149C> @param[out] KPDS Integer (200) unpacked pds parameters.
150C> @param[out] KGDS Integer (200) unpacked gds parameters.
151C> @param[out] KENS Integer (200) unpacked ensemble pds parms.
152C> @param[out] IRET Integer return code.
153C> - 0 all ok.
154C> - 96 error reading index file.
155C> - 99 request not found.
156C>
157C> @note In order to unpack grib from a multiprocessing environment
158C> where each processor is attempting to read from its own pair of
159C> logical units, one must directly call subprogram getgbemh as
160C> below, allocating a private copy of cbuf, nlen and nnum to each
161C> processor. Do not engage the same logical unit from more than one
162C> processor.
163C>
164C> @author Mark Iredell @date 94-04-01
165 SUBROUTINE getgbeh(LUGB,LUGI,J,JPDS,JGDS,JENS,
166 & KG,KF,K,KPDS,KGDS,KENS,IRET)
167 INTEGER JPDS(200),JGDS(200),JENS(200)
168 INTEGER KPDS(200),KGDS(200),KENS(200)
169 parameter(mbuf=256*1024)
170 CHARACTER CBUF(MBUF)
171 SAVE cbuf,nlen,nnum,mnum
172 DATA lux/0/
173C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
174C DETERMINE WHETHER INDEX BUFFER NEEDS TO BE INITIALIZED
175 IF(lugi.GT.0.AND.(j.LT.0.OR.lugi.NE.lux)) THEN
176 lux=lugi
177 jj=min(j,-1-j)
178 ELSEIF(lugi.LE.0.AND.(j.LT.0.OR.lugb.NE.lux)) THEN
179 lux=lugb
180 jj=min(j,-1-j)
181 ELSE
182 jj=j
183 ENDIF
184C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
185C FIND AND UNPACK GRIB MESSAGE
186 CALL getgbemh(lugb,lugi,jj,jpds,jgds,jens,
187 & mbuf,cbuf,nlen,nnum,mnum,
188 & kg,kf,k,kpds,kgds,kens,iret)
189 IF(iret.EQ.96) lux=0
190C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
191 RETURN
192 END
subroutine getgbeh(lugb, lugi, j, jpds, jgds, jens, kg, kf, k, kpds, kgds, kens, iret)
Read a grib index file (or optionally the grib file itself) to get the index buffer (i....
Definition getgbeh.f:167
subroutine getgbemh(lugb, lugi, j, jpds, jgds, jens, mbuf, cbuf, nlen, nnum, mnum, kg, kf, k, kpds, kgds, kens, iret)
Read a grib index file (or optionally the grib file itself) to get the index buffer (i....
Definition getgbemh.f:177