32 float ref, bscale, dscale;
34 assert(cpack && idrstmpl && fld);
36 LOG((3,
"simunpack ndpts %ld idrstmpl: %ld %ld %ld %ld %ld", ndpts, idrstmpl[0],
37 idrstmpl[1], idrstmpl[2], idrstmpl[3], idrstmpl[4]));
44 if (!(ifld = calloc(ndpts,
sizeof(
g2int))))
46 fprintf(stderr,
"Could not allocate space in simunpack.\n "
47 "Data field NOT upacked.\n");
55 gbits(cpack, ifld, 0, nbits, 0, ndpts);
56 for (j = 0; j < ndpts; j++)
57 fld[j] = (((
float)ifld[j] * bscale) + ref) * dscale;
61 for (j = 0; j < ndpts; j++)
void gbits(unsigned char *in, g2int *iout, g2int iskip, g2int nbits, g2int nskip, g2int n)
Unpack arbitrary size values from a packed bit string, right justifying each value in the unpacked io...
#define G2_NO_ERROR
Function succeeded.
#define G2_JPCUNPACK_MEM
In jpcunpack() or other unpack function: out of memory.
int64_t g2int
Long integer type.
Header file with internal function prototypes NCEPLIBS-g2c library.
double int_power(double x, g2int y)
Function similar to C pow() power function.
#define LOG(e)
Ignore logging to stdout.
void rdieee(g2int *rieee, float *a, g2int num)
Read a list of real values in 32-bit IEEE floating point format.
g2int simunpack(unsigned char *cpack, g2int *idrstmpl, g2int ndpts, float *fld)
Unpack a data field that was packed using a simple packing algorithm, using info from the GRIB2 Data ...