NCEPLIBS-w3emc  2.11.0
pdseup.f
Go to the documentation of this file.
1 C> @file
2 C> @brief Unpacks grib pds extension 41- for ensemble.
3 C> @author Zoltan Toth and Mark Iredell @date DATE: 1995-03-14
4 
5 C> Unpacks grib pds extension starting on byte 41 for ensemble
6 C> forecast products. for format of pds extension, see nmc office note 38
7 C>
8 C> Program history log:
9 C> - Zoltan Toth and Mark Iredell 1995-03-14
10 C> - Mark Iredell 1995-10-31 Removed saves and prints.
11 C> - Richard Wobus 1998-09-28 Corrected member extraction.
12 C> - Mark Iredell 2001-06-05 Apply linux port by ebisuzaki.
13 C>
14 C> @param[out] KENS (5) Bytes 41-45 (general section, always present.).
15 C> @param[out] KPROB (2) Bytes 46-47 (probability section, present only if neede.
16 C> @param[out] XPROB (2) Bytes 48-51&52-55 (probability section, if needed.).
17 C> @param[out] KCLUST (16) Bytes 61-76 (clustering section, if needed.).
18 C> @param[out] KMEMBR (80) Bytes 77-86 (cluster membership section, if needed.).
19 C> @param[in] ILAST Last byte to be unpacked (if greater/equal to first byte
20 C> in any of four sections below, whole section is packed).
21 C> @param[in] MSGA Full pds section, including new ensemble extension.
22 C>
23 C> @note Use pdsens() for packing pds ensemble extension.
24 C> Subprogram can be called from a multiprocessing environment.
25 C>
26 C> @author Zoltan Toth and Mark Iredell @date DATE: 1995-03-14
27  SUBROUTINE pdseup(KENS,KPROB,XPROB,KCLUST,KMEMBR,ILAST,MSGA)
28  INTEGER KENS(5),KPROB(2),KCLUST(16),KMEMBR(80)
29  dimension xprob(2)
30  CHARACTER*1 MSGA(100)
31 C CHECKING TOTAL NUMBER OF BYTES IN PDS (IBYTES)
32  CALL gbytec(msga, ibytes, 0,24)
33  IF(ilast.GT.ibytes) THEN
34 C ILAST=IBYTES
35  GO TO 333
36  ENDIF
37  IF(ilast.LT.41) THEN
38  GO TO 333
39  ENDIF
40 C UNPACKING FIRST SECTION (GENERAL INFORMATION)
41  CALL gbytesc(msga,kens,40*8,8,0,5)
42 C UNPACKING 2ND SECTION (PROBABILITY SECTION)
43  IF(ilast.GE.46) THEN
44  CALL gbytesc(msga,kprob,45*8,8,0,2)
45 C
46  CALL gbytec (msga,jsgn,47*8,1)
47  CALL gbytec (msga,jexp,47*8+1,7)
48  CALL gbytec (msga,ifr,47*8+8,24)
49  xprob(1)=(-1)**jsgn*ifr*16.**(jexp-70)
50 C
51  CALL gbytec (msga,jsgn,51*8,1)
52  CALL gbytec (msga,jexp,51*8+1,7)
53  CALL gbytec (msga,ifr,51*8+8,24)
54  xprob(2)=(-1)**jsgn*ifr*16.**(jexp-70)
55  ENDIF
56 C
57 C UNPACKING 3RD SECTION (CLUSTERING INFORMATION)
58  IF(ilast.GE.61) CALL gbytesc(msga,kclust,60*8,8,0,16)
59 C UNPACKING 4TH SECTION (CLUSTERMEMBERSHIP INFORMATION)
60  IF(ilast.GE.77) CALL gbytesc(msga,kmembr,76*8,1,0,80)
61 C
62  333 CONTINUE
63  RETURN
64  END
subroutine gbytec(IN, IOUT, ISKIP, NBYTE)
Wrapper for gbytesc() limiting NSKIP and N to 0 and 1.
Definition: gbytec.f:14
subroutine gbytesc(IN, IOUT, ISKIP, NBYTE, NSKIP, N)
Extract arbitrary size values from a packed bit string, right justifying each value in the unpacked a...
Definition: gbytesc.f:16
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