43 g2int needext, i, j, nbits, isecnum;
44 g2int lensec, isign, newlen;
50 gbit(cgrib, &lensec, *iofst, 32);
52 gbit(cgrib, &isecnum, *iofst, 8);
62 gbit(cgrib, ndpts, *iofst, 32);
64 gbit(cgrib, idrsnum, *iofst, 16);
73 *mapdrslen = mapdrs->
maplen;
80 lidrstmpl = calloc(*mapdrslen,
sizeof(
g2int));
91 *idrstmpl = lidrstmpl;
93 for (i = 0; i < mapdrs->
maplen; i++)
95 nbits = abs(mapdrs->
map[i]) * 8;
96 if (mapdrs->
map[i] >= 0)
98 gbit(cgrib, lidrstmpl + i, *iofst, nbits);
102 gbit(cgrib, &isign, *iofst, 1);
103 gbit(cgrib, lidrstmpl + i, *iofst + 1, nbits - 1);
105 lidrstmpl[i] = -1 * lidrstmpl[i];
107 *iofst = *iofst + nbits;
119 lidrstmpl = realloc(lidrstmpl, newlen *
sizeof(
g2int));
120 *idrstmpl = lidrstmpl;
124 for (i = *mapdrslen; i < newlen; i++)
126 nbits = abs(mapdrs->
ext[j]) * 8;
127 if (mapdrs->
ext[j] >= 0)
129 gbit(cgrib, lidrstmpl + i, *iofst, nbits);
133 gbit(cgrib, &isign, *iofst, 1);
134 gbit(cgrib, lidrstmpl + i, *iofst + 1, nbits - 1);
136 lidrstmpl[i] = -1 * lidrstmpl[i];
138 *iofst = *iofst + nbits;
gtemplate * extdrstemplate(g2int number, g2int *list)
This subroutine generates the remaining octet map for a given Data Representation Template,...
g2int g2_unpack5(unsigned char *cgrib, g2int *iofst, g2int *ndpts, g2int *idrsnum, g2int **idrstmpl, g2int *mapdrslen)
Unpack Section 5 (Data Representation Section) of a GRIB2 message.
void gbit(unsigned char *in, g2int *iout, g2int iskip, g2int nbits)
Get arbitrary size values from a packed bit string, right justifying each value in the unpacked iout ...