NCEPLIBS-g2c  1.8.0
comunpack.c File Reference

Unpack a data field that was packed using a complex packing algorithm as defined in the GRIB2 documention. More...

#include <stdio.h>
#include <stdlib.h>
#include "grib2_int.h"

Go to the source code of this file.

Functions

int comunpack (unsigned char *cpack, g2int lensec, g2int idrsnum, g2int *idrstmpl, g2int ndpts, float *fld)
 This subroutine unpacks a data field that was packed using a complex packing algorithm as defined in the GRIB2 documention, using info from the GRIB2 Data Representation Template 5.2 or Template 5.3. More...
 

Detailed Description

Unpack a data field that was packed using a complex packing algorithm as defined in the GRIB2 documention.

Author
Stephen Gilbert
Date
2002-10-29

Definition in file comunpack.c.

Function Documentation

◆ comunpack()

int comunpack ( unsigned char *  cpack,
g2int  lensec,
g2int  idrsnum,
g2int idrstmpl,
g2int  ndpts,
float *  fld 
)

This subroutine unpacks a data field that was packed using a complex packing algorithm as defined in the GRIB2 documention, using info from the GRIB2 Data Representation Template 5.2 or Template 5.3.

Supports GRIB2 complex packing templates with or without spatial differences (i.e. DRTs 5.2 and 5.3).

Program History Log

Date Programmer Comments
2002-10-29 Gilbert Initial
2004-12-16 Gilbert Added test (from Arthur Taylor/MDL) verifying group widths/lengths
Parameters
cpackpointer to the packed data field.
lenseclength of section 7 (used for error checking).
idrsnumData Representation Template number. Must equal 2 or 3.
idrstmplpointer to the array of values for Data Representation Template 5.2 or 5.3
ndptsThe number of data values to unpack
fldContains the unpacked data values. Must be allocated with at least ndpts * sizeof(float) bytes before calling this routine.
Returns
0 for success, error code otherwise.
Author
Stephen Gilbert
Date
2002-10-29

Definition at line 42 of file comunpack.c.

References gbit(), gbits(), int_power(), LOG, and rdieee().

Referenced by g2c_unpack7_int().