38 g2int *ifld, j, iofst, nbits;
39 g2float ref, bscale, dscale, *unpk;
41 g2int Js, Ks, Ms, Ts, Ns, Nm, n, m;
42 g2int inc, incu, incp;
44 rdieee(idrstmpl+0, &ref, 1);
56 unpk = malloc(ndpts *
sizeof(
g2float));
57 ifld = malloc(ndpts *
sizeof(
g2int));
59 gbits(cpack, ifld, 0, 32, 0, Ts);
62 gbits(cpack, ifld, iofst, nbits, 0, ndpts - Ts);
66 pscale = malloc((JJ + MM + 1) *
sizeof(
g2float));
67 tscale = idrstmpl[4] * 1E-6;
68 for (n = Js; n <= JJ + MM; n++)
69 pscale[n] = pow((
g2float)(n * (n+1)), -tscale);
75 for (m = 0; m <= MM; m++)
83 for (n = m; n <= Nm; n++)
85 if (n <= Ns && m <= Ms)
87 fld[inc++] = unpk[incu++];
88 fld[inc++] = unpk[incu++];
92 fld[inc++] = (((
g2float)ifld[incp++] * bscale) + ref) *
94 fld[inc++] = (((
g2float)ifld[incp++] * bscale) + ref) *
106 printf(
"specunpack: Cannot handle 64 or 128-bit floats.\n");
107 for (j = 0; j < ndpts; j++)
void gbits(unsigned char *in, g2int *iout, g2int iskip, g2int nbyte, g2int nskip, g2int n)
Get bits - unpack bits: Extract arbitrary size values from a packed bit string, right justifying each...
Header file for NCEPLIBS-g2c library.
int64_t g2int
Long integer type.
double int_power(double x, g2int y)
Function similar to C pow() power function.
void rdieee(g2int *rieee, g2float *a, g2int num)
This subroutine reads a list of real values in 32-bit IEEE floating point format.
g2int specunpack(unsigned char *cpack, g2int *idrstmpl, g2int ndpts, g2int JJ, g2int KK, g2int MM, g2float *fld)
This subroutine unpacks a spectral data field that was packed using the complex packing algorithm for...