grib2_int.h(3) | Library Functions Manual | grib2_int.h(3) |
grib2_int.h - Header file with internal function prototypes NCEPLIBS-g2c library.
#include <assert.h>
#include <ctype.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <arpa/inet.h>
#include 'grib2.h'
struct g2c_code_table
A GRIB2 code table. struct g2c_dim_info
Keep information about dimensions defined in section 3. struct
g2c_entry
An entry in a GRIB2 code table. struct g2c_file_info
This is the information about each open file. struct g2c_message_info
This is the information about each message. struct g2c_param
An entry in the table of NOAA abbreviations for GRIB parameters. struct
g2c_section3_info
Information about Section 3 GRID DEFINITION SECTION. struct
g2c_section4_info
Information about Section 4 PRODUCT DEFINITION SECTION. struct
g2c_section5_info
Information about Section 5 DATA REPRESENTATION SECTION. struct
g2c_section6_info
Information about Section 6 BIT-MAP SECTION. struct
g2c_section_info
Information about a section 3 through 7 in a GRIB2 message. struct
gtemplate
Struct for GRIB template, returned by getgridtemplate().
#define ALOG2 (0.69314718)
ln(2.0) #define BYTE 8
Number of bits in a byte. #define EIGHT_BYTES 8
Eight bytes. #define EXTERN_MUTEX(m)
Pthreads not enabled, so do nothing. #define FOUR_BYTES 4
Four bytes. #define G2C_FILE_READ 0
Read. #define G2C_FILE_WRITE 1
Write. #define G2C_INDEX1_BDS_VAL_LEN 10
Length of the binary data section (bds) in index file. #define
G2C_INDEX1_BMS_VAL_LEN 5
Length of the bitmap section (bms) in index file. #define
G2C_INDEX1_GDS_VAL2_LEN 27
Length of the gds in index file. #define G2C_INDEX1_GDS_VAL_LEN 41
Length of the grid definition section (gds) in index file. #define
G2C_INDEX1_PDS_VAL2_LEN 27
Length of the pds 2 section in the index file. #define
G2C_INDEX1_PDS_VAL3_LEN 27
Length of the pds 3 section in the index file. #define
G2C_INDEX1_PDS_VAL_LEN 27
Length of the product definition section (pds) in index file. #define
G2C_JASPER_JPEG_FORMAT_NAME 'jpc'
Name of JPEG codec in Jasper. #define G2C_MAGIC_HEADER 'GRIB'
GRIB magic header string. #define G2C_MAGIC_HEADER_LEN 8
Full length of magic header string (includes GRIB version byte). #define
G2C_MAX_MESSAGES 1024
Maximum number of messages in a file. #define G2C_MIN_MAX_BYTES 16
Minimum acceptable value for max_bytes parameter of g2c_get_msg().
#define hton64(y) (((uint64_t)htonl(y)) << WORD |
htonl(y >> WORD))
Byte swap 64-bit ints. #define LATITUDE 'Latitude'
Latitude. #define LOG(e)
Ignore logging to stdout. #define LONGITUDE 'Longitude'
Longitude. #define MUTEX(m)
Pthreads not enabled, so do nothing. #define MUTEX_LOCK(m)
Pthreads not enabled, so do nothing. #define MUTEX_UNLOCK(m)
Pthreads not enabled, so do nothing. #define ntoh64(y)
(((uint64_t)ntohl(y)) << WORD | ntohl(y >> WORD))
Byte swap 64-bit ints. #define ONE_BYTE 1
One byte. #define TWO_BYTES 2
Two bytes. #define WORD 32
Number of bits in four bytes.
typedef struct g2c_entry G2C_CODE_ENTRY_T
An entry in a GRIB2 code table. typedef struct g2c_code_table
G2C_CODE_TABLE_T
A GRIB2 code table. typedef struct g2c_dim_info G2C_DIM_INFO_T
Keep information about dimensions defined in section 3. typedef struct
g2c_file_info G2C_FILE_INFO_T
This is the information about each open file. typedef struct
g2c_message_info G2C_MESSAGE_INFO_T
This is the information about each message. typedef struct g2c_param
G2C_PARAM_T
An entry in the table of NOAA abbreviations for GRIB parameters. typedef
struct g2c_section3_info G2C_SECTION3_INFO_T
Information about Section 3 GRID DEFINITION SECTION. typedef struct
g2c_section4_info G2C_SECTION4_INFO_T
Information about Section 4 PRODUCT DEFINITION SECTION. typedef struct
g2c_section5_info G2C_SECTION5_INFO_T
Information about Section 5 DATA REPRESENTATION SECTION. typedef
struct g2c_section6_info G2C_SECTION6_INFO_T
Information about Section 6 BIT-MAP SECTION. typedef struct
g2c_section_info G2C_SECTION_INFO_T
Information about a section 3 through 7 in a GRIB2 message. typedef struct
gtemplate gtemplate
Struct for GRIB template.
int add_msg (G2C_FILE_INFO_T *file, int msg_num,
size_t bytes_to_msg, size_t bytes_in_msg, int read_file,
G2C_MESSAGE_INFO_T **msg)
Add new message to linked list. int add_section (FILE *f,
G2C_MESSAGE_INFO_T *msg, int sec_id, unsigned int sec_len, size_t
bytes_to_sec, unsigned char sec_num)
Add metadata about a new section 3, 4, 5, 6, or 7. void aecpack (float
*fld, g2int width, g2int height, g2int *idrstmpl,
unsigned char *cpack, g2int *lcpack)
This function packs up a float array into a AEC code stream. 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. void cmplxpack (float
*fld, g2int ndpts, g2int idrsnum, g2int *idrstmpl,
unsigned char *cpack, g2int *lcpack)
Pack up a data field using a complex packing algorithm. void compack
(float *fld, g2int ndpts, g2int idrsnum, g2int
*idrstmpl, unsigned char *cpack, g2int *lcpack)
Pack a data field using a complex packing algorithm. int comunpack
(unsigned char *cpack, g2int lensec, g2int idrsnum,
g2int *idrstmpl, g2int ndpts, float *fld)
Unpack a data field that was packed using a complex packing algorithm, using
info from the GRIB2 Data Representation Template 5.2 or Template 5.3.
int dec_aec (unsigned char *cpack, g2int len, g2int
nbits, g2int flags, g2int block_size, g2int rsi,
unsigned char *cfld, g2int cfldlen)
Decode an AEC code stream specified in the CCSDS 121.0-B-3 Blue Book.
int dec_jpeg2000 (char *injpc, g2int bufsize, g2int
*outfld)
Decode a JPEG2000 code stream specified in the JPEG2000 Part-1 standard (i.e.,
ISO/IEC 15444-1) using JasPer Software. int dec_png (unsigned
char *pngbuf, g2int *width, g2int *height, unsigned char
*cout)
Decode PNG. int enc_aec (unsigned char *data, g2int ctemplen,
g2int nbits, g2int flags, g2int block_size,
g2int rsi, unsigned char *aecbuf, g2int *aecbuflen)
Encode data into an AEC code stream specified in the CCSDS 121.0-B-3 Blue
Book. int enc_jpeg2000 (unsigned char *cin, g2int
width, g2int height, g2int nbits, g2int ltype,
g2int ratio, g2int retry, char *outjpc, g2int jpclen)
Encode a grayscale image into a JPEG2000 code stream specified in the JPEG2000
Part-1 standard (i.e., ISO/IEC 15444-1) using JasPer Software. int
enc_png (unsigned char *data, g2int width, g2int
height, g2int nbits, unsigned char *pngbuf)
Encode PNG. gtemplate * extdrstemplate (g2int number,
g2int *list)
This subroutine generates the remaining octet map for a given Data
Representation Template, if required. gtemplate *
extgridtemplate (g2int number, g2int *list)
This subroutine generates the remaining octet map for a given Grid Definition
Template, if required. gtemplate * extpdstemplate
(g2int number, g2int *list)
This subroutine generates the remaining octet map for a given Product
Definition Template, if required. int g2c_add_file (const char *path,
int mode, int *g2cid)
Open a GRIB2 file and add it to the list of open files. int
g2c_check_msg (unsigned char *cgrib, g2int *lencurr, int
verbose)
Check for 'GRIB' at the beginning of a GRIB message, and check to see if the
message is already terminated with '7777'. int g2c_file_io (FILE *f,
int write, int g2ctype, void *var)
Read or write a big-endian integer type to an open file, with conversion
between native and big-endian format. int g2c_file_io_byte (FILE *f,
int write, char *var)
Read or write a big-endian signed byte to an open GRIB2 file, with conversion
between native and big-endian format, and special GRIB2 handling of negative
numbers. int g2c_file_io_int (FILE *f, int write, int *var)
Read or write a big-endian 4-byte signed int to an open GRIB2 file, with
conversion between native and big-endian format, and special GRIB2 handling
of negative numbers. int g2c_file_io_longlong (FILE *f, int write,
long long *var)
Read or write a big-endian signed long long to an open GRIB2 file, with
conversion between native and big-endian format, and special GRIB2 handling
of negative numbers. int g2c_file_io_short (FILE *f, int write, short
*var)
Read or write a big-endian signed short to an open GRIB2 file, with conversion
between native and big-endian format, and special GRIB2 handling of negative
numbers. int g2c_file_io_template (FILE *f, int rw_flag, int map,
long long int *template_value)
Read or write a big-endian 4-byte int or unsigned int from or to an open file,
with conversion between native and big-endian format, and handling of GRIB
negative numbers. int g2c_file_io_ubyte (FILE *f, int write, unsigned
char *var)
Read or write a big-endian unsigned byte to an open GRIB2 file, with
conversion between native and big-endian format. int g2c_file_io_uint
(FILE *f, int write, unsigned int *var)
Read or write a big-endian 4-byte unsigned int to an open GRIB2 file, with
conversion between native and big-endian format. int
g2c_file_io_ulonglong (FILE *f, int write, unsigned long long *var)
Read or write a big-endian unsigned long long to an open GRIB2 file, with
conversion between native and big-endian format. int
g2c_file_io_ushort (FILE *f, int write, unsigned short *var)
Read or write a big-endian unsigned short to an open GRIB2 file, with
conversion between native and big-endian format. int g2c_get_datetime
(int ipdtn, long long int *ipdtmpl, short year, unsigned char month,
unsigned char day, unsigned char hour, unsigned char minute, unsigned char
second, char *tabbrev)
Convert date and time from GRIB2 info to string output. int
g2c_get_level_desc (int ipdtn, long long int *ipdtmpl, char
*level_desc)
Determine the string that describes the level information, given the GRIB2
Product Definition Template information. int g2c_log_section1
(G2C_MESSAGE_INFO_T *msg)
Log section 0 information. int g2c_rw_section1_metadata (FILE *f, int
rw_flag, G2C_MESSAGE_INFO_T *msg)
Read Section 1. int g2c_rw_section3_metadata (FILE *f, int rw_flag,
G2C_SECTION_INFO_T *sec)
Read the metadata from section 3 (Grid Definition Section) of a GRIB2 message.
int g2c_rw_section4_metadata (FILE *f, int rw_flag,
G2C_SECTION_INFO_T *sec)
Read or write the metadata from section 4 (Product Definition Section) of a
GRIB2 message. int g2c_rw_section5_metadata (FILE *f, int rw_flag,
G2C_SECTION_INFO_T *sec)
Read or write the metadata from section 5 (Data Representation Section) of a
GRIB2 message. int g2c_rw_section6_metadata (FILE *f, int rw_flag,
G2C_SECTION_INFO_T *sec)
Read or write the metadata from section 6 (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 array. 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 iout array. g2int getdim (unsigned char
*csec3, g2int *width, g2int *height, g2int *iscan)
Return the dimensions and scanning mode of a grid definition. gtemplate
* getdrstemplate (g2int number)
This subroutine returns DRS template information for a specified Data
Representation Template. gtemplate * getgridtemplate
(g2int number)
This subroutine returns grid template information for a specified Grid
Definition Template for [Section 3 - the Grid Definition Section
(GDS)](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_sect3.shtml).
gtemplate * getpdstemplate (g2int number)
This subroutine returns PDS template information for a specified Product
Definition Template. g2int getpoly (unsigned char *csec3,
g2int *jj, g2int *kk, g2int *mm)
This subroutine returns the J, K, and M pentagonal resolution parameters
specified in a GRIB Grid Definition Section (GDS) used spherical harmonic
coefficients using GDT 5.50 through 5.53. double int_power (double x,
g2int y)
Function similar to C pow() power function. void jpcpack (float *fld,
g2int width, g2int height, g2int *idrstmpl, unsigned
char *cpack, g2int *lcpack)
This function packs up a float array into a JPEG2000 code stream. g2int
jpcunpack (unsigned char *cpack, g2int len, g2int
*idrstmpl, g2int ndpts, float *fld)
Unpack JPEG2000 compressed data into an array of floats, using info from the
GRIB2 Data Representation Template 5.40 or 5.40000. void
misspack (float *fld, g2int ndpts, g2int idrsnum,
g2int *idrstmpl, unsigned char *cpack, g2int *lcpack)
Pack a data field using a complex packing algorithm. void mkieee (float
*a, g2int *rieee, g2int num)
Store a list of real values in 32-bit IEEE floating point format. int
pack_gp (g2int *kfildo, g2int *ic, g2int *nxy,
g2int *is523, g2int *minpk, g2int *inc, g2int
*missp, g2int *misss, g2int *jmin, g2int *jmax,
g2int *lbit, g2int *nov, g2int *ndg, g2int *lx,
g2int *ibit, g2int *jbit, g2int *kbit, g2int
*novref, g2int *lbitref, g2int *ier)
Determines groups of variable size, but at least of size minpk, the associated
max (jmax( )) and min (jmin( )), the number of bits necessary to hold the
values in each group (lbit( )), the number of values in each group (nov( )),
the number of bits necessary to pack the jmin( ) values (ibit), the number
of bits necessary to pack the lbit( ) values (jbit), and the number of bits
necessary to pack the nov( ) values (kbit). void pngpack (float *fld,
g2int width, g2int height, g2int *idrstmpl, unsigned
char *cpack, g2int *lcpack)
This subroutine packs up a float data field into PNG image format.
g2int pngunpack (unsigned char *cpack, g2int len,
g2int *idrstmpl, g2int ndpts, float *fld)
This subroutine unpacks a data field that was packed into a PNG image format
using info from the GRIB2 Data Representation Template 5.41 or 5.40010. void
rdieee (g2int *rieee, float *a, g2int num)
Read a list of real values in 32-bit IEEE floating point format. void
sbit (unsigned char *out, g2int *in, g2int iskip,
g2int nbits)
Store arbitrary size values into a packed bit string, taking the low order
bits from each value in the unpacked array. void sbits (unsigned char
*out, g2int *in, g2int iskip, g2int nbits, g2int
nskip, g2int n)
Store arbitrary size values into a packed bit string, taking the low order
bits from each value in the unpacked array. void simpack (float *fld,
g2int ndpts, g2int *idrstmpl, unsigned char *cpack,
g2int *lcpack)
Packs a data field using the simple packing algorithm. 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 Representation Template 5.0. 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.
g2int specunpack (unsigned char *cpack, g2int
*idrstmpl, g2int ndpts, g2int JJ, g2int KK,
g2int MM, float *fld)
Unpack a spectral data field that was packed using the complex packing
algorithm for spherical harmonic data as defined in the GRIB2 documention,
using info from the GRIB2 Data Representation Template 5.51.
Header file with internal function prototypes NCEPLIBS-g2c library.
Author
Date
Definition in file grib2_int.h.
A GRIB2 code table.
Definition at line 256 of file grib2_int.h.
Data Fields:
struct g2c_code_table * next
char title[G2C_MAX_GRIB_TITLE_LEN+1]
Keep information about dimensions defined in section 3.
Definition at line 185 of file grib2_int.h.
Data Fields:
size_t len Length of dimension.
char name[G2C_MAX_NAME+1] Name of
dimension.
float * value Array of dimension values.
An entry in a GRIB2 code table.
Definition at line 247 of file grib2_int.h.
Data Fields:
char desc[G2C_MAX_GRIB_DESC_LEN+1]
struct g2c_entry * next
char status[G2C_MAX_GRIB_STATUS_LEN+1]
This is the information about each open file.
Definition at line 237 of file grib2_int.h.
Data Fields:
int g2cid ID of the file.
G2C_MESSAGE_INFO_T * msg Information about each
message in the file.
size_t num_messages Number of messages in the file.
char path[G2C_MAX_NAME+1] Path of
the file.
This is the information about each message.
Definition at line 135 of file grib2_int.h.
Data Fields:
size_t bytes_to_bms Number of bytes in the message to the
bitmap section.
size_t bytes_to_data Number of bytes in the message to the
(first) data section.
size_t bytes_to_local Number of bytes in the message before
the (first) local section.
size_t bytes_to_msg Number of bytes to skip in the file, to
get to this message.
short center Originating center.
unsigned char day Day.
unsigned char discipline Discipline from section 0.
struct g2c_file_info * file Pointer to containing
file.
unsigned char hour Hour.
unsigned char local_version Version number of GRIB local
tables used to augment Master Tables.
unsigned char master_version GRIB master tables version
number.
unsigned char minute Minute.
unsigned char month Month.
size_t msg_num Number of message in file (0-based).
struct g2c_message_info * next Pointer to next in
list.
int num_fields Number of fields in the message.
int num_local Number of local sections in the message.
int num_sections Number of sections in the file.
struct g2c_section_info * sec List of section
metadata.
int sec1_len Length of section 1.
unsigned char second Second.
int section1[G2C_SECTION1_ARRAY_LEN]
Section 1 array.
int * section_number Array (length num_sections) of section
numbers.
size_t * section_offset Array (length num_sections) of byte
offsets from start of message to section.
unsigned char sig_ref_time Significance of reference time.
unsigned char status Production Status of Processed data in
the GRIB message.
short subcenter Originating subcenter.
unsigned char type Type of processed data in this GRIB
message.
short year Year.
An entry in the table of NOAA abbreviations for GRIB parameters.
Definition at line 264 of file grib2_int.h.
Data Fields:
int g1num GRIB1 parameter number.
int g1ver GRIB1 table version.
int g2cat GRIB2 category number.
int g2disc GRIB2 discipline.
int g2num GRIB2 parameter number.
Information about Section 3 GRID DEFINITION SECTION.
Definition at line 195 of file grib2_int.h.
Data Fields:
unsigned short grid_def Grid definition template number (=
N) (See Table 3.1).
unsigned char interp_list Interpetation of list of numbers
defining number of points (See Table 3.11).
unsigned int num_data_points Number of data points.
unsigned char num_opt Number of octets for optional list of
numbers defining number of points.
int * optional Optional list of numbers defining number of
points.
unsigned char source_grid_def Source of grid definition
(See Table 3.0).
Information about Section 4 PRODUCT DEFINITION SECTION.
Definition at line 208 of file grib2_int.h.
Data Fields:
unsigned short num_coord Number of coordinate values after
template.
int * optional Optional list of numbers defining number of
points.
unsigned short prod_def Product definition template number
(See Table 4.0).
Information about Section 5 DATA REPRESENTATION SECTION.
Definition at line 218 of file grib2_int.h.
Data Fields:
unsigned int num_data_points Number of data points where
one or more values are specified in Section 7 when a bit map is present,
total number of data points when a bit map is absent.
Information about Section 6 BIT-MAP SECTION.
Definition at line 229 of file grib2_int.h.
Data Fields:
Information about a section 3 through 7 in a GRIB2 message.
Definition at line 170 of file grib2_int.h.
Data Fields:
G2C_MESSAGE_INFO_T * msg Pointer to contianing
message.
struct g2c_section_info * next Pointer to next in
list.
struct g2c_section_info * prev Pointer to previous
in list.
int sec_id ID of the section (0-based).
void * sec_info Pointer to struct specific for section 3,
4, 5, 6, or 7.
unsigned int sec_len Length of the section (in bytes).
unsigned char sec_num Section number.
long long int * template Grid, product, or data template.
int template_len Number of entries in template.
Struct for GRIB template, returned by getgridtemplate().
Definition at line 277 of file grib2_int.h.
Data Fields:
g2int extlen Number of entries in the template
extension.
g2int * map Number of octets of each entry in the
static part of the template.
g2int maplen Number of entries in the static part of
the template.
g2int needext Indicates whether or not the template
needs to be extended.
g2int num The template number.
g2int type The template type: 3 Grid Defintion
Template.
4 Product Defintion Template. 5 Data Representation Template.
ln(2.0)
Definition at line 30 of file grib2_int.h.
Number of bits in a byte.
Definition at line 47 of file grib2_int.h.
Eight bytes.
Definition at line 53 of file grib2_int.h.
Pthreads not enabled, so do nothing.
Definition at line 113 of file grib2_int.h.
Four bytes.
Definition at line 52 of file grib2_int.h.
Read.
Definition at line 131 of file grib2_int.h.
Write.
Definition at line 132 of file grib2_int.h.
Length of the binary data section (bds) in index file.
Definition at line 73 of file grib2_int.h.
Length of the bitmap section (bms) in index file.
Definition at line 70 of file grib2_int.h.
Length of the gds in index file.
Definition at line 82 of file grib2_int.h.
Length of the grid definition section (gds) in index file.
Definition at line 67 of file grib2_int.h.
Length of the pds 2 section in the index file.
Definition at line 76 of file grib2_int.h.
Length of the pds 3 section in the index file.
Definition at line 79 of file grib2_int.h.
Length of the product definition section (pds) in index file.
Definition at line 64 of file grib2_int.h.
Name of JPEG codec in Jasper.
Definition at line 33 of file grib2_int.h.
GRIB magic header string.
Definition at line 39 of file grib2_int.h.
Full length of magic header string (includes GRIB version byte).
Definition at line 42 of file grib2_int.h.
Maximum number of messages in a file.
Definition at line 45 of file grib2_int.h.
Minimum acceptable value for max_bytes parameter of g2c_get_msg().
Definition at line 36 of file grib2_int.h.
Byte swap 64-bit ints. This converts native-endian 8-byte ints into big-endian 8-byte ints.
Definition at line 129 of file grib2_int.h.
Latitude.
Definition at line 56 of file grib2_int.h.
Ignore logging to stdout. Library was not built with LOGGING=ON.
Definition at line 428 of file grib2_int.h.
Longitude.
Definition at line 59 of file grib2_int.h.
Pthreads not enabled, so do nothing.
Definition at line 110 of file grib2_int.h.
Pthreads not enabled, so do nothing.
Definition at line 116 of file grib2_int.h.
Pthreads not enabled, so do nothing.
Definition at line 119 of file grib2_int.h.
Byte swap 64-bit ints. This converts big-endian 8-byte ints into native endian 8-byte ints.
Definition at line 125 of file grib2_int.h.
One byte.
Definition at line 50 of file grib2_int.h.
Two bytes.
Definition at line 51 of file grib2_int.h.
Number of bits in four bytes.
Definition at line 48 of file grib2_int.h.
An entry in a GRIB2 code table.
A GRIB2 code table.
Keep information about dimensions defined in section 3.
This is the information about each open file.
This is the information about each message.
An entry in the table of NOAA abbreviations for GRIB parameters.
Information about Section 3 GRID DEFINITION SECTION.
Information about Section 4 PRODUCT DEFINITION SECTION.
Information about Section 5 DATA REPRESENTATION SECTION.
Information about Section 6 BIT-MAP SECTION.
Information about a section 3 through 7 in a GRIB2 message.
Struct for GRIB template.
Definition at line 305 of file grib2_int.h.
Add new message to linked list.
Parameters
Returns
Author
Date
Definition at line 1017 of file g2cfile.c.
References g2c_message_info::bytes_in_msg, g2c_message_info::bytes_to_msg, g2c_message_info::file, G2C_ENOMEM, G2C_NOERROR, LOG, g2c_file_info::msg, g2c_message_info::msg_num, g2c_message_info::next, g2c_file_info::num_messages, and read_msg_metadata().
Referenced by g2c_open_index(), and read_metadata().
Add metadata about a new section 3, 4, 5, 6, or 7.
Parameters
Returns
Author
Date
Definition at line 794 of file g2cfile.c.
References g2c_section_info::bytes_to_sec, G2C_EBADSECTION, G2C_ENOMEM, G2C_FILE_READ, G2C_NOERROR, g2c_rw_section3_metadata(), g2c_rw_section4_metadata(), g2c_rw_section5_metadata(), g2c_rw_section6_metadata(), LOG, g2c_section_info::msg, g2c_section_info::next, g2c_message_info::num_local, g2c_section_info::prev, g2c_message_info::sec, g2c_section_info::sec_id, g2c_section_info::sec_len, and g2c_section_info::sec_num.
Referenced by g2c_open_index(), and read_msg_metadata().
This function packs up a float array into a AEC code stream. After the data are scaled, and the reference value is subtracted out, the data are passed to the AEC encoder.
This function also fills in GRIB2 Data Representation Template 5.42 with the appropriate values.
Parameters
cpack A pointer that will get the packed data field. Must
be allocated before this function is called. Pass the allocated size in the
lcpack parameter.
lcpack Pointer that gets the length of packed field in cpack. This must
be set by the calling function to the size available in cpack.
Author
Definition at line 297 of file aecpack.c.
References aecpack_int().
Referenced by g2_addfield().
Unpack AEC compressed data into an array of floats, using info from the GRIB2 Data Representation Template 5.42.
Parameters
Returns
Author
Date
Definition at line 161 of file aecunpack.c.
References aecunpack_int(), and LOG.
Referenced by g2c_unpack7_int().
Pack up a data field using a complex packing algorithm. This function supports GRIB2 complex packing templates with or without spatial differences (i.e. DRTs 5.2 and 5.3). It also fills in GRIB2 Data Representation Template 5.2 or 5.3 with the appropriate values.
Parameters
cpack The packed data field.
lcpack length of packed field cpack. Will be set to -1 if missing value
management field is not 1 or 2.
Author
Date
Definition at line 37 of file cmplxpack.c.
References compack(), and misspack().
Referenced by g2_addfield().
Pack a data field using a complex packing algorithm. This function supports GRIB2 complex packing templates with or without spatial differences (i.e. DRTs 5.2 and 5.3). It also fills in GRIB2 Data Representation Template 5.2 or Template 5.3 with the appropriate values.
Parameters
cpack The packed data field.
lcpack length of packed field cpack.
Author
Date
Definition at line 42 of file compack.c.
References ALOG2, int_power(), mkieee(), pack_gp(), sbit(), and sbits().
Referenced by cmplxpack().
Unpack a data field that was packed using a complex packing algorithm, 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).
Date Programmer Comments 2002-10-29 Gilbert Initial 2004-12-16 Gilbert Added test (from Arthur Taylor/MDL) verifying group widths/lengths
Parameters
Returns
Author
Date
Definition at line 41 of file comunpack.c.
References gbit(), gbits(), int_power(), LOG, and rdieee().
Referenced by g2c_unpack7_int().
Decode an AEC code stream specified in the CCSDS 121.0-B-3 Blue Book.
Parameters
Returns
Author
Date
Definition at line 38 of file decenc_aec.c.
References LOG.
Referenced by aecunpack_int().
Decode a JPEG2000 code stream specified in the JPEG2000 Part-1 standard (i.e., ISO/IEC 15444-1) using JasPer Software.
Parameters
Returns
Author
Definition at line 377 of file decenc_jpeg2000.c.
References int_dec_jpeg2000().
Referenced by jpcunpack_int().
Decode PNG.
Parameters
Returns
Author
Definition at line 127 of file decenc_png.c.
References G2C_PNG_HEIGHT_MAX, G2C_PNG_WIDTH_MAX, and user_read_data().
Referenced by g2c_dec_png(), and pngunpack_int().
Encode data into an AEC code stream specified in the CCSDS 121.0-B-3 Blue Book.
Parameters
Returns
Author
Date
Definition at line 108 of file decenc_aec.c.
References LOG.
Referenced by aecpack_int().
Encode a grayscale image into a JPEG2000 code stream specified in the JPEG2000 Part-1 standard (i.e., ISO/IEC 15444-1) using JasPer Software.
Parameters
ratio target compression ratio. (ratio:1) Used only when
ltype == 1.
retry If 1 try increasing number of guard bits.
outjpc Output encoded JPEG2000 code stream.
jpclen Number of bytes allocated for the output JPEG2000 code stream in
outjpc.
Returns
Note
Author
Date
Author
Definition at line 94 of file decenc_jpeg2000.c.
References G2_JASPER_ENCODE, G2_JASPER_INIT, G2C_JASPER_JPEG_FORMAT_NAME, LOG, and MAXOPTSSIZE.
Referenced by g2c_enc_jpeg2000(), and jpcpack_int().
Encode PNG.
Parameters
Returns
Author
Definition at line 259 of file decenc_png.c.
References user_flush_data(), and user_write_data().
Referenced by g2c_enc_png(), and pngpack_int().
This subroutine generates the remaining octet map for a given Data Representation Template, if required. Some Templates can vary depending on data values given in an earlier part of the Template, and it is necessary to know some of the earlier entry values to generate the full octet map of the Template.
Parameters
Returns
Author
Date
Definition at line 218 of file drstemplates.c.
References getdrsindex(), and getdrstemplate().
Referenced by g2_unpack5().
This subroutine generates the remaining octet map for a given Grid Definition Template, if required. Some Templates can vary depending on data values given in an earlier part of the Template, and it is necessary to know some of the earlier entry values to generate the full octet map of the Template.
This function allocates memory for the extension. The pointer ext in the gtemplate struct must be freed to prevent memory leaks.
Parameters
Returns
Author
Date
Definition at line 241 of file gridtemplates.c.
References getgridindex(), and getgridtemplate().
Referenced by g2_addgrid(), g2_unpack3(), and g2c_get_grid_template_extension().
This subroutine generates the remaining octet map for a given Product Definition Template, if required. Some Templates can vary depending on data values given in an earlier part of the Template, and it is necessary to know some of the earlier entry values to generate the full octet map of the Template.
This function allocates memory in the ext field of the gtemplate struct. This memory must be freed by the caller.
Parameters
Returns
Author
Date
Definition at line 553 of file pdstemplates.c.
References getpdsindex(), and getpdstemplate().
Referenced by g2_addfield(), g2_unpack4(), and g2c_get_pds_template_extension().
Open a GRIB2 file and add it to the list of open files.
Parameters
Returns
Author
Date
Definition at line 1143 of file g2cfile.c.
References find_available_g2cid(), G2C_EFILE, G2C_EINVAL, G2C_ENAMETOOLONG, g2c_file, G2C_MAX_NAME, G2C_NOERROR, G2C_WRITE, g2c_file_info::g2cid, LOG, g2c_file_info::msg, and g2c_file_info::num_messages.
Referenced by g2c_open(), and g2c_open_index().
Check for 'GRIB' at the beginning of a GRIB message, and check to see if the message is already terminated with '7777'.
Parameters
Returns
Author
Date
Definition at line 26 of file util.c.
References G2C_EMSGCOMPLETE, G2C_ENOTGRIB, G2C_NOERROR, and gbit().
Referenced by g2_addfield(), g2_addgrid(), g2_addlocal(), and g2_gribend().
Read or write a big-endian integer type to an open file, with conversion between native and big-endian format. GRIB2 handles negative numbers in a special way. Instead of storing two-compliments, like every other programmer and computing organization in the world, GRIB2 flips the first bit, then stores the rest of the int as an unsigned number in the remaining 31 bits. How exciting!
This function takes the excitement out of GRIB2 negative numbers.
Parameters
Returns
Author
Date
Definition at line 41 of file g2cio.c.
References BITSHIFT_15, BITSHIFT_31, BITSHIFT_63, BITSHIFT_7, EIGHT_BYTES, FOUR_BYTES, G2C_BYTE, G2C_EBADTYPE, G2C_EFILE, G2C_EINVAL, G2C_INT, G2C_INT64, G2C_NOERROR, G2C_SHORT, G2C_UBYTE, G2C_UINT, G2C_UINT64, G2C_USHORT, hton64, ntoh64, ONE_BYTE, and TWO_BYTES.
Referenced by g2c_file_io_byte(), g2c_file_io_int(), g2c_file_io_longlong(), g2c_file_io_short(), g2c_file_io_ubyte(), g2c_file_io_uint(), g2c_file_io_ulonglong(), and g2c_file_io_ushort().
Read or write a big-endian signed byte to an open GRIB2 file, with conversion between native and big-endian format, and special GRIB2 handling of negative numbers.
Parameters
Returns
Author
Definition at line 316 of file g2cio.c.
References G2C_BYTE, and g2c_file_io().
Referenced by g2c_file_io_template().
Read or write a big-endian 4-byte signed int to an open GRIB2 file, with conversion between native and big-endian format, and special GRIB2 handling of negative numbers.
Parameters
Returns
Author
Definition at line 230 of file g2cio.c.
References g2c_file_io(), and G2C_INT.
Referenced by g2c_file_io_template().
Read or write a big-endian signed long long to an open GRIB2 file, with conversion between native and big-endian format, and special GRIB2 handling of negative numbers.
Parameters
Returns
Author
Definition at line 359 of file g2cio.c.
References g2c_file_io(), and G2C_INT64.
Read or write a big-endian signed short to an open GRIB2 file, with conversion between native and big-endian format, and special GRIB2 handling of negative numbers.
Parameters
Returns
Author
Definition at line 273 of file g2cio.c.
References g2c_file_io(), and G2C_SHORT.
Referenced by g2c_file_io_template(), g2c_rw_section1_metadata(), g2c_start_index_record(), and g2c_start_index_record_lf().
Read or write a big-endian 4-byte int or unsigned int from or to an open file, with conversion between native and big-endian format, and handling of GRIB negative numbers. This is for template values.
With template values, if the map value is negative, then the template value may be negative.
Parameters
Returns
Author
Definition at line 408 of file g2cio.c.
References FOUR_BYTES, G2C_EBADTEMPLATE, g2c_file_io_byte(), g2c_file_io_int(), g2c_file_io_short(), g2c_file_io_ubyte(), g2c_file_io_uint(), g2c_file_io_ushort(), G2C_NOERROR, ONE_BYTE, and TWO_BYTES.
Referenced by g2c_rw_section3_metadata(), g2c_rw_section4_metadata(), and g2c_rw_section5_metadata().
Read or write a big-endian unsigned byte to an open GRIB2 file, with conversion between native and big-endian format.
Parameters
Returns
Author
Definition at line 337 of file g2cio.c.
References g2c_file_io(), and G2C_UBYTE.
Referenced by g2c_file_io_template(), g2c_open_index(), g2c_rw_section1_metadata(), g2c_rw_section3_metadata(), g2c_rw_section6_metadata(), g2c_start_index1_record(), g2c_start_index_record(), g2c_start_index_record_lf(), g2c_write_index(), and read_msg_metadata().
Read or write a big-endian 4-byte unsigned int to an open GRIB2 file, with conversion between native and big-endian format.
Parameters
Returns
Author
Definition at line 251 of file g2cio.c.
References g2c_file_io(), and G2C_UINT.
Referenced by g2c_file_io_template(), g2c_open_index(), g2c_rw_section1_metadata(), g2c_rw_section3_metadata(), g2c_rw_section5_metadata(), g2c_start_index1_record(), g2c_start_index_record(), g2c_start_index_record_lf(), g2c_write_index(), and read_msg_metadata().
Read or write a big-endian unsigned long long to an open GRIB2 file, with conversion between native and big-endian format.
Parameters
Returns
Author
Definition at line 380 of file g2cio.c.
References g2c_file_io(), and G2C_UINT64.
Referenced by g2c_start_index_record(), and g2c_start_index_record_lf().
Read or write a big-endian unsigned short to an open GRIB2 file, with conversion between native and big-endian format.
Parameters
Returns
Author
Definition at line 294 of file g2cio.c.
References g2c_file_io(), and G2C_USHORT.
Referenced by g2c_file_io_template(), g2c_rw_section3_metadata(), g2c_rw_section4_metadata(), and g2c_rw_section5_metadata().
Convert date and time from GRIB2 info to string output.
Note
Parameters
Returns
Author
Date
Definition at line 49 of file g2cdegrib2.c.
References G2C_DATE_TIME_LEN, and G2C_NOERROR.
Referenced by g2c_degrib2().
Determine the string that describes the level information, given the GRIB2 Product Definition Template information. This subroutine finds the 'Type of first fixed surface' (see [Code table 4.5](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-0.shtml)) using the product definition template value and product template array. The location in the template array varies depending on the template number.
Parameters
Returns
Author
Date
Definition at line 309 of file g2cdegrib2.c.
References format_level(), and G2C_NOERROR.
Referenced by g2c_degrib2().
Log section 0 information.
Parameters
Returns
Author
Date
Definition at line 101 of file g2cutil.c.
References g2c_message_info::center, g2c_message_info::day, g2c_message_info::discipline, g2c_csv_init(), g2c_find_desc(), G2C_MAX_GRIB_DESC_LEN, G2C_NOERROR, g2c_message_info::hour, g2c_message_info::local_version, LOG, g2c_message_info::master_version, g2c_message_info::minute, g2c_message_info::month, g2c_message_info::second, g2c_message_info::sig_ref_time, g2c_message_info::status, g2c_message_info::subcenter, g2c_message_info::type, and g2c_message_info::year.
Referenced by g2c_log_file(), and g2c_open_index().
Read Section 1.
Parameters
Returns
Author
Date
Definition at line 874 of file g2cfile.c.
References g2c_message_info::center, g2c_message_info::day, G2C_ENOSECTION, g2c_file_io_short(), g2c_file_io_ubyte(), g2c_file_io_uint(), G2C_NOERROR, G2C_SECTION1_BYTES, g2c_message_info::hour, g2c_message_info::local_version, LOG, g2c_message_info::master_version, g2c_message_info::minute, g2c_message_info::month, g2c_message_info::sec1_len, g2c_message_info::second, g2c_message_info::sig_ref_time, g2c_message_info::status, g2c_message_info::subcenter, g2c_message_info::type, and g2c_message_info::year.
Referenced by g2c_open_index(), g2c_write_index(), and read_msg_metadata().
Read the metadata from section 3 (Grid Definition Section) of a GRIB2 message. When this function is called, the file cursor is positioned just after the section number field in the section. The size of the section, and the section number, have already been read when this function is called.
Parameters
Returns
Author
Date
Definition at line 478 of file g2cfile.c.
References determine_dims(), G2C_EINVAL, G2C_ENOMEM, g2c_file_io_template(), g2c_file_io_ubyte(), g2c_file_io_uint(), g2c_file_io_ushort(), g2c_get_grid_template(), G2C_MAX_GDS_TEMPLATE_MAPLEN, G2C_NOERROR, g2c_section3_info::grid_def, g2c_section3_info::interp_list, LOG, g2c_section3_info::num_data_points, g2c_section3_info::num_opt, g2c_section_info::sec_info, g2c_section_info::sec_num, g2c_section3_info::source_grid_def, g2c_section_info::template, and g2c_section_info::template_len.
Referenced by add_section(), and g2c_write_index().
Read or write the metadata from section 4 (Product Definition Section) of a GRIB2 message. When this function is called, the file cursor is positioned just after the section number field in the section. The size of the section, and the section number, have already been read/written when this function is called.
Parameters
Returns
Author
Date
Definition at line 574 of file g2cfile.c.
References G2C_EINVAL, G2C_ENOMEM, g2c_file_io_template(), g2c_file_io_ushort(), g2c_get_pds_template(), G2C_MAX_PDS_TEMPLATE_MAPLEN, G2C_NOERROR, LOG, g2c_section_info::msg, g2c_section4_info::num_coord, g2c_message_info::num_fields, g2c_section4_info::prod_def, g2c_section_info::sec_info, g2c_section_info::sec_num, g2c_section_info::template, and g2c_section_info::template_len.
Referenced by add_section(), and g2c_write_index().
Read or write the metadata from section 5 (Data Representation Section) of a GRIB2 message. When this function is called, the file cursor is positioned just after the section number field in the section. The size of the section, and the section number, have already been read when this function is called.
Parameters
Returns
Author
Date
Definition at line 663 of file g2cfile.c.
References g2c_section5_info::data_def, G2C_EINVAL, G2C_ENOMEM, g2c_file_io_template(), g2c_file_io_uint(), g2c_file_io_ushort(), g2c_get_drs_template(), G2C_MAX_PDS_TEMPLATE_MAPLEN, G2C_NOERROR, LOG, g2c_section5_info::num_data_points, g2c_section_info::sec_info, g2c_section_info::template, and g2c_section_info::template_len.
Referenced by add_section(), and g2c_write_index().
Read or write the metadata from section 6 (Data Representation Section) of a GRIB2 message. When this function is called, the file cursor is positioned just after the section number field in the section. The size of the section, and the section number, have already been read when this function is called.
Parameters
Returns
Author
Date
Definition at line 745 of file g2cfile.c.
References G2C_EINVAL, G2C_ENOMEM, g2c_file_io_ubyte(), G2C_NOERROR, g2c_section6_info::indicator, LOG, and g2c_section_info::sec_info.
Referenced by add_section().
Get arbitrary size values from a packed bit string, right justifying each value in the unpacked iout array.
Parameters
Author
Definition at line 20 of file gbits.c.
References gbits().
Referenced by comunpack(), g2_addfield(), g2_addgrid(), g2_addlocal(), g2_getfld(), g2_gribend(), g2_info(), g2_unpack1(), g2_unpack2(), g2_unpack3(), g2_unpack4(), g2_unpack5(), g2_unpack6(), g2c_check_msg(), g2c_unpack7_int(), and seekgb().
Unpack arbitrary size values from a packed bit string, right justifying each value in the unpacked iout array.
Parameters
Author
Definition at line 57 of file gbits.c.
Referenced by aecunpack_int(), comunpack(), g2_unpack3(), g2_unpack4(), g2_unpack6(), g2c_gbits_int(), gbit(), pngunpack_int(), simunpack(), and specunpack().
Return the dimensions and scanning mode of a grid definition.
Parameters
Returns
Author
Date
Definition at line 27 of file getdim.c.
References g2_unpack3().
Referenced by g2_addfield().
This subroutine returns DRS template information for a specified Data Representation Template. The number of entries in the template is returned along with a map of the number of octets occupied by each entry. Also, a flag is returned to indicate whether the template would need to be extended.
Parameters
Returns
Author
Date
Definition at line 172 of file drstemplates.c.
References getdrsindex(), and templatesdrs.
Referenced by extdrstemplate(), g2_addfield(), and g2_unpack5().
This subroutine returns grid template information for a specified Grid Definition Template for [Section 3 - the Grid Definition Section (GDS)](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_sect3.shtml). The number of entries in the template is returned along with a map of the number of octets occupied by each entry. Also, a flag is returned to indicate whether the template would need to be extended.
This function allocates storage for the template. The returned pointer must be freed by the caller.
Parameters
Returns
Author
Date
Definition at line 193 of file gridtemplates.c.
References getgridindex(), and templatesgrid.
Referenced by extgridtemplate(), g2_addgrid(), and g2_unpack3().
This subroutine returns PDS template information for a specified Product Definition Template. The number of entries in the template is returned along with a map of the number of octets occupied by each entry. Also, a flag is returned to indicate whether the template would need to be extended.
This function allocates memory for the gtemplate struct, which must be freed by the caller.
Parameters
Returns
Author
Date
Definition at line 504 of file pdstemplates.c.
References getpdsindex(), and templatespds.
Referenced by extpdstemplate(), g2_addfield(), and g2_unpack4().
This subroutine returns the J, K, and M pentagonal resolution parameters specified in a GRIB Grid Definition Section (GDS) used spherical harmonic coefficients using GDT 5.50 through 5.53. If 51 - complex data spectral packing is used as the data representation template number (see Table 5.0), then the Grid Definition Template Number in section 3 should be one of:
Parameters
Returns
Note
Author
Date
Definition at line 40 of file getpoly.c.
References g2_unpack3().
Referenced by g2_addfield().
Function similar to C pow() power function.
Parameters
Returns
Author
Definition at line 18 of file int_power.c.
Referenced by aecpack_int(), aecunpack_int(), compack(), comunpack(), jpcpack_int(), jpcunpack_int(), misspack(), mkieee(), pngpack_int(), pngunpack_int(), rdieee(), simpack(), simunpack(), and specunpack().
This function packs up a float array into a JPEG2000 code stream. After the data are scaled, and the reference value is subtracted out, the data are treated as a grayscale image and passed to a JPEG2000 encoder.
This function also fills in GRIB2 Data Representation Template 5.40 or 5.40000 with the appropriate values.
Parameters
cpack A pointer that will get the packed data field. Must
be allocated before this function is called. Pass the allocated size in the
lcpack parameter.
lcpack Pointer that gets the length of packed field in cpack. This must
be set by the calling function to the size available in cpack.
Author
Definition at line 269 of file jpcpack.c.
References jpcpack_int().
Referenced by g2_addfield().
Unpack JPEG2000 compressed data into an array of floats, using info from the GRIB2 Data Representation Template 5.40 or 5.40000.
Parameters
Returns
Author
Date
Definition at line 123 of file jpcunpack.c.
References G2_JPCUNPACK_MEM, jpcunpack_int(), and LOG.
Referenced by g2c_unpack7_int().
Pack a data field using a complex packing algorithm. This funciton supports GRIB2 complex packing templates with or without spatial differences (See Template 5.2 and Template 5.3).
This function fills in GRIB2 Data Representation template arrays with the appropriate values.
Parameters
cpack The packed data field (character*1 array).
lcpack length of packed field cpack.
Author
Date
Definition at line 43 of file misspack.c.
References ALOG2, int_power(), mkieee(), pack_gp(), rdieee(), sbit(), and sbits().
Referenced by cmplxpack().
Store a list of real values in 32-bit IEEE floating point format.
Parameters
Author
Date
Definition at line 22 of file mkieee.c.
References int_power().
Referenced by aecpack_int(), compack(), g2_addfield(), jpcpack_int(), misspack(), pngpack_int(), simpack(), and specpack().
Determines groups of variable size, but at least of size minpk, the associated max (jmax( )) and min (jmin( )), the number of bits necessary to hold the values in each group (lbit( )), the number of values in each group (nov( )), the number of bits necessary to pack the jmin( ) values (ibit), the number of bits necessary to pack the lbit( ) values (jbit), and the number of bits necessary to pack the nov( ) values (kbit). The routine is designed to determine the groups such that a small number of bits is necessary to pack the data without excessive computations. If all values in the group are zero, the number of bits to use in packing is defined as zero when there can be no missing values; when there can be missing values, the number of bits must be at least 1 to have the capability to recognize the missing value. However, if all values in a group are missing, the number of bits needed is 0, and the unpacker recognizes this. All variables are g2int. Even though the groups are initially of size minpk or larger, an adjustment between two groups (the lookback procedure) may make a group smaller than minpk. The control on group size is that the sum of the sizes of the two consecutive groups, each of size minpk or larger, is not decreased. When determining the number of bits necessary for packing, the largest value that can be accommodated in, say, mbits, is 2**mbits-1; this largest value (and the next smallest value) is reserved for the missing value indicator (only) when is523 ne 0. If the dimension ndg is not large enough to hold all the groups, the local value of minpk is increased by 50 percent. This is repeated until ndg will suffice. A diagnostic is printed whenever this happens, which should be very rarely. If it happens often, ndg in subroutine pack should be increased and a corresponding increase in subroutine unpack made. Considerable code is provided so that no more checking for missing values within loops is done than necessary; the added efficiency of this is relatively minor, but does no harm. For grib2, the reference value for the length of groups in nov( ) and for the number of bits necessary to pack group values are determined, and subtracted before jbit and kbit are determined.
When 1 or more groups are large compared to the others, the width of all groups must be as large as the largest. A subroutine reduce breaks up large groups into 2 or more to reduce total bits required. If reduce should abort, pack_gp will be executed again without the call to reduce.
PROGRAM HISTORY LOG:
DATA SET USE
Parameters
Returns
INTERNAL VARIABLES
cfeed = contains the character representation of a printer form feed. ifeed = contains the g2int value of a printer form feed. kinc = working copy of inc. may be modified. mina = minimum value in group a. maxa = maximum value in group a. nenda = the place in ic( ) where group a ends. kstart = the place in ic( ) where group a starts. ibita = number of bits needed to hold values in group a. minb = minimum value in group b. maxb = maximum value in group b. nendb = the place in ic( ) where group b ends. ibitb = number of bits needed to hold values in group b. minc = minimum value in group c. maxc = maximum value in group c. ktotal = count of number of values in ic( ) processed. nount = number of values added to group a. lmiss = 0 when is523 = 0. when packing into a specific number of bits, say mbits, the maximum value that can be handled is 2**mbits-1. when is523 = 1, indicating primary missing values, this maximum value is reserved to hold the primary missing value indicator and lmiss = 1. when is523 = 2, the value just below the maximum i.e., 2**mbits-2 is reserved to hold the secondary missing value indicator and lmiss = 2. lminpk = local value of minpk. this will be adjusted upward whenever ndg is not large enough to hold all the groups. mallow = the largest allowable value for packing. mislla = set to 1 when all values in group a are missing. this is used to distinguish between a real minimum when all values are not missing and a minimum that has been set to zero when all values are missing. 0 otherwise. note that this does not distinguish between primary and secondary missings when secondary missings are present. this means that lbit( ) will not be zero with the resulting compression efficiency when secondary missings are present. also note that a check has been made earlier to determine that secondary missings are really there. misllb = set to 1 when all values in group b are missing. this is used to distinguish between a real minimum when all values are not missing and a minimum that has been set to zero when all values are missing. 0 otherwise. misllc = performs the same function for group c that mislla and misllb do for groups b and c, respectively. ibxx2(j) = an array that when this routine is first entered is set to 2**j, j=0,30. ibxx2(30) = 2**30, which is the largest value packable, because 2**31 is larger than the g2int word size. ifirst = set by data statement to 0. changed to 1 on first entry when ibxx2( ) is filled. minak = keeps track of the location in ic( ) where the minimum value in group a is located. maxak = does the same as minak, except for the maximum. minbk = the same as minak for group b. maxbk = the same as maxak for group b. minck = the same as minak for group c. maxck = the same as maxak for group c. adda = keeps track whether or not an attempt to add points to group a was made. if so, then adda keeps from trying to put one back into b. (g2int) ibitbs = keeps current value if ibitb so that loop ending at 166 doesn't have to start at ibitb = 0 every time. misslx(j) = mallow except when a group is all one value (and lbit(j) = 0) and that value is missing. in that case, misslx(j) is missp or misss. this gets inserted into jmin(j) later as the missing indicator; it can't be put in until the end, because jmin( ) is used to calculate the maximum number of bits (ibits) needed to pack jmin( ).
Definition at line 255 of file pack_gp.c.
References FALSE_, reduce(), and TRUE_.
Referenced by compack(), and misspack().
This subroutine packs up a float data field into PNG image format. After the data field is scaled, and the reference value is subtracted out, it is treated as a grayscale image and passed to a PNG encoder. It also fills in GRIB2 Data Representation Template 5.41 or 5.40010 with the appropriate values.
Parameters
cpack The packed data field.
lcpack length of packed field cpack.
Author
Date
Author
Definition at line 254 of file pngpack.c.
References pngpack_int().
Referenced by g2_addfield().
This subroutine unpacks a data field that was packed into a PNG image format using info from the GRIB2 Data Representation Template 5.41 or 5.40010.
Parameters
Returns
Author
Date
Author
Definition at line 126 of file pngunpack.c.
References G2_JPCUNPACK_MEM, G2C_ENOMEM, and pngunpack_int().
Referenced by g2c_unpack7_int().
Read a list of real values in 32-bit IEEE floating point format.
Parameters
Author
Date
Definition at line 20 of file rdieee.c.
References int_power().
Referenced by aecunpack_int(), comunpack(), g2_miss(), g2_unpack4(), g2c_unpack7_int(), jpcunpack_int(), misspack(), pngunpack_int(), simunpack(), and specunpack().
Store arbitrary size values into a packed bit string, taking the low order bits from each value in the unpacked array.
Parameters
Author
Definition at line 38 of file gbits.c.
References sbits().
Referenced by compack(), g2_addfield(), g2_addgrid(), g2_addlocal(), g2_create(), g2_gribend(), misspack(), and simpack().
Store arbitrary size values into a packed bit string, taking the low order bits from each value in the unpacked array.
Parameters
Author
Definition at line 178 of file gbits.c.
Referenced by aecpack_int(), compack(), g2_addfield(), g2_addgrid(), jpcpack_int(), misspack(), pngpack_int(), sbit(), and simpack().
Packs a data field using the simple packing algorithm. This function also fills in GRIB2 Data Representation Template 5.0 with the appropriate values.
Parameters
cpack The packed data field
lcpack length of packed field starting at cpack.
Author
Date
Definition at line 36 of file simpack.c.
References ALOG2, int_power(), LOG, mkieee(), sbit(), and sbits().
Referenced by g2_addfield(), and specpack().
Unpack a data field that was packed using a simple packing algorithm, using info from the GRIB2 Data Representation Template 5.0.
Parameters
Returns
Author
Date
Definition at line 28 of file simunpack.c.
References G2_JPCUNPACK_MEM, G2_NO_ERROR, gbits(), int_power(), LOG, and rdieee().
Referenced by g2c_unpack7_int().
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
Author
Date
Definition at line 33 of file specpack.c.
References mkieee(), and simpack().
Referenced by g2_addfield().
Unpack a spectral data field that was packed using the complex packing algorithm for spherical harmonic data as defined in the GRIB2 documention, using info from the GRIB2 Data Representation Template 5.51.
Parameters
Returns
Author
Date
Definition at line 35 of file specunpack.c.
References G2_NO_ERROR, G2_SPECUNPACK_TYPE, gbits(), int_power(), and rdieee().
Referenced by g2c_unpack7_int().
Generated automatically by Doxygen for NCEPLIBS-g2c from the source code.
Version 2.1.0 | NCEPLIBS-g2c |