34 g2int *idrstmpl,
unsigned char *cpack,
g2int *lcpack)
37 g2int *ifld, tmplsim[5];
40 g2int Js, Ks, Ms, Ts, Ns, inc, incu, incp, n, Nm, m, ipos;
49 pscale = malloc((JJ + MM + 1) *
sizeof(
g2float));
50 tscale = (
g2float)idrstmpl[4] * 1E-6;
51 for (n = Js; n <= JJ + MM; n++)
52 pscale[n] = pow((
g2float)(n * (n + 1)), tscale);
57 tfld = malloc(ndpts *
sizeof(
g2float));
58 unpk = malloc(ndpts *
sizeof(
g2float));
59 ifld = malloc(ndpts *
sizeof(
g2int));
63 for (m = 0; m <= MM; m++)
71 for (n = m; n <= Nm; n++)
73 if (n <= Ns && m <= Ms)
75 unpk[incu++] = fld[inc++];
76 unpk[incu++] = fld[inc++];
80 tfld[incp++] = fld[inc++] * pscale[n];
81 tfld[incp++] = fld[inc++] * pscale[n];
89 printf(
"specpack: Incorrect number of unpacked values %d given:\n", (
int)Ts);
90 printf(
"specpack: Resetting idrstmpl[8] to %d\n", (
int)incu);
100 tmplsim[1] = idrstmpl[1];
101 tmplsim[2] = idrstmpl[2];
102 tmplsim[3] = idrstmpl[3];
103 simpack(tfld, ndpts - Ts, tmplsim, cpack + ipos, lcpack);
104 *lcpack = (*lcpack) + ipos;
107 idrstmpl[0] = tmplsim[0];
108 idrstmpl[1] = tmplsim[1];
109 idrstmpl[2] = tmplsim[2];
110 idrstmpl[3] = tmplsim[3];
void simpack(g2float *, g2int, g2int *, unsigned char *, g2int *)
This subroutine packs up a data field using the simple packing algorithm as defined in the GRIB2 docu...
Header file for NCEPLIBS-g2c library.
int64_t g2int
Long integer type.
void mkieee(g2float *a, g2int *rieee, g2int num)
This subroutine stores a list of real values in 32-bit IEEE floating point format.
void specpack(g2float *fld, g2int ndpts, g2int JJ, g2int KK, g2int MM, g2int *idrstmpl, unsigned char *cpack, g2int *lcpack)
This subroutine packs a spectral data field using the complex packing algorithm for spherical harmoni...