---
name: "specpack.c"
section: "3"
platform: "linux"
package: "libg2c-dev"
version: "2.1.0-2"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/specpack.c"
---

# specpack.c(3)

Pack a spectral data field using the complex packing algorithm for spherical harmonic data.

## NAME

specpack.c - Pack a spectral data field using the complex packing algorithm for spherical harmonic data.

## SYNOPSIS

`#include 'grib2_int.h'`\
 `#include <math.h>`\
 `#include <stdio.h>`\
 `#include <stdlib.h>`\

### Functions

void **specpack** (float \*fld, **g2int** ndpts, **g2int** JJ, **g2int** KK, **g2int** MM, **g2int** \*idrstmpl, unsigned char \*cpack, **g2int** \*lcpack)\
 Pack a spectral data field using the complex packing algorithm for spherical harmonic data as defined in the GRIB2 Data Representation `Template 5.51`.

## Detailed Description

Pack a spectral data field using the complex packing algorithm for spherical harmonic data.

**Author**

Stephen Gilbert

**Date**

2002-12-19

Definition in file **specpack.c**.

## Function Documentation

### void specpack (float \* fld, g2int ndpts, g2int JJ, g2int KK, g2int MM, g2int \* idrstmpl, unsigned char \* cpack, g2int \* lcpack)

Pack a spectral data field using the complex packing algorithm for spherical harmonic data as defined in the GRIB2 Data Representation `Template 5.51`.

**Parameters**

*fld* Contains the data values to be packed. \
 *ndpts* The number of data values to pack. \
 *JJ* J - pentagonal resolution parameter. \
 *KK* K - pentagonal resolution parameter. \
 *MM* M - pentagonal resolution parameter. \
 *idrstmpl* Contains the array of 10 values for \[Data Representation Template 5.51\](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2\_doc/grib2\_temp5-51.shtml). \
 *cpack* Pointer that gets the packed data field. Must be allocated by caller. \
 *lcpack* length of packed field cpack.

**Author**

Stephen Gilbert

**Date**

2002-12-19

Definition at line **33** of file **specpack.c**.

References **mkieee()**, and **simpack()**.

Referenced by **g2\_addfield()**.

## Author

Generated automatically by Doxygen for NCEPLIBS-g2c from the source code.
