NCEPLIBS-w3emc  2.11.0
getgb1r.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> Program history log:
6 C> - Mark Iredell 1995-10-31
7 C> - Chuang 2004-07-22 Add packing bit number nbitss in the argument
8 C> list because eta grib files need it to repack grib file.
9 C> @param[in] LUGB Integer unit of the unblocked grib data file.
10 C> @param[in] LSKIP Integer number of bytes to skip.
11 C> @param[in] LGRIB Integer number of bytes to read.
12 C> @param[out] KF Integer number of data points unpacked.
13 C> @param[out] KPDS Integer (200) unpacked pds parameters.
14 C> @param[out] KGDS Integer (200) unpacked gds parameters.
15 C> @param[out] KENS Integer (200) unpacked ensemble pds parms.
16 C> @param[out] LB Logical*1 (kf) unpacked bitmap if present.
17 C> @param[out] F Real (kf) unpacked data.
18 C> @param[out] NBITSS Packaging bit number. Used by GRIB file to repack.
19 C> @param[out] IRET Integer return code.
20 C> - 0 All ok.
21 C> - 97 Error reading grib file.
22 C> - other w3fi63 grib unpacker return code.
23 C>
24 C> @note There is no protection against unpacking too much data.
25 C> Subprogram can be called from a multiprocessing environment.
26 C> Do not engage the same logical unit from more than one processor.
27 C> This subprogram is intended for private use by getgb routines only.
28 C>
29 C> @author Mark Iredell @date 1995-10-31
30 
31 C-----------------------------------------------------------------------
32  SUBROUTINE getgb1r(LUGB,LSKIP,LGRIB,KF,KPDS,KGDS,KENS,LB,F,NBITSS
33  + ,IRET)
34  INTEGER KPDS(200),KGDS(200),KENS(200)
35  LOGICAL*1 LB(*)
36  REAL F(*)
37  INTEGER KPTR(200)
38  CHARACTER GRIB(LGRIB)*1
39 C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
40 C READ GRIB RECORD
41  CALL baread(lugb,lskip,lgrib,lread,grib)
42 C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
43 C UNPACK GRIB RECORD
44  IF(lread.EQ.lgrib) THEN
45  CALL w3fi63(grib,kpds,kgds,lb,f,kptr,iret)
46  IF(iret.EQ.0.AND.kpds(23).EQ.2) THEN
47  CALL pdseup(kens,kprob,xprob,kclust,kmembr,45,grib(9))
48  ENDIF
49  ELSE
50  iret=97
51  ENDIF
52  nbitss=kptr(20)
53 C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
54 C RETURN NUMBER OF POINTS
55  IF(iret.EQ.0) THEN
56  kf=kptr(10)
57  ELSE
58  kf=0
59  ENDIF
60 C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
61  RETURN
62  END
subroutine getgb1r(LUGB, LSKIP, LGRIB, KF, KPDS, KGDS, KENS, LB, F, NBITSS, IRET)
Program history log:
Definition: getgb1r.f:34
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