10 * ensemble.c v0.1 wesley ebisuzaki
12 * prints ensemble meta-data
14 * only for NCEP and ECMWF
19 * ens=n/N: n: 0=ctl, +/-ve
20 * N: total number of members
23 * ens=n/type: n: 0=ctl, +/-ve, CLUST, PROD/
24 * type: Mn, WtdMn, SDev, NSDev
29 void ensemble(unsigned char *pds
, int mode
) {
35 pdslen
= PDS_LEN(pds
);
36 char_end
= mode
== 2 ? ' ' : ':';
38 if ((PDS_Center(pds
) == NMC
|| ncep_ens
) && pdslen
>= 45 && pds
[40] == 1) {
44 printf("ens%c0:", pds
[42] == 1 ? '+' : '-');
47 printf("%s-res_ens_control ", pds
[42] == 1 ? "hi" : "low");
51 /* perturbation run */
53 else if (pds
[41] == 2 || pds
[41] == 3) {
55 printf("ens%c%d:", pds
[41] == 3 ? '+' : '-', pds
[42]);
58 printf("ens_perturbation=%c%d ",pds
[41] == 3 ? '+' : '-',
65 else if (pds
[41] == 5) {
66 /* makes no sense to say "ensemble mean" for prob forecasts */
67 if (PDS_PARAM(pds
) != 191 && PDS_PARAM(pds
) != 192) {
68 if (mode
!= 2 || pdslen
< 61) {
69 printf("ens-mean%c", char_end
);
72 printf("ensemble-mean(%d members) ",pds
[60]);
77 /* other case .. debug code */
80 printf("ens %d/%d/%d/%d:", pds
[41],pds
[42],pds
[43],pds
[44]);
83 /* NCEP probability limits */
85 if ((PDS_PARAM(pds
) == 191 || PDS_PARAM(pds
) == 192) && pdslen
>= 47) {
86 ctmp
= PDS_PARAM(pds
);
87 PDS_PARAM(pds
) = pds
[45];
88 if (pds
[46] == 1 && pdslen
>= 51) {
89 printf("prob(%s<%f)%c", k5toa(pds
), ibm2flt(pds
+47),char_end
);
91 else if (pds
[46] == 2 && pdslen
>= 54) {
92 printf("prob(%s>%f)%c", k5toa(pds
), ibm2flt(pds
+51), char_end
);
94 else if (pds
[46] == 3 && pdslen
>= 54) {
95 printf("prob(%f<%s<%f)%c", ibm2flt(pds
+47), k5toa(pds
),
96 ibm2flt(pds
+51), char_end
);
98 PDS_PARAM(pds
) = ctmp
;
102 /* ECMWF test should go here */