NCEPLIBS-w3emc 2.12.0
Loading...
Searching...
No Matches
pdsens.f
Go to the documentation of this file.
1C> @file
2C> @brief Packs grib pds extension 41- for ensemble.
3C> @author Zoltan Toth & Mark Iredell @date 1995-03-14
4
5C> Packs brib pds extension starting on byte 41 for ensemble
6c> forecast products. For format of pds extension, see nmc office note 38.
7C>
8C> Program history log:
9C> - Zoltan Toth and Mark Iredell 1995-03-14
10C> - Mark Iredell 1995-10-31 Removed saves and prints.
11C> - Richard Wobus 1998-09-28 Corrected member entry, blank all unused fields.
12C> - Mark Iredell 2001-06-05 Apply linux port by Ebisuzaki.
13C>
14C> @param[in] KENS (5) Bytes 41-45 (general section, always present.)
15C> @param[in] KPROB (2) Bytes 46-47 (probability section, present only if needed).
16C> @param[in] XPROB (2) Bytes 48-51&52-55 (probability section, if needed.).
17C> @param[in] KCLUST (16) Bytes 61-76 (clustering section, if needed.).
18C> @param[in] KMEMBR (80) Bytes 77-86 (cluster membership section, if needed.).
19C> @param[in] ILAST Last byte to be packed (if greater or equal to first byte
20C> in any of four sections above, whole section is packed).
21C> @param[out] MSGA - Full pds section, including new ensemble extension.
22C>
23C> @note Use pdseup() for unpacking pds ensemble extension.
24c> subprogram can be called from a multiprocessing environment.
25C>
26C> @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
34C 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
42C CHANGING THE NUMBER OF BYTES (FIRST THREE BYTES IN PDS)
43 CALL sbytec(msga, il, 0,24)
44C PACKING FIRST SECTION (GENERAL INTORMATION SECTION)
45 IF(il.GE.45) CALL sbytesc(msga,kens,40*8,8,0,5)
46C 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
57C PACKING 3RD SECTION (CLUSTERING INFORMATION)
58 IF(il.GE.76) CALL sbytesc(msga,kclust,60*8,8,0,16)
59C PACKING 4TH SECTION (CLUSTER MEMBERSHIP)
60 IF(il.GE.86) CALL sbytesc(msga,kmembr,76*8,1,0,80)
61C
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