NCEPLIBS-w3emc  2.11.0
getgb1re.f
Go to the documentation of this file.
1 C> @file
2 C> @brief Reads and unpacks a grib message.
3 C> @author Mark Iredell @date 1995-10-31
4 
5 C> Reads and unpacks a grib message.
6 C>
7 C> PROGRAM HISTORY LOG:
8 C> Mark Iredell 1995-10-31
9 C> Y. Zhu 1997-02-11 Included probability and cluster arguments.
10 C>
11 C> @param[in] LUGB Integer unit of the unblocked grib data file.
12 C> @param[in] LSKIP Integer number of bytes to skip.
13 C> @param[in] LGRIB Integer number of bytes to read.
14 C> @param[out] KF Integer number of data points unpacked.
15 C> @param[out] KPDS Integer (200) unpacked pds parameters.
16 C> @param[out] KGDS Integer (200) unpacked gds parameters.
17 C> @param[out] KENS Integer (200) unpacked ensemble pds parms.
18 C> @param[out] KPROB Integer (2) probability ensemble parms.
19 C> @param[out] XPROB Real (2) probability ensemble parms.
20 C> @param[out] KCLUST Integer (16) cluster ensemble parms.
21 C> @param[out] KMEMBR Integer (8) cluster ensemble parms.
22 C> @param[out] LB Logical*1 (kf) unpacked bitmap if present.
23 C> @param[out] F Real (kf) unpacked data.
24 C> @param[out] IRET Integer return code.
25 C> - 0 All ok.
26 C> - 97 Error reading grib file.
27 C> - other w3fi63 grib unpacker return code.
28 C>
29 C> @note There is no protection against unpacking too much data.
30 C> Subprogram can be called from a multiprocessing environment.
31 C> Do not engage the same logical unit from more than one processor.
32 C> This subprogram is intended for private use by getgb routines only.
33 C>
34 C> @author Mark Iredell @date 1995-10-31
35 C-----------------------------------------------------------------------
36  SUBROUTINE getgb1re(LUGB,LSKIP,LGRIB,KF,KPDS,KGDS,KENS,
37  & KPROB,XPROB,KCLUST,KMEMBR,LB,F,IRET)
38  INTEGER KPDS(200),KGDS(200),KENS(200)
39  INTEGER KPROB(2),KCLUST(16),KMEMBR(80)
40  REAL XPROB(2)
41  LOGICAL*1 LB(*)
42  REAL F(*)
43  INTEGER KPTR(200)
44  CHARACTER GRIB(LGRIB)*1
45 C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
46 C READ GRIB RECORD
47  CALL baread(lugb,lskip,lgrib,lread,grib)
48 C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
49 C UNPACK GRIB RECORD
50  IF(lread.EQ.lgrib) THEN
51  CALL w3fi63(grib,kpds,kgds,lb,f,kptr,iret)
52  IF(iret.EQ.0.AND.kpds(23).EQ.2) THEN
53  CALL pdseup(kens,kprob,xprob,kclust,kmembr,86,grib(9))
54  ENDIF
55  ELSE
56  iret=97
57  ENDIF
58 C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
59 C RETURN NUMBER OF POINTS
60  IF(iret.EQ.0) THEN
61  kf=kptr(10)
62  ELSE
63  kf=0
64  ENDIF
65 C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
66  RETURN
67  END
subroutine getgb1re(LUGB, LSKIP, LGRIB, KF, KPDS, KGDS, KENS, KPROB, XPROB, KCLUST, KMEMBR, LB, F, IRET)
Reads and unpacks a grib message.
Definition: getgb1re.f:38
subroutine pdseup(KENS, KPROB, XPROB, KCLUST, KMEMBR, ILAST, MSGA)
Unpacks grib pds extension starting on byte 41 for ensemble forecast products.
Definition: pdseup.f:28
subroutine w3fi63(MSGA, KPDS, KGDS, KBMS, DATA, KPTR, KRET)
Unpack a GRIB (edition 1) field to the exact grid specified in the GRIB message, isolate the bit map,...
Definition: w3fi63.f:243