NCEPLIBS-w3emc  2.11.0
pdsens.f
Go to the documentation of this file.
1 C> @file
2 C> @brief Packs grib pds extension 41- for ensemble.
3 C> @author Zoltan Toth & Mark Iredell @date 1995-03-14
4 
5 C> Packs brib 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 entry, blank all unused fields.
12 C> - Mark Iredell 2001-06-05 Apply linux port by Ebisuzaki.
13 C>
14 C> @param[in] KENS (5) Bytes 41-45 (general section, always present.)
15 C> @param[in] KPROB (2) Bytes 46-47 (probability section, present only if needed).
16 C> @param[in] XPROB (2) Bytes 48-51&52-55 (probability section, if needed.).
17 C> @param[in] KCLUST (16) Bytes 61-76 (clustering section, if needed.).
18 C> @param[in] KMEMBR (80) Bytes 77-86 (cluster membership section, if needed.).
19 C> @param[in] ILAST Last byte to be packed (if greater or equal to first byte
20 C> in any of four sections above, whole section is packed).
21 C> @param[out] MSGA - Full pds section, including new ensemble extension.
22 C>
23 C> @note Use pdseup() for unpacking pds ensemble extension.
24 c> subprogram can be called from a multiprocessing environment.
25 C>
26 C> @author Zoltan Toth & Mark Iredell @date 1995-03-14
27  SUBROUTINE pdsens(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  IF(ilast.LT.41) THEN
32  GO TO 333
33  ENDIF
34 C PACKING IS DONE IN FOUR SECTIONS ENDING AT BYTE IL
35  IF(ilast.GE.41) il=45
36  IF(ilast.GE.46) il=55
37  IF(ilast.GE.61) il=76
38  IF(ilast.GE.77) il=86
39  do i=42,il
40  CALL sbytec(msga, 0, i*8, 8)
41  enddo
42 C CHANGING THE NUMBER OF BYTES (FIRST THREE BYTES IN PDS)
43  CALL sbytec(msga, il, 0,24)
44 C PACKING FIRST SECTION (GENERAL INTORMATION SECTION)
45  IF(il.GE.45) CALL sbytesc(msga,kens,40*8,8,0,5)
46 C PACKING 2ND SECTION (PROBABILITY SECTION)
47  IF(il.GE.55) THEN
48  CALL sbytesc(msga,kprob,45*8,8,0,2)
49  CALL w3fi01(lw)
50  CALL w3fi76(xprob(1),iexp,imant,8*lw)
51  CALL sbytec(msga,iexp,47*8,8)
52  CALL sbytec(msga,imant,48*8,24)
53  CALL w3fi76(xprob(2),iexp,imant,8*lw)
54  CALL sbytec(msga,iexp,51*8,8)
55  CALL sbytec(msga,imant,52*8,24)
56  ENDIF
57 C PACKING 3RD SECTION (CLUSTERING INFORMATION)
58  IF(il.GE.76) CALL sbytesc(msga,kclust,60*8,8,0,16)
59 C PACKING 4TH SECTION (CLUSTER MEMBERSHIP)
60  IF(il.GE.86) CALL sbytesc(msga,kmembr,76*8,1,0,80)
61 C
62  333 CONTINUE
63  RETURN
64  END
subroutine pdsens(KENS, KPROB, XPROB, KCLUST, KMEMBR, ILAST, MSGA)
Packs brib pds extension starting on byte 41 for ensemble forecast products.
Definition: pdsens.f:28
subroutine sbytec(OUT, IN, ISKIP, NBYTE)
This is a wrapper for sbytesc()
Definition: sbytec.f:14
subroutine sbytesc(OUT, IN, ISKIP, NBYTE, NSKIP, N)
Store bytes - pack bits: Put arbitrary size values into a packed bit string, taking the low order bit...
Definition: sbytesc.f:17
subroutine w3fi01(LW)
Determines the number of bytes in a full word for the particular machine (IBM or cray).
Definition: w3fi01.f:19
subroutine w3fi76(PVAL, KEXP, KMANT, KBITS)
Converts floating point number from machine representation to grib representation (ibm370 32 bit f....
Definition: w3fi76.f:24