NCEPLIBS-g2c  1.8.0
aecunpack.c File Reference

Unpack a data field that was packed with AEC compression. More...

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

Go to the source code of this file.

Functions

g2int aecunpack (unsigned char *cpack, g2int len, g2int *idrstmpl, g2int ndpts, float *fld)
 Unpack AEC compressed data into an array of floats, using info from the GRIB2 Data Representation Template 5.42. More...
 
static int aecunpack_int (unsigned char *cpack, g2int len, g2int *idrstmpl, g2int ndpts, void *fld, int fld_is_double, int verbose)
 This internal function will unpack AEC compressed data into an array of floats or doubles, using info from the GRIB2 Data Representation Template 5.42. More...
 
int g2c_aecunpackd (unsigned char *cpack, size_t len, int *idrstmpl, size_t ndpts, double *fld)
 Unpack AEC compressed data into an array of doubles, using info from the GRIB2 Data Representation Template 5.42. More...
 
int g2c_aecunpackf (unsigned char *cpack, size_t len, int *idrstmpl, size_t ndpts, float *fld)
 Unpack AEC compressed data into an array of floats, using info from the GRIB2 Data Representation Template 5.42. More...
 

Detailed Description

Unpack a data field that was packed with AEC compression.

stream

Author
Eric Engle
Date
2023-10-16

Definition in file aecunpack.c.

Function Documentation

◆ aecunpack()

g2int aecunpack ( unsigned char *  cpack,
g2int  len,
g2int idrstmpl,
g2int  ndpts,
float *  fld 
)

Unpack AEC compressed data into an array of floats, using info from the GRIB2 Data Representation Template 5.42.

Parameters
cpackThe packed data.
lenThe length of the packed data.
idrstmplPointer to array of values for Data Representation Template 5.42.
ndptsThe number of data values to unpack.
fldA pointer that gets the unpacked data values as an array of float.
Returns
Author
Eric Engle
Date
2023-10-16

Definition at line 139 of file aecunpack.c.

References aecunpack_int(), and LOG.

Referenced by g2c_unpack7_int().

◆ aecunpack_int()

static int aecunpack_int ( unsigned char *  cpack,
g2int  len,
g2int idrstmpl,
g2int  ndpts,
void *  fld,
int  fld_is_double,
int  verbose 
)
static

This internal function will unpack AEC compressed data into an array of floats or doubles, using info from the GRIB2 Data Representation Template 5.42.

This function is used by aecunpack(), g2c_aecunpackf(), and g2c_aecunpackd().

Parameters
cpackThe packed data.
lenThe length of the packed data.
idrstmplPointer to array of values for Data Representation Template 5.42.
ndptsThe number of data values to unpack.
fldA pointer that gets the unpacked data values.
fld_is_doubleNon-zero if the data are to be unpacked into a double array, otherwise data will be unpacked into a float array.
verboseIf non-zero, error messages will be printed in case of error. Otherwise, error codes will be return but no error messages printed. Calls to the original g2c API may cause error messages to be printed in case of error. For the new g2c_ API, no error messages will be printed - instead an error code will be returned. Call g2c_strerror() to get the error message for any error code.
Returns
Author
Eric Engle
Date
2023-10-16

Definition at line 43 of file aecunpack.c.

References dec_aec(), G2C_ENOMEM, G2C_NOERROR, gbits(), int_power(), LOG, and rdieee().

Referenced by aecunpack(), g2c_aecunpackd(), and g2c_aecunpackf().

◆ g2c_aecunpackd()

int g2c_aecunpackd ( unsigned char *  cpack,
size_t  len,
int *  idrstmpl,
size_t  ndpts,
double *  fld 
)

Unpack AEC compressed data into an array of doubles, using info from the GRIB2 Data Representation Template 5.42.

This function is the V2 API version of aecunpack() for doubles.

Parameters
cpackThe packed data.
lenThe length of the packed data.
idrstmplPointer to array of values for Data Representation Template 5.42.
ndptsThe number of data values to unpack.
fldA pointer that gets the unpacked data values as an array of double.
Returns
Author
Eric Engle
Date
2023-10-16

Definition at line 210 of file aecunpack.c.

References aecunpack_int(), G2C_AEC_DRS_TEMPLATE_LEN, and LOG.

◆ g2c_aecunpackf()

int g2c_aecunpackf ( unsigned char *  cpack,
size_t  len,
int *  idrstmpl,
size_t  ndpts,
float *  fld 
)

Unpack AEC compressed data into an array of floats, using info from the GRIB2 Data Representation Template 5.42.

Parameters
cpackThe packed data.
lenThe length of the packed data.
idrstmplPointer to array of values for Data Representation Template 5.42.
ndptsThe number of data values to unpack.
fldA pointer that gets the unpacked data values as an array of float.
Returns
Author
Eric Engle
Date
2022-10-16

Definition at line 172 of file aecunpack.c.

References aecunpack_int(), G2C_AEC_DRS_TEMPLATE_LEN, and LOG.