From dcd93f9fc565e38c45dbcf4de0ccfc4e51a584db Mon Sep 17 00:00:00 2001
From: Edward Hartnett
@@ -34,10 +34,10 @@
-
+
@@ -88,8 +88,19 @@
-
- Cgribfield Struct for GRIB field
+ Cgtemplate Struct for GRIB template
+ Cg2c_code_table A GRIB2 code table
+ Cg2c_dim_info Keep information about dimensions defined in section 3
+ Cg2c_entry An entry in a GRIB2 code table
+ Cg2c_file_info This is the information about each open file
+ Cg2c_message_info This is the information about each message
+ Cg2c_param An entry in the table of NOAA abbreviations for GRIB parameters
+ Cg2c_section3_info Information about Section 3 GRID DEFINITION SECTION
+ Cg2c_section4_info Information about Section 4 PRODUCT DEFINITION SECTION
+ Cg2c_section5_info Information about Section 5 DATA REPRESENTATION SECTION
+ Cg2c_section6_info Information about Section 6 BIT-MAP SECTION
+ Cg2c_section_info Information about a section 3 through 7 in a GRIB2 message
+ Cgribfield Struct for GRIB field Cgtemplate Struct for GRIB template, returned by getgridtemplate()
@@ -34,10 +34,10 @@
-
+
@@ -86,26 +86,18 @@
@@ -34,10 +34,10 @@
-
+
@@ -197,9 +197,7 @@
diff --git a/cmplxpack_8c_source.html b/cmplxpack_8c_source.html
index c0072b1d..5e06ebc2 100644
--- a/cmplxpack_8c_source.html
+++ b/cmplxpack_8c_source.html
@@ -3,7 +3,7 @@
-
+
-
+
@@ -34,10 +34,10 @@
-
+
@@ -90,7 +90,7 @@
-
+
@@ -104,20 +104,18 @@
-
-
-
@@ -34,10 +34,10 @@
-
+
@@ -187,7 +187,7 @@
Definition at line 42 of file compack.c.
References ALOG2, int_power(), mkieee(), pack_gp(), sbit(), and sbits().
+References ALOG2, int_power(), mkieee(), pack_gp(), sbit(), and sbits().
Referenced by cmplxpack().
@@ -199,9 +199,7 @@Date | Programmer | Comments | Date | Programmer | Comments |
---|---|---|
2002-10-29 | Gilbert | Initial | 2002-10-29 | Gilbert | Initial |
2004-12-16 | Gilbert | Added test (from Arthur Taylor/MDL) verifying group widths/lengths | 2004-12-16 | Gilbert | Added test (from Arthur Taylor/MDL) verifying group widths/lengths |
NCEPLIBS-g2c
- 1.7.0
+ 1.8.0
|
Decodes JPEG2000 code stream.
-Date | Programmer | Comments |
---|---|---|
2002-12-02 | Gilbert | Initial |
2022-04-15 | Hartnett | Converted to use jas_ instead of jpc_ functions. |
Definition in file dec_jpeg2000.c.
This Function decodes a JPEG2000 code stream specified in the JPEG2000 Part-1 standard (i.e., ISO/IEC 15444-1) using JasPer Software.
-Date | Programmer | Comments | |||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
2002-12-02 | Gilbert | Initial | |||||||||||||||||||
2022-04-15 | Hartnett | Converted to use jas_ instead of jpc_ functions. |
injpc | Pointer to buffer that holds the input JPEG2000 code stream. |
bufsize | Length (in bytes) of the buffer that holds the input JPEG2000 code stream. |
outfld | Pointer to g2int array, already allocated, that gets the unpacked data. |
Definition at line 201 of file dec_jpeg2000.c.
+ +References int_dec_jpeg2000().
+ +Referenced by jpcunpack_int().
+ + + + +int g2c_dec_jpeg2000 | +( | +char * | +injpc, | +
+ | + | size_t | +bufsize, | +
+ | + | int * | +outfld | +
+ | ) | ++ |
This Function decodes a JPEG2000 code stream specified in the JPEG2000 Part-1 standard (i.e., ISO/IEC 15444-1) using JasPer Software.
+injpc | Pointer to buffer that holds the input JPEG2000 code stream. |
bufsize | Length (in bytes) of the buffer that holds the input JPEG2000 code stream. |
outfld | Pointer to int array, already allocated, that gets the unpacked data. |
Definition at line 174 of file dec_jpeg2000.c.
+ +References int_dec_jpeg2000().
+ +
+
|
+ +static | +
This Function decodes a JPEG2000 code stream specified in the JPEG2000 Part-1 standard (i.e., ISO/IEC 15444-1) using JasPer Software.
injpc | Input JPEG2000 code stream. |
bufsize | Length (in bytes) of the input JPEG2000 code stream. |
outfld | Output matrix of grayscale image values. |
injpc | Pointer to buffer that holds the input JPEG2000 code stream. |
bufsize | Length (in bytes) of the buffer that holds the input JPEG2000 code stream. |
outfld | Pointer to either int or g2int array, already allocated, that gets the unpacked data. |
out_is_g2int | Non-zero if the output array is of type g2int (i.e. 64-bit ints), zero if output is an int array (32-bits). |
Definition at line 38 of file dec_jpeg2000.c.
+Definition at line 44 of file dec_jpeg2000.c.
-References G2_JASPER_DECODE, G2_JASPER_DECODE_COLOR, G2_JASPER_INIT, and G2C_JASPER_JPEG_FORMAT_NAME.
+References G2_JASPER_DECODE, G2_JASPER_DECODE_COLOR, G2_JASPER_INIT, G2C_JASPER_JPEG_FORMAT_NAME, G2C_JASPER_MAX_MEM, and LOG.
-Referenced by jpcunpack_int().
+Referenced by dec_jpeg2000(), and g2c_dec_jpeg2000().
Definition at line 1 of file dec_png.c.
@@ -195,7 +195,7 @@Referenced by pngunpack_int().
+Referenced by pngunpack_int().
@@ -254,9 +254,7 @@
+ NCEPLIBS-g2c
+ 1.8.0
+
+ |
+
+Files | |
file | g2c_compare.c [code] |
This is a utility to compare two GRIB2 files. | |
file | g2c_degrib2.c [code] |
This is a utility to print a summary of a GRIB2 file. | |
file | g2c_index.c [code] |
Print a summary of a GRIB1 or GRIB2 index file. | |
Functions for GRIB2 Data Representation Templates (DRT) for the Data Representation Setcion. More...
-#include <stdlib.h>
#include "grib2_int.h"
#include "grib2_int.h"
Go to the source code of this file.
-Macros | |
#define | MAXDRSMAPLEN 200 |
maximum template map length More... | |
#define | MAXDRSTEMP 9 |
maximum number of templates More... | |
Functions | |
gtemplate * | extdrstemplate (g2int number, g2int *list) |
This subroutine generates the remaining octet map for a given Data Representation Template, if required. More... | |
int | g2c_get_drs_template (int drs_template_num, int *maplen, int *map, int *needext) |
Get DRS template information. More... | |
static g2int | getdrsindex (g2int number) |
This function returns the index of specified Data Representation Template. More... | |
Variables | |
static const struct drstemplate | templatesdrs [MAXDRSTEMP] |
Stuct holding data for GRIB2 Data Representation Section (DRS) template. More... | |
static const struct drstemplate | templatesdrs [G2C_MAX_DRS_TEMPLATE] |
Stuct holding data for GRIB2 Data Representation Section (DRS) template. More... | |
Functions for GRIB2 Data Representation Templates (DRT) for the Data Representation Setcion.
@@ -137,54 +129,19 @@Date | Programmer | Comments | Date | Programmer | Comments |
---|---|---|
2001-06-28 | Gilbert | Initial | 2001-06-28 | Gilbert | Initial |
2009-01-14 | Vuong | Changed structure name template to gtemplate | 2009-01-14 | Vuong | Changed structure name template to gtemplate | +
2022-10-18 | Hartnett | Added g2c_get_drs_template(). |
Definition in file drstemplates.c.
-#define MAXDRSMAPLEN 200 | -
maximum template map length
- -Definition at line 39 of file drstemplates.c.
- -#define MAXDRSTEMP 9 | -
maximum number of templates
- -Definition at line 38 of file drstemplates.c.
- -Definition at line 212 of file drstemplates.c.
+Definition at line 208 of file drstemplates.c.
-References getdrsindex(), and getdrstemplate().
+References getdrsindex(), and getdrstemplate().
Referenced by g2_unpack5().
+int g2c_get_drs_template | +( | +int | +drs_template_num, | +
+ | + | int * | +maplen, | +
+ | + | int * | +map, | +
+ | + | int * | +needext | +
+ | ) | ++ |
Get DRS template information.
+The DRS template consists of a template map, and its length. There are no supported DRS templates with extensions.
+drs_template_num | The DRS template number. |
maplen | Pointer that gets the length of the map. Ignored if NULL. |
map | Pointer that gets the map as an array of int. Memory must be allocated by caller. Ignored if NULL. |
needext | Pointer that a non-zero value if an extension to this template is needed. Ignored if NULL. |
Definition at line 256 of file drstemplates.c.
+ +References G2C_ENOTEMPLATE, G2C_MAX_DRS_TEMPLATE, G2C_NOERROR, and templatesdrs.
+ +Referenced by g2c_rw_section5_metadata().
+Definition at line 134 of file drstemplates.c.
+Definition at line 130 of file drstemplates.c.
-References MAXDRSTEMP, and templatesdrs.
+References G2C_MAX_DRS_TEMPLATE, and templatesdrs.
-Referenced by extdrstemplate(), and getdrstemplate().
+Referenced by extdrstemplate(), and getdrstemplate().
@@ -303,17 +325,17 @@Definition at line 166 of file drstemplates.c.
+Definition at line 162 of file drstemplates.c.
-References getdrsindex(), and templatesdrs.
+References getdrsindex(), and templatesdrs.
-Referenced by extdrstemplate(), g2_addfield(), and g2_unpack5().
+Referenced by extdrstemplate(), g2_addfield(), and g2_unpack5().
const struct drstemplate templatesdrs[MAXDRSTEMP] | +const struct drstemplate templatesdrs[G2C_MAX_DRS_TEMPLATE] |
Definition at line 1 of file drstemplates.c.
-Referenced by getdrsindex(), and getdrstemplate().
+Referenced by g2c_get_drs_template(), getdrsindex(), and getdrstemplate().
Encodes JPEG2000 code stream.
@@ -205,18 +208,136 @@This Function encodes a grayscale image into a JPEG2000 code stream specified in the JPEG2000 Part-1 standard (i.e., ISO/IEC 15444-1) using JasPer Software.
+Date | Programmer | Comments |
---|---|---|
2002-12-02 | Gilbert | Initial |
2004-12-16 | Gilbert | Added retry argument allowing increased guard bits. |
2022-04-15 | Hartnett | Converted to use jas_ instead of jpc_ functions. |
cin | Packed matrix of Grayscale image values to encode. |
width | width of image. |
height | height of image. |
nbits | depth (in bits) of image. i.e number of bits used to hold each data value. |
ltype | indicator of lossless or lossy compression.
|
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. |
Definition at line 100 of file enc_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().
+ +int g2c_enc_jpeg2000 | +( | +unsigned char * | +cin, | +
+ | + | int | +width, | +
+ | + | int | +height, | +
+ | + | int | +nbits, | +
+ | + | int | +ltype, | +
+ | + | int | +ratio, | +
+ | + | int | +retry, | +
+ | + | char * | +outjpc, | +
+ | + | size_t | +jpclen | +
+ | ) | ++ |
This Function encodes a grayscale image into a JPEG2000 code stream specified in the JPEG2000 Part-1 standard (i.e., ISO/IEC 15444-1) using JasPer Software.
Date | Programmer | Comments | Date | Programmer | Comments |
---|---|---|
2002-12-02 | Gilbert | Initial | 2002-12-02 | Gilbert | Initial |
2004-12-16 | Gilbert | Added retry argument allowing increased guard bits. | 2004-12-16 | Gilbert | Added retry argument allowing increased guard bits. |
2022-04-15 | Hartnett | Converted to use jas_ instead of jpc_ functions. | 2022-04-15 | Hartnett | Converted to use jas_ instead of jpc_ functions. |
NCEPLIBS-g2c
- 1.7.0
+ 1.8.0
|
Definition at line 1 of file enc_png.c.
@@ -205,7 +205,7 @@Referenced by pngpack_int().
+Referenced by pngpack_int().
@@ -295,9 +295,7 @@This routine is used with routines g2_create(), g2_addlocal(), g2_addgrid(), and g2_gribend() to create a complete GRIB2 message. Function g2_create() must be called first to initialize a new GRIB2 message. Function g2_addgrid() must be called after g2_create() and before this routine to add the appropriate grid description to the GRIB2 message. A call to g2_gribend() is required to complete GRIB2 message after all fields have been added.
-Date | Programmer | Comments | Date | Programmer | Comments |
---|---|---|
2002-11-05 | Gilbert | Initial | 2002-11-05 | Gilbert | Initial |
2002-12-23 | Gilbert | Added complex spherical harmonic packing | 2002-12-23 | Gilbert | Added complex spherical harmonic packing |
2003-08-27 | Gilbert | Added support for new templates using PNG and JPEG2000 algorithms/templates. | 2003-08-27 | Gilbert | Added support for new templates using PNG and JPEG2000 algorithms/templates. |
2004-11-29 | Gilbert | JPEG2000 now can use WMO Template 5.40 PNG can use WMO Template 5.41. Added packing algorithm check. | 2004-11-29 | Gilbert | JPEG2000 now can use WMO Template 5.40 PNG can use WMO Template 5.41. Added packing algorithm check. |
2005-05-10 | Gilbert | Imposed minimum size on cpack. | 2005-05-10 | Gilbert | Imposed minimum size on cpack. |
2009-01-14 | Vuong | Changed structure name template to gtemplate | 2009-01-14 | Vuong | Changed structure name template to gtemplate |
It is used with routines g2_create(), g2_addlocal(), g2_addfield(), and g2_gribend() to create a complete GRIB2 message. g2_create() must be called first to initialize a new GRIB2 message.
-Date | Programmer | Comments | Date | Programmer | Comments |
---|---|---|
2002-11-01 | Gilbert | Initial. | 2002-11-01 | Gilbert | Initial. |
2009-01-14 | Vuong | Changed structure name template to gtemplate | 2009-01-14 | Vuong | Changed structure name template to gtemplate |
NCEPLIBS-g2c
- 1.7.0
+ 1.8.0
|
References G2_ADD_MSG_COMPLETE, G2_ADD_MSG_INIT, G2_BAD_SEC, G2_BAD_SEC_COUNTS, g2c_check_msg(), G2C_MSG_COMPLETE, G2C_NOT_GRIB, gbit(), and sbit().
+References G2_ADD_MSG_COMPLETE, G2_ADD_MSG_INIT, G2_BAD_SEC, G2_BAD_SEC_COUNTS, g2c_check_msg(), G2C_EMSGCOMPLETE, G2C_ENOTGRIB, gbit(), and sbit().
@@ -174,9 +174,7 @@References G2_CREATE_GRIB_VERSION, LENSEC0, MAPSEC1LEN, and sbit().
+References G2_CREATE_GRIB_VERSION, LENSEC0, MAPSEC1LEN, and sbit().
@@ -238,9 +238,7 @@References gribfield::bmap, gribfield::coord_list, gribfield::fld, gribfield::idrtmpl, gribfield::idsect, gribfield::igdtmpl, gribfield::ipdtmpl, gribfield::list_opt, and gribfield::local.
+References gribfield::bmap, gribfield::coord_list, gribfield::fld, gribfield::idrtmpl, gribfield::idsect, gribfield::igdtmpl, gribfield::ipdtmpl, gribfield::list_opt, and gribfield::local.
Referenced by g2_getfld().
@@ -150,9 +150,7 @@Since there can be multiple data fields packed into a GRIB2 message, the calling routine indicates which field is being requested with the ifldnum argument.
-Date | Programmer | Comments | Date | Programmer | Comments |
---|---|---|
2002-10-28 | Gilbert | Initial | 2002-10-28 | Gilbert | Initial |
2013-08-08 | Vuong | Free up memory in array igds - free(igds) | 2013-08-08 | Vuong | Free up memory in array igds - free(igds) |
References G2_ADD_MSG_COMPLETE, G2_ADD_MSG_INIT, G2_BAD_SEC, G2_BAD_SEC_COUNTS, g2c_check_msg(), G2C_MSG_COMPLETE, G2C_NOT_GRIB, gbit(), and sbit().
+References G2_ADD_MSG_COMPLETE, G2_ADD_MSG_INIT, G2_BAD_SEC, G2_BAD_SEC_COUNTS, g2c_check_msg(), G2C_EMSGCOMPLETE, G2C_ENOTGRIB, gbit(), and sbit().
@@ -156,9 +156,7 @@cgrib | Character pointer to the GRIB2 message. | ||||||||||||||||
listsec0 | pointer to an array containing information decoded from GRIB Indicator Section 0. Must be allocated with >= 3 elements.
cgrib | Pointer to a buffer containing the GRIB2 message. | listsec0 | Pointer to an array that gets the information decoded from GRIB Indicator Section 0. Must be allocated with >= 3 elements (see G2C_SECTION0_LEN). | listsec1 | Pointer to an array containing information read from GRIB Identification Section 1. Must be allocated with >= 13 elements. |
listsec1 | Pointer to an array that gets the information read from GRIB Identification Section 1. Must be allocated with >= 13 elements (see G2C_SECTION1_LEN).
| numfields | The number of gridded fields found in the GRIB message. That is, the number of occurences of Sections 4 - 7. | numlocal | The number of Local Use Sections ( Section 2 ) found in the GRIB message. | numfields | A pointer that gets the number of gridded fields found in the GRIB message. That is, the number of occurences of Sections 4 - 7. | numlocal | A pointer that gets the number of Local Use Sections (section 2) found in the GRIB message. | |
Definition at line 67 of file g2_info.c.
+Definition at line 68 of file g2_info.c.
-References G2_INFO_BAD_END, G2_INFO_GRIB_VERSION, G2_INFO_INVAL_SEC, G2_INFO_NO_GRIB, G2_INFO_NO_SEC1, G2_INFO_WRONG_END, and gbit().
+References G2_INFO_BAD_END, G2_INFO_GRIB_VERSION, G2_INFO_INVAL_SEC, G2_INFO_NO_GRIB, G2_INFO_NO_SEC1, G2_INFO_WRONG_END, gbit(), and LOG.
@@ -210,9 +210,7 @@References gribfield::idrtmpl, gribfield::idrtnum, and rdieee().
+References gribfield::idrtmpl, gribfield::idrtnum, and rdieee().
@@ -164,9 +164,7 @@References G2_NO_ERROR, G2_UNPACK_BAD_SEC, G2_UNPACK_NO_MEM, and gbit().
+References G2_NO_ERROR, G2_UNPACK_BAD_SEC, G2_UNPACK_NO_MEM, and gbit().
Referenced by g2_getfld().
@@ -196,9 +196,7 @@This subroutine unpacks Section 2 (Local Use Section) as defined in GRIB Edition 2.
-Date | Programmer | Comments | Date | Programmer | Comments |
---|---|---|
2002-10-31 | Gilbert | Initial | 2002-10-31 | Gilbert | Initial |
2008-12-23 | Wesley | Initialize lencsec2 Length of Local Use data | 2008-12-23 | Wesley | Initialize lencsec2 Length of Local Use data |
2010-08-05 | Vuong | If section 2 has zero length, ierr=0 | 2010-08-05 | Vuong | If section 2 has zero length, ierr=0 |
NCEPLIBS-g2c
- 1.7.0
+ 1.8.0
|
Unpack Section 3 (Grid Definition Section) as defined in GRIB Edition 2. +
Unpack Section 3 (Grid Definition Section) from a GRIB2 message. More...
#include <stdio.h>
#include <stdlib.h>
Unpack Section 3 (Grid Definition Section) as defined in GRIB Edition 2.
+Unpack Section 3 (Grid Definition Section) from a GRIB2 message.
This routine unpacks Section 3 (Grid Definition Section) as defined in GRIB Edition 2.
-This routine unpacks Section 3 (Grid Definition Section) from a GRIB2 message.
+Date | Programmer | Comments | Date | Programmer | Comments |
---|---|---|
2002-10-31 | Gilbert | Initial | 2002-10-31 | Gilbert | Initial |
2009-01-14 | Vuong | Changed structure name template to gtemplate | 2009-01-14 | Vuong | Changed structure name template to gtemplate |
cgrib | Char array ontaining Section 3 of the GRIB2 message. | ||||||||||||||||||
iofst | Bit offset for the beginning of Section 3 in cgrib. | ||||||||||||||||||
igds | Contains information read from the appropriate GRIB Grid Definition Section 3 for the field being returned.
iofst | Pointer to g2int which contains the bit offset for the beginning of Section 3 in cgrib. | igds | Pointer to a pointer which will get a pointer to memory allocated for the GDS array, of length 5. The array will contain information read from the appropriate GRIB Grid Definition Section 3 for the field being returned. | igdstmpl | Pointer to integer array containing the data values for the Grid Definition Template specified by igds[4]. | mapgridlen | Number of elements in igdstmpl. i.e. number of entries in Grid Defintion Template specified by igds[4]. | igdstmpl | Pointer a pointer to g2int, which will get a pointer to an allocated array that contians containing the data values from the Grid Definition Template specified by igds[4]. | mapgridlen | A pointer tat gets the number of elements in igdstmpl. i.e. number of entries in Grid Defintion Template specified by igds[4]. | ideflist | (Used if igds[2] .ne. 0) Pointer to integer array containing the number of grid points contained in each row (or column). | idefnum | (Used if igds[2] .ne. 0) The number of entries in array ideflist - i.e. number of rows (or columns) for which optional grid points are defined. | idefnum | (Used if igds[2] != 0.) A pointer that gets the number of entries in array ideflist - i.e. number of rows (or columns) for which optional grid points are defined. | |
Definition at line 57 of file g2_unpack3.c.
+Definition at line 62 of file g2_unpack3.c.
-References gtemplate::ext, extgridtemplate(), gtemplate::extlen, G2_NO_ERROR, G2_UNPACK3_BAD_GDT, G2_UNPACK_BAD_SEC, G2_UNPACK_NO_MEM, gbit(), gbits(), getgridtemplate(), gtemplate::map, gtemplate::maplen, and gtemplate::needext.
+References gtemplate::ext, extgridtemplate(), gtemplate::extlen, G2_NO_ERROR, G2_UNPACK3_BAD_GDT, G2_UNPACK_BAD_SEC, G2_UNPACK_NO_MEM, gbit(), gbits(), getgridtemplate(), gtemplate::map, gtemplate::maplen, and gtemplate::needext.
Referenced by g2_getfld(), getdim(), and getpoly().
@@ -220,9 +220,7 @@This subroutine unpacks Section 4 (Product Definition Section) as defined in GRIB Edition 2.
-Date | Programmer | Comments | Date | Programmer | Comments |
---|---|---|
2002-10-31 | Gilbert | Initial | 2002-10-31 | Gilbert | Initial |
2009-01-14 | Vuong | Changed structure name template to gtemplate | 2009-01-14 | Vuong | Changed structure name template to gtemplate |
NCEPLIBS-g2c
- 1.7.0
+ 1.8.0
|
This subroutine unpacks Section 5 (Data Representation Section) as defined in GRIB Edition 2.
-Date | Programmer | Comments | Date | Programmer | Comments |
---|---|---|
2002-10-31 | Gilbert | Initial | 2002-10-31 | Gilbert | Initial |
2009-01-14 | Vuong | Changed structure name template to gtemplate | 2009-01-14 | Vuong | Changed structure name template to gtemplate |
NCEPLIBS-g2c
- 1.7.0
+ 1.8.0
|
References G2_NO_ERROR, G2_UNPACK_BAD_SEC, G2_UNPACK_NO_MEM, gbit(), and gbits().
+References G2_NO_ERROR, G2_UNPACK_BAD_SEC, G2_UNPACK_NO_MEM, gbit(), and gbits().
Referenced by g2_getfld().
@@ -195,9 +195,7 @@Unpack Section 7 (Data Section) as defined in GRIB Edition 2. More...
-#include <stdio.h>
#include <stdlib.h>
#include <memory.h>
Unpack Section 7 (Data Section) as defined in GRIB Edition 2.
-Date | Programmer | Comments |
---|---|---|
2002-10-31 | Gilbert | Initial |
2002-12-20 | Gilbert | Added GDT info to arguments and added 5.51 processing. |
2003-08-29 | Gilbert | New templates using PNG and JPEG2000 algorithms/templates. |
2004-11-29 | Gilbert | JPEG2000 now allowed to use WMO Template 5.40 PNG allowed to use 5.41 |
2004-12-16 | Taylor | Added check on comunpack return code. |
2008-12-23 | Wesley | Initialize Number of data points unpacked. |
2022-10-04 | Hartnett | Added g2c_unpack7(). |
Definition in file g2_unpack7.c.
This subroutine unpacks Section 7 (Data Section) as defined in GRIB Edition 2.
-Date | Programmer | Comments |
---|---|---|
2002-10-31 | Gilbert | Initial |
2002-12-20 | Gilbert | Added GDT info to arguments and added 5.51 processing. |
2003-08-29 | Gilbert | New templates using PNG and JPEG2000 algorithms/templates. |
2004-11-29 | Gilbert | JPEG2000 now allowed to use WMO Template 5.40 PNG allowed to use 5.41 |
2004-12-16 | Taylor | Added check on comunpack return code. |
2008-12-23 | Wesley | Initialize Number of data points unpacked |
This subroutine unpacks Section 7 (Data Section) of a GRIB2 message.
+This function is maintained for backward compatibility. Users may wish to use the newer g2c_unpack7() function instead.
cgrib | char array containing Section 7 of the GRIB2 message |
iofst | Bit offset of the beginning of Section 7 in cgrib. |
igdsnum | Grid Definition Template Number (see Code Table 3.0) (Only used for DRS Template 5.51) |
iofst | Pointer to a bit offset of the beginning of Section 7 in cgrib. This is updated by this function to reflect the data read in this function. After this function is successfully called, the value pointed to by iofst will be the number of bits to the end of section 7 in cbuf. |
igdsnum | Grid Definition Template Number (see Code Table 3.0). (Only used for DRS Template 5.51.) |
igdstmpl | Pointer to an integer array containing the data values for the specified Grid Definition Template (N=igdsnum). Each element of this integer array contains an entry (in the order specified) of Grid Definition Template 3.N. (Only used for DRS Template 5.51). |
idrsnum | Data Representation Template Number (see Code Table 5.0) |
idrsnum | Data Representation Template Number (see Code Table 5.0). |
idrstmpl | Pointer to an integer array containing the data values for the specified Data Representation Template (N=idrsnum). Each element of this integer array contains an entry (in the order specified) of Data Representation Template 5.N |
ndpts | Number of data points unpacked and returned. |
fld | Pointer to a float array containing the unpacked data field. |
ndpts | Number of data points to be unpacked and returned. |
fld | Pointer to a float pointer which gets a pointer to an array allocated by this function to hold the unpacked data. This memory must be freed by the caller. |
Definition at line 55 of file g2_unpack7.c.
+Definition at line 207 of file g2_unpack7.c.
-References comunpack(), G2_NO_ERROR, G2_UNPACK7_BAD_DRT, G2_UNPACK7_CORRUPT_SEC, G2_UNPACK7_WRONG_GDT, G2_UNPACK_BAD_SEC, G2_UNPACK_NO_MEM, gbit(), jpcunpack(), pngunpack(), rdieee(), simunpack(), and specunpack().
+References g2c_unpack7_int().
Referenced by g2_getfld().
+int g2c_unpack7 | +( | +unsigned char * | +cgrib, | +
+ | + | int | +igdsnum, | +
+ | + | int | +gds_tmpl_len, | +
+ | + | long long int * | +gdstmpl, | +
+ | + | int | +idrsnum, | +
+ | + | int | +drs_tmpl_len, | +
+ | + | long long int * | +drstmpl, | +
+ | + | int | +ndpts, | +
+ | + | float * | +fld | +
+ | ) | ++ |
This subroutine unpacks Section 7 (Data Section) of a GRIB2 message.
+This function is the newer version of g2_unpack7().
+cgrib | char array containing Section 7 of the GRIB2 message |
igdsnum | Grid Definition Template Number (see Code Table 3.0). (Only used for DRS Template 5.51.) May be zero for other templates. |
gds_tmpl_len | Number of elements in the GDS template. |
gdstmpl | Pointer to an integer array containing the data values for the specified Grid Definition Template (N=igdsnum). Each element of this integer array contains an entry (in the order specified) of Grid Definition Template 3.N. (Only used for DRS Template 5.51). May be NULL. |
idrsnum | Data Representation Template Number (see Code Table 5.0). |
drs_tmpl_len | Number of elements in the DRS template. |
drstmpl | Pointer to an integer array containing the data values for the specified Data Representation Template (N=idrsnum). Each element of this integer array contains an entry (in the order specified) of Data Representation Template 5.N |
ndpts | Number of data points to be unpacked and returned. |
fld | Pointer which the data. Memory must be allocated in advance by caller. |
Definition at line 252 of file g2_unpack7.c.
+ +References G2C_EINVAL, G2C_ENOMEM, g2c_unpack7_int(), and LOG.
+ +Referenced by g2c_get_prod().
+ +
+
|
+ +static | +
This subroutine unpacks Section 7 (Data Section) of a GRIB2 message.
+This function is the internal function called by both g2_unpack7() and g2c_unpack7().
+cgrib | char array containing Section 7 of the GRIB2 message |
iofst | Pointer to a bit offset of the beginning of Section 7 in cgrib. This is updated by this function to reflect the data read in this function. After this function is successfully called, the value pointed to by iofst will be the number of bits to the end of section 7 in cbuf. |
igdsnum | Grid Definition Template Number (see Code Table 3.0). (Only used for DRS Template 5.51. May be 0 for other templates.) |
igdstmpl | Pointer to an integer array containing the data values for the specified Grid Definition Template (N=igdsnum). Each element of this integer array contains an entry (in the order specified) of Grid Definition Template 3.N. (Only used for DRS Template 5.51, may be NULL for other templates). |
idrsnum | Data Representation Template Number (see Code Table 5.0). |
idrstmpl | Pointer to an integer array containing the data values for the specified Data Representation Template (N=idrsnum). Each element of this integer array contains an entry (in the order specified) of Data Representation Template 5.N |
ndpts | Number of data points to be unpacked and returned. |
v1 | If non-zero, then act like the V1 G2C API. This includes:
|
fld | Pointer to a float pointer which gets a pointer to an array allocated by this function to hold the unpacked data. This memory must be freed by the caller. |
Definition at line 67 of file g2_unpack7.c.
+ +References comunpack(), G2_NO_ERROR, G2_UNPACK7_BAD_DRT, G2_UNPACK7_CORRUPT_SEC, G2_UNPACK7_WRONG_GDT, G2_UNPACK_BAD_SEC, G2_UNPACK_NO_MEM, gbit(), jpcunpack(), LOG, pngunpack(), rdieee(), simunpack(), and specunpack().
+ +Referenced by g2_unpack7(), and g2c_unpack7().
+
+ NCEPLIBS-g2c
+ 1.8.0
+
+ |
+
This is a utility to compare two GRIB2 files. +More...
+#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <grib2.h>
Go to the source code of this file.
++Functions | |
int | main (int argc, char **argv) |
Compare two GRIB2 files. More... | |
This is a utility to compare two GRIB2 files.
+ +Definition in file g2c_compare.c.
+int main | +( | +int | +argc, | +
+ | + | char ** | +argv | +
+ | ) | ++ |
Compare two GRIB2 files.
+argc | Number of arguments. |
argv | Pointer to array of arguments. |
Definition at line 24 of file g2c_compare.c.
+ +References g2c_close(), g2c_compare(), G2C_ENOMEM, G2C_ERROR, G2C_NOWRITE, g2c_open(), g2c_set_log_level(), and G2C_VERSION.
+ +
+ NCEPLIBS-g2c
+ 1.8.0
+
+ |
+
+ NCEPLIBS-g2c
+ 1.8.0
+
+ |
+
This is a utility to print a summary of a GRIB2 file. +More...
+#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <grib2.h>
Go to the source code of this file.
++Functions | |
int | main (int argc, char **argv) |
Compare two GRIB2 files. More... | |
This is a utility to print a summary of a GRIB2 file.
+ +Definition in file g2c_degrib2.c.
+int main | +( | +int | +argc, | +
+ | + | char ** | +argv | +
+ | ) | ++ |
Compare two GRIB2 files.
+argc | Number of arguments. |
argv | Pointer to array of arguments. |
Definition at line 24 of file g2c_degrib2.c.
+ +References g2c_close(), g2c_degrib2(), G2C_ENOMEM, G2C_ERROR, G2C_NOWRITE, g2c_open(), and G2C_VERSION.
+ +
+ NCEPLIBS-g2c
+ 1.8.0
+
+ |
+
+ NCEPLIBS-g2c
+ 1.8.0
+
+ |
+
Print a summary of a GRIB1 or GRIB2 index file. +More...
+#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <grib2.h>
Go to the source code of this file.
++Functions | |
int | main (int argc, char **argv) |
Print a summary of a GRIB1 or GRIB2 index file. More... | |
Print a summary of a GRIB1 or GRIB2 index file.
+ +Definition in file g2c_index.c.
+int main | +( | +int | +argc, | +
+ | + | char ** | +argv | +
+ | ) | ++ |
Print a summary of a GRIB1 or GRIB2 index file.
+argc | Number of arguments. |
argv | Pointer to array of arguments. |
Definition at line 26 of file g2c_index.c.
+ +References G2C_ENOMEM, G2C_ERROR, and G2C_VERSION.
+ +
+ NCEPLIBS-g2c
+ 1.8.0
+
+ |
+
+ NCEPLIBS-g2c
+ 1.8.0
+
+ |
+
Compare the metadata of two open GRIB2 files. +More...
+ +Go to the source code of this file.
++Functions | |
int | g2c_compare (int g2cid1, int g2cid2) |
Compare the metadata of two open GRIB2 files. More... | |
+Variables | |
G2C_FILE_INFO_T | g2c_file [G2C_MAX_FILES+1] |
Global file information. More... | |
Compare the metadata of two open GRIB2 files.
+ +Definition in file g2ccompare.c.
+int g2c_compare | +( | +int | +g2cid1, | +
+ | + | int | +g2cid2 | +
+ | ) | ++ |
Compare the metadata of two open GRIB2 files.
+g2cid1 | Indentifier for one file. |
g2cid2 | Indentifier for the other file. |
Definition at line 28 of file g2ccompare.c.
+ +References g2c_message_info::center, g2c_section5_info::data_def, g2c_message_info::day, g2c_message_info::discipline, G2C_EBADID, G2C_ENOSECTION, G2C_ERROR, g2c_file, G2C_MAX_FILES, G2C_NOERROR, g2c_section3_info::grid_def, g2c_message_info::hour, g2c_section3_info::interp_list, g2c_message_info::local_version, LOG, g2c_message_info::master_version, g2c_message_info::minute, g2c_message_info::month, g2c_file_info::msg, g2c_message_info::next, g2c_section_info::next, g2c_section4_info::num_coord, g2c_section3_info::num_data_points, g2c_section5_info::num_data_points, g2c_message_info::num_fields, g2c_message_info::num_local, g2c_file_info::num_messages, g2c_section3_info::num_opt, g2c_section_info::prev, g2c_section4_info::prod_def, g2c_message_info::sec, g2c_section_info::sec_info, g2c_section_info::sec_num, g2c_message_info::second, g2c_message_info::sig_ref_time, g2c_section3_info::source_grid_def, g2c_message_info::status, g2c_message_info::subcenter, g2c_section_info::template, g2c_section_info::template_len, g2c_message_info::type, and g2c_message_info::year.
+ +Referenced by main().
+ +
+
|
+ +extern | +
Global file information.
+ +Definition at line 30 of file g2cfile.c.
+ +Referenced by g2c_compare().
+ +
+ NCEPLIBS-g2c
+ 1.8.0
+
+ |
+
+ NCEPLIBS-g2c
+ 1.8.0
+
+ |
+
Write summary output to a file, as is done by utility grb2index. +More...
+ +Go to the source code of this file.
++Macros | |
#define | G2C_DATE_TIME_LEN 25 |
Size of the date/time string. More... | |
#define | G2C_MAX_TYPE_OF_FIXED_SURFACE_LEN 40 |
Maximum length of "Type of first fixed surface" string. More... | |
+Functions | |
static int | format_level (char *cbuf, int ival, int scale) |
Format the level string for degrib2 output. More... | |
int | g2c_degrib2 (int g2cid, const char *fileout) |
Write a summary file like the degrib2 utility. More... | |
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. More... | |
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. More... | |
+Variables | |
G2C_FILE_INFO_T | g2c_file [G2C_MAX_FILES+1] |
Global file information. More... | |
G2C_CODE_TABLE_T * | g2c_table |
Pointer to the list of code tables. More... | |
Write summary output to a file, as is done by utility grb2index.
+ +Definition in file g2cdegrib2.c.
+#define G2C_DATE_TIME_LEN 25 | +
Size of the date/time string.
+ +Definition at line 21 of file g2cdegrib2.c.
+ +#define G2C_MAX_TYPE_OF_FIXED_SURFACE_LEN 40 | +
Maximum length of "Type of first fixed surface" string.
+ +Definition at line 19 of file g2cdegrib2.c.
+ +
+
|
+ +static | +
Format the level string for degrib2 output.
+cbuf | Character buffer of length 11 which will get the formatted level description. |
ival | Integer value which may need scaling. |
scale | Scaling factor information. |
Definition at line 229 of file g2cdegrib2.c.
+ +References G2C_NOERROR.
+ +Referenced by g2c_get_level_desc().
+ +int g2c_degrib2 | +( | +int | +g2cid, | +
+ | + | const char * | +fileout | +
+ | ) | ++ |
Write a summary file like the degrib2 utility.
+g2cid | Indentifier for the file, returned by g2c_open() or g2c_create(). |
fileout | Path of output file. Any existing file of this name will be overwritten. |
Definition at line 566 of file g2cdegrib2.c.
+ +References g2c_message_info::bytes_in_msg, g2c_message_info::bytes_to_msg, g2c_message_info::center, g2c_section5_info::data_def, g2c_message_info::day, g2c_message_info::discipline, G2C_EBADID, G2C_EFILE, G2C_EINVAL, G2C_ENOSECTION, G2C_ERROR, g2c_file, g2c_get_datetime(), g2c_get_level_desc(), g2c_get_prod(), G2C_MAX_FILES, G2C_MAX_NOAA_ABBREV_LEN, G2C_MAX_TYPE_OF_FIXED_SURFACE_LEN, G2C_NOERROR, g2c_param_abbrev(), g2c_section3_info::grid_def, g2c_message_info::hour, g2c_section6_info::indicator, g2c_section3_info::interp_list, g2c_message_info::local_version, LOG, g2c_message_info::master_version, g2c_message_info::minute, g2c_message_info::month, g2c_section_info::msg, g2c_message_info::msg_num, g2c_message_info::next, g2c_section_info::next, g2c_section4_info::num_coord, g2c_section3_info::num_data_points, g2c_section5_info::num_data_points, g2c_message_info::num_fields, g2c_message_info::num_local, g2c_section3_info::num_opt, g2c_section3_info::optional, g2c_section_info::prev, g2c_section4_info::prod_def, g2c_message_info::sec, g2c_section_info::sec_info, g2c_section_info::sec_len, g2c_section_info::sec_num, g2c_message_info::second, g2c_message_info::sig_ref_time, g2c_section3_info::source_grid_def, g2c_message_info::status, g2c_message_info::subcenter, g2c_section_info::template, g2c_section_info::template_len, g2c_message_info::type, and g2c_message_info::year.
+ +Referenced by main().
+ +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.
+[in] | ipdtn | Product Definition Template Number (Code Table 4.0). |
ipdtmpl | Array of data values for the Product Definition Template specified by ipdtn. | |
year | year | |
month | month | |
day | day | |
hour | hour | |
minute | minute | |
second | second | |
tabbrev | Character array that will get the date and time string. Must be of length 100. |
Definition at line 49 of file g2cdegrib2.c.
+ +References G2C_DATE_TIME_LEN, and G2C_NOERROR.
+ +Referenced by g2c_degrib2().
+ +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.
+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.
+ipdtn | Product Definition Template Number (Code Table 4.0). |
ipdtmpl | Array of data values for the Product Definition Template specified by ipdtn. |
level_desc | Character array which gets the string describing the level. Must be of length 40. |
Definition at line 282 of file g2cdegrib2.c.
+ +References format_level(), and G2C_NOERROR.
+ +Referenced by g2c_degrib2().
+ +
+
|
+ +extern | +
Global file information.
+ +Definition at line 10 of file g2cfile.c.
+ +Referenced by g2c_degrib2().
+ +
+
|
+ +extern | +
+ NCEPLIBS-g2c
+ 1.8.0
+
+ |
+
+ NCEPLIBS-g2c
+ 1.8.0
+
+ |
+
File functions for the g2c library. +More...
+#include "grib2_int.h"
Go to the source code of this file.
++Macros | |
#define | BYTES_TO_DISCIPLINE 6 |
Number of bytes to discipline field in GRIB2 message. More... | |
#define | G2C_SEEKMSG_BUFSIZE 4092 |
Size of buffer used in g2c_seekmsg(). More... | |
#define | MIN(a, b) ((a) < (b) ? (a) : (b)) |
Find a minimum. More... | |
#define | READ_BUF_SIZE 4092 |
Default size of read-buffer. More... | |
+Functions | |
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. More... | |
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. More... | |
static int | determine_dims (G2C_SECTION_INFO_T *sec) |
Determine the dimension information from the section 3 metadata. More... | |
static int | find_available_g2cid (int *g2cid) |
Find a g2cid to use for a newly opened or created file. More... | |
static int | free_metadata (int g2cid) |
Free resources holding the file metadata. More... | |
int | g2c_add_file (const char *path, int mode, int *g2cid) |
Open a GRIB2 file and add it to the list of open files. More... | |
int | g2c_close (int g2cid) |
Close a GRIB2 file, freeing resources. More... | |
int | g2c_find_msg2 (int g2cid, size_t skip_bytes, size_t max_bytes, size_t *bytes_to_msg, size_t *bytes_in_msg) |
Search a file for the next GRIB1 or GRIB2 message. More... | |
int | g2c_get_msg (int g2cid, size_t skip_bytes, size_t max_bytes, size_t *bytes_to_msg, size_t *bytes_in_msg, unsigned char **cbuf) |
Search a file for the next GRIB1 or GRIB2 message, and read it, allocating space in memory to hold the message. More... | |
int | g2c_open (const char *path, int mode, int *g2cid) |
Open an existing GRIB2 file. More... | |
int | g2c_rw_section1_metadata (FILE *f, int rw_flag, G2C_MESSAGE_INFO_T *msg) |
Read Section 1. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
int | g2c_seekmsg (int g2cid, size_t skip, size_t *offset, size_t *msglen) |
Search a file for the next GRIB2 Message. More... | |
MUTEX (m) | |
Define mutex for thread-safety. More... | |
static int | read_metadata (int g2cid) |
Read metadata from a GRIB2 file being opened with g2c_open(). More... | |
static int | read_msg_metadata (G2C_MESSAGE_INFO_T *msg) |
Read the file to get metadata about a message. More... | |
+Variables | |
G2C_FILE_INFO_T | g2c_file [G2C_MAX_FILES+1] |
Global file information. More... | |
int | g2c_next_g2cid = 1 |
Next g2cid file ID - used when opening or creating a file. More... | |
#define BYTES_TO_DISCIPLINE 6 | +
#define G2C_SEEKMSG_BUFSIZE 4092 | +
Size of buffer used in g2c_seekmsg().
+ + + +#define MIN | +( | ++ | a, | +
+ | + | + | b | +
+ | ) | +((a) < (b) ? (a) : (b)) | +
#define READ_BUF_SIZE 4092 | +
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.
+file | Pointer to the G2C_FILE_INFO_T for this file. |
msg_num | Number of the message in file (0-based). |
bytes_to_msg | Number of bytes to the start of the message in the file. |
bytes_in_msg | Length of message in bytes. |
read_file | Set to true to cause metadata to be read from a GRIB2 data file. |
msg | Pointer to a pointer that will get the location of the newly created G2C_MESSAGE_INFO_T object. Ignored if NULL. |
Definition at line 1020 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().
+ +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.
+f | FILE pointer to open GRIB2 file. |
msg | Pointer to the G2C_MESSAGE_INFO_T struct. |
sec_id | 0-based section ID. |
sec_len | Length of section. |
bytes_to_sec | Number of bytes from start of message to this section. |
sec_num | Section number. |
Definition at line 797 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().
+ +
+
|
+ +static | +
Determine the dimension information from the section 3 metadata.
+See (GRIB2 - SECTION 3 GRID DEFINITION SECTION)[https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_sect3.shtml].
+For a list of grid definitions see [GRIB2 - TABLE 3.1 Grid Definition Template Number](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table3-1.shtml).
+sec | G2C_SECTION3_INFO_T struct. |
Definition at line 418 of file g2cfile.c.
+ +References g2c_section3_info::dim, G2C_ENOMEM, G2C_MAX_NAME, G2C_NOERROR, g2c_section3_info::grid_def, LATITUDE, g2c_dim_info::len, LOG, LONGITUDE, g2c_dim_info::name, g2c_section_info::sec_info, g2c_section_info::template, and g2c_dim_info::value.
+ +Referenced by g2c_rw_section3_metadata().
+ +
+
|
+ +static | +
Find a g2cid to use for a newly opened or created file.
+g2cid | Pointer that gets the next available g2cid. |
Definition at line 365 of file g2cfile.c.
+ +References G2C_EINVAL, G2C_ETOOMANYFILES, g2c_file, G2C_MAX_FILES, g2c_next_g2cid, and G2C_NOERROR.
+ +Referenced by g2c_add_file().
+ +
+
|
+ +static | +
Free resources holding the file metadata.
+g2cid | Indentifier for the file. |
Definition at line 1294 of file g2cfile.c.
+ +References G2C_EBADID, g2c_file, G2C_MAX_FILES, G2C_NOERROR, LOG, g2c_file_info::msg, g2c_message_info::next, g2c_section_info::next, g2c_message_info::sec, g2c_section_info::sec_info, g2c_section_info::sec_num, and g2c_section_info::template.
+ +Referenced by g2c_close().
+ +int g2c_add_file | +( | +const char * | +path, | +
+ | + | int | +mode, | +
+ | + | int * | +g2cid | +
+ | ) | ++ |
Open a GRIB2 file and add it to the list of open files.
+path | Path of the file. |
mode | Open mode flags. |
g2cid | Pointer that gets an indentifier for the file. |
Definition at line 1146 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().
+ +int g2c_close | +( | +int | +g2cid | ) | ++ |
Close a GRIB2 file, freeing resources.
+g2cid | Indentifier for the file. |
Definition at line 1357 of file g2cfile.c.
+ +References g2c_file_info::f, free_metadata(), G2C_EBADID, G2C_EFILE, g2c_file, G2C_MAX_FILES, G2C_NOERROR, g2c_file_info::g2cid, LOG, MUTEX_LOCK, MUTEX_UNLOCK, g2c_file_info::num_messages, and g2c_file_info::path.
+ +Referenced by main().
+ +int g2c_find_msg2 | +( | +int | +g2cid, | +
+ | + | size_t | +skip_bytes, | +
+ | + | size_t | +max_bytes, | +
+ | + | size_t * | +bytes_to_msg, | +
+ | + | size_t * | +bytes_in_msg | +
+ | ) | ++ |
Search a file for the next GRIB1 or GRIB2 message.
+A grib message is identified by its indicator section, i.e. an 8-byte sequence with 'GRIB' in bytes 1-4 and a '1' or '2' in byte 8. If found, the length of the message is decoded from bytes 5-7. The search is done over a given section of the file. The search is terminated if an eof or i/o error is encountered.
+g2cid | ID of the opened grib file, returned by g2c_open(). |
skip_bytes | Number of bytes to skip before search. |
max_bytes | Maximum number of bytes to search. |
bytes_to_msg | Pointer that gets the number of bytes to skip before message. |
bytes_in_msg | Pointer that gets the number of bytes in message (or 0 if no message found) |
Definition at line 164 of file g2cfile.c.
+ +References G2C_EBADID, G2C_EFILE, G2C_EINVAL, G2C_EMSG, G2C_ENOMEM, G2C_ERROR, g2c_file, G2C_MAGIC_HEADER_LEN, G2C_NOERROR, LOG, MIN, and READ_BUF_SIZE.
+ +int g2c_get_msg | +( | +int | +g2cid, | +
+ | + | size_t | +skip_bytes, | +
+ | + | size_t | +max_bytes, | +
+ | + | size_t * | +bytes_to_msg, | +
+ | + | size_t * | +bytes_in_msg, | +
+ | + | unsigned char ** | +cbuf | +
+ | ) | ++ |
Search a file for the next GRIB1 or GRIB2 message, and read it, allocating space in memory to hold the message.
+A grib message is identified by its indicator section, i.e. an 8-byte sequence with 'GRIB' in bytes 1-4 and a '1' or '2' in byte 8. If found, the length of the message is decoded from bytes 5-7. The search is done over a given section of the file. The search is terminated if an EOF or I/O error is encountered.
+g2cid | ID of the opened grib file, returned by g2c_open(). |
skip_bytes | The number of bytes to skip before search. |
max_bytes | The maximum number of bytes to search. Must be at least 16. |
bytes_to_msg | A pointer that gets the number of bytes to skip before message. |
bytes_in_msg | A pointer that gets the number of bytes in message (or 0 if no message found) |
cbuf | A pointer that gets allocation of memory, into which the message is copied. This memory must be freed by the caller. |
Definition at line 293 of file g2cfile.c.
+ +References G2C_EBADID, G2C_EFILE, G2C_EINVAL, G2C_ENOMEM, G2C_ENOMSG, G2C_ERROR, g2c_file, G2C_MIN_MAX_BYTES, G2C_NOERROR, LOG, and seekgb().
+ +int g2c_open | +( | +const char * | +path, | +
+ | + | int | +mode, | +
+ | + | int * | +g2cid | +
+ | ) | ++ |
Open an existing GRIB2 file.
+path | Path of the file. |
mode | Open mode flags. |
g2cid | Pointer that gets an indentifier for the file. |
Definition at line 1193 of file g2cfile.c.
+ +References g2c_add_file(), MUTEX_LOCK, MUTEX_UNLOCK, and read_metadata().
+ +Referenced by main().
+ +int g2c_rw_section1_metadata | +( | +FILE * | +f, | +
+ | + | int | +rw_flag, | +
+ | + | G2C_MESSAGE_INFO_T * | +msg | +
+ | ) | ++ |
Read Section 1.
+f | Pointer to open file. |
rw_flag | G2C_FILE_WRITE if function should write, G2C_FILE_READ if it should read. |
msg | Pointer to G2C_MESSAGE_INFO_T which will be populated with the values of section 0. |
Definition at line 877 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().
+ +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.
+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.
+f | FILE pointer to open GRIB2 file. |
rw_flag | G2C_FILE_WRITE if function should write, G2C_FILE_READ (0) if it should read. |
sec | Pointer to the G2C_SECTION_INFO_T struct. |
Definition at line 481 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().
+ +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.
+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.
+f | FILE pointer to open GRIB2 file. |
rw_flag | G2C_FILE_WRITE if function should write, G2C_FILE_READ if it should read. |
sec | Pointer to the G2C_SECTION_INFO_T struct. |
Definition at line 577 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().
+ +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.
+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.
+f | FILE pointer to open GRIB2 file. |
rw_flag | G2C_FILE_WRITE if function should write, G2C_FILE_READ if it should read. |
sec | Pointer to the G2C_SECTION_INFO_T struct. |
Definition at line 666 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().
+ +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.
+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.
+f | FILE pointer to open GRIB2 file. |
rw_flag | G2C_FILE_WRITE if function should write, G2C_FILE_READ if it should read. |
sec | Pointer to the G2C_SECTION_INFO_T struct. |
Definition at line 748 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().
+ +int g2c_seekmsg | +( | +int | +g2cid, | +
+ | + | size_t | +skip, | +
+ | + | size_t * | +offset, | +
+ | + | size_t * | +msglen | +
+ | ) | ++ |
Search a file for the next GRIB2 Message.
+The search is terminated when a GRIB2 message is found, or the end of the file is reached.
+g2cid | ID of an open GRIB2 file, returned from g2c_open()/g2c_create(). |
skip | The number of bytes in the file to skip before starting the search. |
offset | Pointer that gets the number of bytes to skip from the beggining of the file to where the GRIB message starts. Ignored if NULL. |
msglen | Pointer that gets the number of bytes in message (set to 0, if no message found). Ignored if NULL. |
Definition at line 56 of file g2cfile.c.
+ +References G2C_EBADID, G2C_EFILE, G2C_ENOMEM, g2c_file, G2C_MAGIC_HEADER, G2C_NOERROR, G2C_SEEKMSG_BUFSIZE, hton64, and LOG.
+ +Referenced by read_metadata().
+ +MUTEX | +( | +m | +) | ++ |
Define mutex for thread-safety.
+ +
+
|
+ +static | +
Read metadata from a GRIB2 file being opened with g2c_open().
+g2cid | The indentifier for the file. |
Definition at line 1082 of file g2cfile.c.
+ +References add_msg(), G2C_EBADID, G2C_ENOMSG, g2c_file, g2c_log_file(), G2C_NOERROR, g2c_seekmsg(), and LOG.
+ +Referenced by g2c_open().
+ +
+
|
+ +static | +
Read the file to get metadata about a message.
+msg | Pointer to the G2C_MESSAGE_INFO_T struct for this message. |
Definition at line 940 of file g2cfile.c.
+ +References add_section(), BYTES_TO_DISCIPLINE, g2c_message_info::bytes_to_msg, g2c_message_info::discipline, g2c_file_info::f, g2c_message_info::file, FOUR_BYTES, G2C_EBADSECTION, G2C_EFILE, g2c_file_io_ubyte(), g2c_file_io_uint(), G2C_FILE_READ, G2C_NOERROR, g2c_rw_section1_metadata(), G2C_SECTION0_BYTES, LOG, ONE_BYTE, and g2c_message_info::sec1_len.
+ +Referenced by add_msg().
+ +G2C_FILE_INFO_T g2c_file[G2C_MAX_FILES+1] | +
Global file information.
+ +Definition at line 10 of file g2cfile.c.
+ +Referenced by find_available_g2cid(), free_metadata(), g2c_add_file(), g2c_close(), g2c_compare(), g2c_degrib2(), g2c_find_msg2(), g2c_get_msg(), g2c_get_prod(), g2c_inq(), g2c_inq_dim(), g2c_inq_msg(), g2c_inq_msg_time(), g2c_inq_prod(), g2c_log_file(), g2c_open_index(), g2c_seekmsg(), g2c_write_index(), and read_metadata().
+ +int g2c_next_g2cid = 1 | +
Next g2cid file ID - used when opening or creating a file.
+ +Definition at line 13 of file g2cfile.c.
+ +Referenced by find_available_g2cid().
+ +
+ NCEPLIBS-g2c
+ 1.8.0
+
+ |
+
+ NCEPLIBS-g2c
+ 1.8.0
+
+ |
+
Write summary output to an index file, as is done by utility grb2index. +More...
+ +Go to the source code of this file.
++Macros | |
#define | G2C_INDEX_BASENAME_LEN 40 |
Length of the basename in header record 2. More... | |
#define | G2C_INDEX_BITMAP_BYTES 6 |
Length of bitmap section included in the index record. More... | |
#define | G2C_INDEX_DATE_STR_LEN 10 |
Length of date string in index record. More... | |
#define | G2C_INDEX_FIXED_LEN 44 |
Length of beginning of index record. More... | |
#define | G2C_INDEX_HEADER_LEN 81 |
Length of the two header lines at the top of the index file. More... | |
#define | G2C_INDEX_STR1_LEN 7 |
Length of str1 string in index record. More... | |
#define | G2C_INDEX_TIME_STR_LEN 8 |
Length of time string in index record. More... | |
+Functions | |
EXTERN_MUTEX (m) | |
Use externally-defined mutex for thread-safety. More... | |
int | g2c_get_prod_sections (G2C_MESSAGE_INFO_T *msg, int fieldnum, G2C_SECTION_INFO_T **sec3, G2C_SECTION_INFO_T **sec4, G2C_SECTION_INFO_T **sec5, G2C_SECTION_INFO_T **sec6, G2C_SECTION_INFO_T **sec7) |
Given a pointer to a message, and a field number, return pointers to all relevent section structs for that product. More... | |
int | g2c_open_index (const char *data_file, const char *index_file, int mode, int *g2cid) |
Open a GRIB2 file with the help of an index file. More... | |
int | g2c_open_index1 (const char *index_file) |
Open a GRIB1 index file and read the contents. More... | |
int | g2c_start_index1_record (FILE *f, int rw_flag, unsigned int *b2_msg, unsigned int *b2_pds, unsigned int *b2_gds, unsigned int *b2_bms, unsigned int *b2_bds, unsigned int *msglen, unsigned char *version, unsigned char *pds_val, unsigned char *gds_val, unsigned char *bms_val, unsigned char *bds_val, unsigned char *pds_val2, unsigned char *pds_val3, unsigned char *gds_val2) |
Read or write the start of a version 1 index record. More... | |
int | g2c_start_index_record (FILE *f, int rw_flag, int *reclen, int *msg, int *local, int *gds, int *pds, int *drs, int *bms, int *data, size_t *msglen, unsigned char *version, unsigned char *discipline, short *fieldnum) |
Read or write the start of a version 2 index record. More... | |
int | g2c_write_index (int g2cid, int mode, const char *index_file) |
Create an index file from a GRIB2 file, just like those created by the grb2index utility. More... | |
static int | read_hdr_rec1 (FILE *f, int *ip, int *jp, int *kp, char *date_str, char *time_str) |
Read the header record apparently named after Steve Lord. More... | |
static int | read_hdr_rec2 (FILE *f, int *skipp, int *total_lenp, int *num_recp, char *basename) |
Read the second header record of an index file. More... | |
+Variables | |
G2C_FILE_INFO_T | g2c_file [G2C_MAX_FILES+1] |
Global file information. More... | |
Write summary output to an index file, as is done by utility grb2index.
+ +Definition in file g2cindex.c.
+#define G2C_INDEX_BASENAME_LEN 40 | +
Length of the basename in header record 2.
+ +Definition at line 20 of file g2cindex.c.
+ +#define G2C_INDEX_BITMAP_BYTES 6 | +
Length of bitmap section included in the index record.
+ +Definition at line 23 of file g2cindex.c.
+ +#define G2C_INDEX_DATE_STR_LEN 10 | +
Length of date string in index record.
+ +Definition at line 29 of file g2cindex.c.
+ +#define G2C_INDEX_FIXED_LEN 44 | +
Length of beginning of index record.
+ +Definition at line 26 of file g2cindex.c.
+ +#define G2C_INDEX_HEADER_LEN 81 | +
Length of the two header lines at the top of the index file.
+ +Definition at line 17 of file g2cindex.c.
+ +#define G2C_INDEX_STR1_LEN 7 | +
Length of str1 string in index record.
+ +Definition at line 35 of file g2cindex.c.
+ +#define G2C_INDEX_TIME_STR_LEN 8 | +
Length of time string in index record.
+ +Definition at line 32 of file g2cindex.c.
+ +EXTERN_MUTEX | +( | +m | +) | ++ |
Use externally-defined mutex for thread-safety.
+ +int g2c_get_prod_sections | +( | +G2C_MESSAGE_INFO_T * | +msg, | +
+ | + | int | +fieldnum, | +
+ | + | G2C_SECTION_INFO_T ** | +sec3, | +
+ | + | G2C_SECTION_INFO_T ** | +sec4, | +
+ | + | G2C_SECTION_INFO_T ** | +sec5, | +
+ | + | G2C_SECTION_INFO_T ** | +sec6, | +
+ | + | G2C_SECTION_INFO_T ** | +sec7 | +
+ | ) | ++ |
Given a pointer to a message, and a field number, return pointers to all relevent section structs for that product.
+Each product is defined in a section 4, and has an associated section 3, 5, 6, and 7.
+msg | Pointer to a G2C_MESSAGE_INFO_T with information about the message. |
fieldnum | The field number (first field in message is 0). |
sec3 | Pointer that gets a pointer to the G2C_SECTION_INFO_T struct for the section 3 associated with this product. |
sec4 | Pointer that gets a pointer to the G2C_SECTION_INFO_T struct for the section 4 associated with this product. |
sec5 | Pointer that gets a pointer to the G2C_SECTION_INFO_T struct for the section 5 associated with this product. |
sec6 | Pointer that gets a pointer to the G2C_SECTION_INFO_T struct for the section 6 associated with this product. NULL is returned if there is no section 6. |
sec7 | Pointer that gets a pointer to the G2C_SECTION_INFO_T struct for the section 7 associated with this product. |
Definition at line 232 of file g2cindex.c.
+ +References G2C_EINVAL, G2C_ENOSECTION, G2C_NOERROR, g2c_section_info::next, g2c_section_info::prev, g2c_message_info::sec, g2c_section_info::sec_info, and g2c_section_info::sec_num.
+ +Referenced by g2c_write_index().
+ +int g2c_open_index | +( | +const char * | +data_file, | +
+ | + | const char * | +index_file, | +
+ | + | int | +mode, | +
+ | + | int * | +g2cid | +
+ | ) | ++ |
Open a GRIB2 file with the help of an index file.
+The index file, generated by the grb2index utility, of the g2c_write_index() function, contains the byte offsets for the sections of each message in the GRIB2 file. When a GRIB2 file is opened with an index file, the library does not have to scan the file to locate all metadata.
+data_file | The name of the data file to which the index applies. |
index_file | The name that will be given to the index file. An existing file will be overwritten. |
mode | Open mode flags. |
g2cid | Pointer that gets the g2cid for this file. Ignored if NULL. |
Definition at line 786 of file g2cindex.c.
+ +References add_msg(), add_section(), g2c_message_info::bytes_to_bms, g2c_message_info::bytes_to_data, g2c_message_info::bytes_to_local, g2c_message_info::bytes_to_msg, g2c_message_info::discipline, g2c_add_file(), G2C_EBADSECTION, G2C_EFILE, G2C_EINVAL, G2C_ENAMETOOLONG, g2c_file, g2c_file_io_ubyte(), g2c_file_io_uint(), G2C_FILE_READ, G2C_INDEX_BASENAME_LEN, G2C_INDEX_DATE_STR_LEN, G2C_INDEX_HEADER_LEN, G2C_INDEX_STR1_LEN, G2C_INDEX_TIME_STR_LEN, g2c_log_section1(), G2C_MAX_NAME, G2C_NOERROR, g2c_rw_section1_metadata(), g2c_start_index_record(), LOG, g2c_message_info::master_version, MUTEX_LOCK, and MUTEX_UNLOCK.
+ +int g2c_open_index1 | +( | +const char * | +index_file | ) | ++ |
Open a GRIB1 index file and read the contents.
+index_file | The name that will be given to the index file. An existing file will be overwritten. |
Definition at line 685 of file g2cindex.c.
+ +References G2C_EFILE, G2C_EINVAL, G2C_FILE_READ, G2C_INDEX1_BDS_VAL_LEN, G2C_INDEX1_BMS_VAL_LEN, G2C_INDEX1_GDS_VAL_LEN, G2C_INDEX1_PDS_VAL_LEN, G2C_INDEX_BASENAME_LEN, G2C_INDEX_DATE_STR_LEN, G2C_INDEX_HEADER_LEN, G2C_INDEX_TIME_STR_LEN, G2C_NOERROR, g2c_start_index1_record(), LOG, MUTEX_LOCK, MUTEX_UNLOCK, read_hdr_rec1(), and read_hdr_rec2().
+ +int g2c_start_index1_record | +( | +FILE * | +f, | +
+ | + | int | +rw_flag, | +
+ | + | unsigned int * | +b2_msg, | +
+ | + | unsigned int * | +b2_pds, | +
+ | + | unsigned int * | +b2_gds, | +
+ | + | unsigned int * | +b2_bms, | +
+ | + | unsigned int * | +b2_bds, | +
+ | + | unsigned int * | +msglen, | +
+ | + | unsigned char * | +version, | +
+ | + | unsigned char * | +pds_val, | +
+ | + | unsigned char * | +gds_val, | +
+ | + | unsigned char * | +bms_val, | +
+ | + | unsigned char * | +bds_val, | +
+ | + | unsigned char * | +pds_val2, | +
+ | + | unsigned char * | +pds_val3, | +
+ | + | unsigned char * | +gds_val2 | +
+ | ) | ++ |
Read or write the start of a version 1 index record.
+For more detail on version 1 of the index format, see the grbindex documentation in the NCEPLIBS-grib_util.
+f | FILE * to open index file. |
rw_flag | True if function should write, false if it should read. |
b2_msg | Pointer that gets the bytes to skip in file before msg. |
b2_pds | Pointer that gets bytes to skip in message before pds. |
b2_gds | Pointer that gets bytes to skip in message before gds (0 if no gds). |
b2_bms | Pointer that gets bytes to skip in message before bms (0 if no bms). |
b2_bds | Pointer that gets bytes to skip in message before bds. |
msglen | Pointer that gets bytes total in the message. |
version | Pointer that gets grib version number (always 1 for this function). |
pds_val | Pointer that gets an arry of 27 bytes of the product definition section (pds). |
gds_val | Pointer that gets an arry of 41 bytes of the gds. |
bms_val | Pointer that gets an arry of 5 bytes of the bms. |
bds_val | Pointer that gets an arry of 10 bytes, bytes 41-100 of the bds. |
pds_val2 | Pointer that gets an arry of 59 bytes 41-100 of the pds. Ignored if null. |
pds_val3 | Pointer that gets an arry of 11 bytes 29-40 of the pds. Ignored if null. |
gds_val2 | Pointer that gets an arry of 135 bytes 43-178 of the gds. Ignored if null. |
Definition at line 153 of file g2cindex.c.
+ +References G2C_EFILE, G2C_EINVAL, g2c_file_io_ubyte(), g2c_file_io_uint(), G2C_INDEX1_BDS_VAL_LEN, G2C_INDEX1_BMS_VAL_LEN, G2C_INDEX1_GDS_VAL_LEN, G2C_INDEX1_PDS_VAL_LEN, and G2C_NOERROR.
+ +Referenced by g2c_open_index1().
+ +int g2c_start_index_record | +( | +FILE * | +f, | +
+ | + | int | +rw_flag, | +
+ | + | int * | +reclen, | +
+ | + | int * | +msg, | +
+ | + | int * | +local, | +
+ | + | int * | +gds, | +
+ | + | int * | +pds, | +
+ | + | int * | +drs, | +
+ | + | int * | +bms, | +
+ | + | int * | +data, | +
+ | + | size_t * | +msglen, | +
+ | + | unsigned char * | +version, | +
+ | + | unsigned char * | +discipline, | +
+ | + | short * | +fieldnum | +
+ | ) | ++ |
Read or write the start of a version 2 index record.
+f | FILE * to open index file. |
rw_flag | True if function should write, false if it should read. |
reclen | Pointer to reclen. |
msg | Pointer to msg. |
local | Pointer to local. |
gds | Pointer to gds. |
pds | Pointer to pds. |
drs | Pointer to drs. |
bms | Pointer to bms. |
data | Pointer to data. |
msglen | Pointer to msglen. |
version | Pointer to version. |
discipline | Pointer to discipline. |
fieldnum | Pointer to fieldnum, 0- based. (It is 1-based in the index file.) |
Definition at line 67 of file g2cindex.c.
+ +References G2C_EINVAL, g2c_file_io_short(), g2c_file_io_ubyte(), g2c_file_io_uint(), g2c_file_io_ulonglong(), and G2C_NOERROR.
+ +Referenced by g2c_open_index(), and g2c_write_index().
+ +int g2c_write_index | +( | +int | +g2cid, | +
+ | + | int | +mode, | +
+ | + | const char * | +index_file | +
+ | ) | ++ |
Create an index file from a GRIB2 file, just like those created by the grb2index utility.
+The index file starts with two header records:
Each following index record corresponds to a grib message and has the internal format:
g2cid | File it for an open GRIB2 file, as returned by g2c_open(). |
mode | Mode flags. Set G2C_NOCLOBBER to avoid overwriting and existing file. |
index_file | The name that will be given to the index file. An existing file will be overwritten. |
Definition at line 346 of file g2cindex.c.
+ +References g2c_message_info::bytes_in_msg, g2c_message_info::bytes_to_local, g2c_message_info::bytes_to_msg, g2c_section_info::bytes_to_sec, g2c_message_info::discipline, g2c_file_info::f, g2c_message_info::file, G2C_EBADID, G2C_EFILE, G2C_EINVAL, g2c_file, g2c_file_io_ubyte(), g2c_file_io_uint(), G2C_FILE_WRITE, g2c_get_prod_sections(), G2C_INDEX_BASENAME_LEN, G2C_INDEX_BITMAP_BYTES, G2C_INDEX_FIXED_LEN, G2C_INDEX_HEADER_LEN, G2C_MAX_FILES, G2C_NOCLOBBER, G2C_NOERROR, g2c_rw_section1_metadata(), g2c_rw_section3_metadata(), g2c_rw_section4_metadata(), g2c_rw_section5_metadata(), g2c_start_index_record(), LOG, g2c_message_info::master_version, MUTEX_LOCK, MUTEX_UNLOCK, g2c_message_info::next, g2c_message_info::num_fields, ONE_BYTE, g2c_message_info::sec1_len, and g2c_section_info::sec_len.
+ +
+
|
+ +static | +
Read the header record apparently named after Steve Lord.
+This function reads the first of two 81-byte header records of an index file.
+f | Pointer to open FILE. |
ip | Pointer that gets i value. Ignored if NULL. |
jp | Pointer that gets j value. Ignored if NULL. |
kp | Pointer that gets k value. Ignored if NULL. |
date_str | Pointer to char array of size G2C_INDEX_DATE_STR_LEN + 1 which will get the date string from the header. Ignored if NULL. |
time_str | Pointer to char array of size G2C_INDEX_TIME_STR_LEN + 1 which will get the time string from the header. Ignored if NULL. |
Definition at line 574 of file g2cindex.c.
+ +References G2C_EFILE, G2C_INDEX_DATE_STR_LEN, G2C_INDEX_HEADER_LEN, G2C_INDEX_STR1_LEN, G2C_INDEX_TIME_STR_LEN, G2C_NOERROR, and LOG.
+ +Referenced by g2c_open_index1().
+ +
+
|
+ +static | +
Read the second header record of an index file.
+This function reads the second of two 81-byte header records of an index file.
+f | Pointer to open FILE. |
skipp | Pointer that gets number of bytes to skip before index records. Ignored if NULL. |
total_lenp | Pointer that gets number of bytes in each index record. Ignored if NULL. |
num_recp | Pointer that gets number of index records in the file. Ignored if NULL. |
basename | Pointer to char array of size G2C_INDEX_BASENAME_LEN + 1 which will get the basename string from the second header record. Ignored if NULL. |
Definition at line 641 of file g2cindex.c.
+ +References G2C_EFILE, G2C_INDEX_BASENAME_LEN, G2C_INDEX_HEADER_LEN, and G2C_NOERROR.
+ +Referenced by g2c_open_index1().
+ +
+
|
+ +extern | +
Global file information.
+ +Definition at line 10 of file g2cfile.c.
+ +Referenced by g2c_open_index(), and g2c_write_index().
+ +
+ NCEPLIBS-g2c
+ 1.8.0
+
+ |
+
+ NCEPLIBS-g2c
+ 1.8.0
+
+ |
+
Inquiry functions. +More...
+ +Go to the source code of this file.
++Functions | |
EXTERN_MUTEX (m) | |
If pthreads are enabled, use externally-defined mutex for thread-safety. More... | |
int | g2c_inq (int g2cid, int *num_msg) |
Learn about a GRIB2 file. More... | |
int | g2c_inq_dim (int g2cid, int msg_num, int prod_num, int dim_num, size_t *len, char *name, float *val) |
Learn about the one of the dimensions of a GRIB2 product. More... | |
int | g2c_inq_msg (int g2cid, int msg_num, unsigned char *discipline, int *num_fields, int *num_local, short *center, short *subcenter, unsigned char *master_version, unsigned char *local_version) |
Learn about a GRIB2 message. More... | |
int | g2c_inq_msg_time (int g2cid, int msg_num, unsigned char *sig_ref_time, short *year, unsigned char *month, unsigned char *day, unsigned char *hour, unsigned char *minute, unsigned char *second) |
Learn about the date/time information in a GRIB2 message. More... | |
int | g2c_inq_prod (int g2cid, int msg_num, int prod_num, int *pds_template_len, int *pds_template, int *gds_template_len, int *gds_template, int *drs_template_len, int *drs_template) |
Inquire about a product. More... | |
+Variables | |
G2C_FILE_INFO_T | g2c_file [G2C_MAX_FILES+1] |
Global file information. More... | |
EXTERN_MUTEX | +( | +m | +) | ++ |
If pthreads are enabled, use externally-defined mutex for thread-safety.
+ +int g2c_inq | +( | +int | +g2cid, | +
+ | + | int * | +num_msg | +
+ | ) | ++ |
Learn about a GRIB2 file.
+g2cid | ID of the opened file, as from g2c_open(). |
num_msg | Pointer that gets the number of messages in the file. Ignored if NULL. |
Definition at line 31 of file g2cinq.c.
+ +References G2C_EBADID, g2c_file, G2C_MAX_FILES, G2C_NOERROR, MUTEX_LOCK, MUTEX_UNLOCK, and g2c_file_info::num_messages.
+ +int g2c_inq_dim | +( | +int | +g2cid, | +
+ | + | int | +msg_num, | +
+ | + | int | +prod_num, | +
+ | + | int | +dim_num, | +
+ | + | size_t * | +len, | +
+ | + | char * | +name, | +
+ | + | float * | +val | +
+ | ) | ++ |
Learn about the one of the dimensions of a GRIB2 product.
+g2cid | ID of the opened file, as from g2c_open(). |
msg_num | Number of the message in the file, starting with the first message as 0. |
prod_num | Product number. |
dim_num | Dimension number, with the first dimension as 0. |
len | Pointer that gets the length of this dimension. Ignored if NULL. |
name | Pointer that gets the name of this dimension. Must have memory of size G2C_MAX_NAME. Ignored if NULL. |
val | Pointer that gets array of dimension values, of length len. Ignored if NULL. |
Definition at line 328 of file g2cinq.c.
+ +References G2C_EBADID, G2C_ENOMSG, G2C_ENOPRODUCT, G2C_ENOSECTION, g2c_file, G2C_MAX_FILES, G2C_MAX_NAME, G2C_NOERROR, g2c_dim_info::len, g2c_message_info::msg_num, MUTEX_LOCK, g2c_dim_info::name, g2c_message_info::next, g2c_section_info::next, g2c_section_info::prev, g2c_message_info::sec, g2c_section_info::sec_info, g2c_section_info::sec_num, and g2c_dim_info::value.
+ +int g2c_inq_msg | +( | +int | +g2cid, | +
+ | + | int | +msg_num, | +
+ | + | unsigned char * | +discipline, | +
+ | + | int * | +num_fields, | +
+ | + | int * | +num_local, | +
+ | + | short * | +center, | +
+ | + | short * | +subcenter, | +
+ | + | unsigned char * | +master_version, | +
+ | + | unsigned char * | +local_version | +
+ | ) | ++ |
Learn about a GRIB2 message.
+g2cid | ID of the opened file, as from g2c_open(). |
msg_num | Number of the message in the file, starting with the first message as 0. |
discipline | Pointer that gets the discipline from the message. Ignored if NULL. |
num_fields | Pointer that gets the number of fields in the message. Ignored if NULL. |
num_local | Pointer that gets the number of local sections in the message. Ignored if NULL. |
center | Pointer that gets the code for the producing center from the message. Ignored if NULL. |
subcenter | Pointer that gets the code for the producing subcenter from the message. Ignored if NULL. |
master_version | Pointer that gets the master version from the message. Ignored if NULL. |
local_version | Pointer that gets the local version from the message. Ignored if NULL. |
Definition at line 86 of file g2cinq.c.
+ +References g2c_message_info::center, g2c_message_info::discipline, G2C_EBADID, G2C_ENOMSG, g2c_file, G2C_MAX_FILES, G2C_NOERROR, g2c_message_info::local_version, g2c_message_info::master_version, g2c_message_info::msg_num, g2c_message_info::next, g2c_message_info::num_fields, g2c_message_info::num_local, and g2c_message_info::subcenter.
+ +int g2c_inq_msg_time | +( | +int | +g2cid, | +
+ | + | int | +msg_num, | +
+ | + | unsigned char * | +sig_ref_time, | +
+ | + | short * | +year, | +
+ | + | unsigned char * | +month, | +
+ | + | unsigned char * | +day, | +
+ | + | unsigned char * | +hour, | +
+ | + | unsigned char * | +minute, | +
+ | + | unsigned char * | +second | +
+ | ) | ++ |
Learn about the date/time information in a GRIB2 message.
+g2cid | ID of the opened file, as from g2c_open(). |
msg_num | Number of the message in the file, starting with the first message as 0. |
sig_ref_time | Pointer that gets Significane of reference time value from the message. Ignored if NULL. |
year | Pointer that gets the year from the message. Ignored if NULL. |
month | Pointer that gets the month from the message. Ignored if NULL. |
day | Pointer that gets the day from the message. Ignored if NULL. |
hour | Pointer that gets the hour from the message. Ignored if NULL. |
minute | Pointer that gets the minute from the message. Ignored if NULL. |
second | Pointer that gets the seconds from the message. Ignored if NULL. |
Definition at line 149 of file g2cinq.c.
+ +References g2c_message_info::day, G2C_EBADID, G2C_ENOMSG, g2c_file, G2C_MAX_FILES, G2C_NOERROR, g2c_message_info::hour, g2c_message_info::minute, g2c_message_info::month, g2c_message_info::msg_num, g2c_message_info::next, g2c_message_info::second, g2c_message_info::sig_ref_time, and g2c_message_info::year.
+ +int g2c_inq_prod | +( | +int | +g2cid, | +
+ | + | int | +msg_num, | +
+ | + | int | +prod_num, | +
+ | + | int * | +pds_template_len, | +
+ | + | int * | +pds_template, | +
+ | + | int * | +gds_template_len, | +
+ | + | int * | +gds_template, | +
+ | + | int * | +drs_template_len, | +
+ | + | int * | +drs_template | +
+ | ) | ++ |
Inquire about a product.
+g2cid | File ID. |
msg_num | Message number. |
prod_num | Product number. |
pds_template_len | PDS template length. Ignored if NULL. |
pds_template | The PDS template. Ignored if NULL. |
gds_template_len | GDS template length. Ignored if NULL. |
gds_template | The GDS template. Ignored if NULL. |
drs_template_len | The DRS template length. Ignored if NULL. |
drs_template | The DRS template. Ignored if NULL. |
Definition at line 207 of file g2cinq.c.
+ +References G2C_EBADID, G2C_ENOMSG, G2C_ENOPRODUCT, G2C_ENOSECTION, g2c_file, G2C_MAX_FILES, G2C_NOERROR, g2c_message_info::msg_num, MUTEX_LOCK, MUTEX_UNLOCK, g2c_message_info::next, g2c_section_info::next, g2c_section_info::prev, g2c_message_info::sec, g2c_section_info::sec_info, g2c_section_info::sec_num, g2c_section_info::template, and g2c_section_info::template_len.
+ +
+
|
+ +extern | +
Global file information.
+ +Definition at line 10 of file g2cfile.c.
+ +Referenced by g2c_inq(), g2c_inq_dim(), g2c_inq_msg(), g2c_inq_msg_time(), and g2c_inq_prod().
+ +
+ NCEPLIBS-g2c
+ 1.8.0
+
+ |
+
+ NCEPLIBS-g2c
+ 1.8.0
+
+ |
+
File I/O functions for the g2c library. +More...
+#include "grib2_int.h"
Go to the source code of this file.
++Macros | |
#define | BITSHIFT_15 15 |
15 bits. More... | |
#define | BITSHIFT_31 31 |
31 bits. More... | |
#define | BITSHIFT_63 63 |
63 bits. More... | |
#define | BITSHIFT_7 7 |
7 bits. More... | |
+Functions | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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.
+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.
+f | Pointer to the open FILE. |
write | Non-zero if function should write, otherwise function will read. |
g2ctype | The type to be read or written. |
var | Pointer to the int to be written, or pointer to the storage that gets the int read. |
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().
+ +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.
+f | Pointer to the open GRIB2 FILE. |
write | Non-zero to write, zero to read. |
var | Pointer to the byte. |
Definition at line 316 of file g2cio.c.
+ +References G2C_BYTE, and g2c_file_io().
+ +Referenced by g2c_file_io_template().
+ +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.
+f | Pointer to the open GRIB2 FILE. |
write | Non-zero to write, zero to read. |
var | Pointer to the int. |
Definition at line 230 of file g2cio.c.
+ +References g2c_file_io(), and G2C_INT.
+ +Referenced by g2c_file_io_template().
+ +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.
+f | Pointer to the open GRIB2 FILE. |
write | Non-zero to write, zero to read. |
var | Pointer to the long long. |
Definition at line 359 of file g2cio.c.
+ +References g2c_file_io(), and G2C_INT64.
+ +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.
+f | Pointer to the open GRIB2 FILE. |
write | Non-zero to write, zero to read. |
var | Pointer to the short. |
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(), and g2c_start_index_record().
+ +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.
+This is for template values.
+With template values, if the map value is negative, then the template value may be negative.
+f | Pointer to the open FILE. |
rw_flag | Non-zero if function should write, otherwise function will read. |
map | The map value for this template item. |
template_value | Pointer to the template value to be written, or pointer to the storage that gets the templage value read. |
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().
+ +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.
+f | Pointer to the open GRIB2 FILE. |
write | Non-zero to write, zero to read. |
var | Pointer to the unsigned byte. |
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_write_index(), and read_msg_metadata().
+ +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.
+f | Pointer to the open GRIB2 FILE. |
write | Non-zero to write, zero to read. |
var | Pointer to the unsigned int. |
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_write_index(), and read_msg_metadata().
+ +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.
+f | Pointer to the open GRIB2 FILE. |
write | Non-zero to write, zero to read. |
var | Pointer to the unsigned long long. |
Definition at line 380 of file g2cio.c.
+ +References g2c_file_io(), and G2C_UINT64.
+ +Referenced by g2c_start_index_record().
+ +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.
+f | Pointer to the open GRIB2 FILE. |
write | Non-zero to write, zero to read. |
var | Pointer to the unsigned short. |
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().
+ +
+ NCEPLIBS-g2c
+ 1.8.0
+
+ |
+
+ NCEPLIBS-g2c
+ 1.8.0
+
+ |
+
Functions for serving up NOAA parameter abbreviations and GRIB1/GRIB2 translations. +More...
+#include "grib2_int.h"
Go to the source code of this file.
++Macros | |
#define | CSV_FILE "noaa_grib2_params.csv" |
The name of the CSV file which contains the NOAA abbreviations. More... | |
+Functions | |
int | g2c_param_abbrev (int g2disc, int g2cat, int g2num, char *abbrev) |
Get NOAA abbreviation for a GRIB2 parameter. More... | |
int | g2c_param_all (int param_idx, int *g1num, int *g1ver, int *g2disc, int *g2cat, int *g2num, char *abbrev) |
Return all the information about a parameter. More... | |
int | g2c_param_g1tog2 (int g1num, int g1ver, int *g2disc, int *g2cat, int *g2num) |
Translate GRIB1 parameter to GRIB2 parameter. More... | |
int | g2c_param_g2tog1 (int g2disc, int g2cat, int g2num, int *g1num, int *g1ver) |
Translate GRIB2 parameter to GRIB1 parameter. More... | |
+Variables | |
static G2C_PARAM_T | param [G2C_MAX_NOAA_PARAMS] |
An array of parameter information. More... | |
Functions for serving up NOAA parameter abbreviations and GRIB1/GRIB2 translations.
+ +Definition in file g2cparams.c.
+#define CSV_FILE "noaa_grib2_params.csv" | +
The name of the CSV file which contains the NOAA abbreviations.
+ +Definition at line 11 of file g2cparams.c.
+ +int g2c_param_abbrev | +( | +int | +g2disc, | +
+ | + | int | +g2cat, | +
+ | + | int | +g2num, | +
+ | + | char * | +abbrev | +
+ | ) | ++ |
Get NOAA abbreviation for a GRIB2 parameter.
+g2disc | The GRIB2 discipline number. |
g2cat | The GRIB2 category number. |
g2num | The GRIB2 parameter number. |
abbrev | Pointer that gets the abbreviation. Ignored if NULL. |
Definition at line 1091 of file g2cparams.c.
+ +References G2C_MAX_NOAA_ABBREV_LEN, G2C_MAX_NOAA_PARAMS, G2C_NOERROR, LOG, and param.
+ +Referenced by g2c_degrib2(), and g2c_log_section().
+ +int g2c_param_all | +( | +int | +param_idx, | +
+ | + | int * | +g1num, | +
+ | + | int * | +g1ver, | +
+ | + | int * | +g2disc, | +
+ | + | int * | +g2cat, | +
+ | + | int * | +g2num, | +
+ | + | char * | +abbrev | +
+ | ) | ++ |
Return all the information about a parameter.
+param_idx | Parameter index between 0 and G2C_MAX_NOAA_PARAMS. |
g1num | Pointer that gets the GRIB1 parameter. Ignored if NULL. |
g1ver | Pointer that gets the GRIB1 parameter table version number. Ignored if NULL. |
g2disc | Pointer that gets the GRIB2 discipline number. Ignored if NULL. |
g2cat | Pointer that gets the GRIB2 category number. Ignored if NULL. |
g2num | Pointer that gets the GRIB2 parameter number. Ignored if NULL. |
abbrev | Pointer that gets the abbreviation. |
Definition at line 1185 of file g2cparams.c.
+ +References g2c_param::g1num, g2c_param::g1ver, G2C_EINVAL, G2C_MAX_NOAA_ABBREV_LEN, G2C_MAX_NOAA_PARAMS, G2C_NOERROR, g2c_param::g2cat, g2c_param::g2disc, g2c_param::g2num, and param.
+ +int g2c_param_g1tog2 | +( | +int | +g1num, | +
+ | + | int | +g1ver, | +
+ | + | int * | +g2disc, | +
+ | + | int * | +g2cat, | +
+ | + | int * | +g2num | +
+ | ) | ++ |
Translate GRIB1 parameter to GRIB2 parameter.
+g1num | The GRIB1 parameter. |
g1ver | The GRIB1 parameter table version number. |
g2disc | Pointer that gets the GRIB2 discipline number. Ignored if NULL. |
g2cat | Pointer that gets the GRIB2 category number. Ignored if NULL. |
g2num | Pointer that gets the GRIB2 parameter number. Ignored if NULL. |
Definition at line 1051 of file g2cparams.c.
+ +References G2C_ENOPARAM, G2C_MAX_NOAA_PARAMS, G2C_NOERROR, g2c_param::g2cat, g2c_param::g2disc, g2c_param::g2num, and param.
+ +int g2c_param_g2tog1 | +( | +int | +g2disc, | +
+ | + | int | +g2cat, | +
+ | + | int | +g2num, | +
+ | + | int * | +g1num, | +
+ | + | int * | +g1ver | +
+ | ) | ++ |
Translate GRIB2 parameter to GRIB1 parameter.
+g2disc | The GRIB2 discipline number. |
g2cat | The GRIB2 category number. |
g2num | The GRIB2 parameter number. |
g1num | Pointer that gets the GRIB1 parameter. Ignored if NULL. |
g1ver | Pointer that gets the GRIB1 parameter table version number. Ignored if NULL. |
Definition at line 1136 of file g2cparams.c.
+ +References g2c_param::g1num, g2c_param::g1ver, G2C_ENOPARAM, G2C_MAX_NOAA_PARAMS, G2C_NOERROR, LOG, and param.
+ +
+
|
+ +static | +
An array of parameter information.
+ +Definition at line 14 of file g2cparams.c.
+ +Referenced by g2c_param_abbrev(), g2c_param_all(), g2c_param_g1tog2(), and g2c_param_g2tog1().
+ +
+ NCEPLIBS-g2c
+ 1.8.0
+
+ |
+
+ NCEPLIBS-g2c
+ 1.8.0
+
+ |
+
Product functions for the g2c library. +More...
+#include "grib2_int.h"
Go to the source code of this file.
++Functions | |
int | g2c_get_prod (int g2cid, int msg_num, int prod_num, int *num_data_points, float *data) |
Read the data for a product. More... | |
+Variables | |
G2C_FILE_INFO_T | g2c_file [G2C_MAX_FILES+1] |
Global file information. More... | |
int g2c_get_prod | +( | +int | +g2cid, | +
+ | + | int | +msg_num, | +
+ | + | int | +prod_num, | +
+ | + | int * | +num_data_points, | +
+ | + | float * | +data | +
+ | ) | ++ |
Read the data for a product.
+g2cid | File ID. |
msg_num | Message number in file (first message in file is message 0). |
prod_num | Product number in message (first product in message is product 0). |
num_data_points | Pointer that gets the number of data points in the product. Ignored if NULL. |
data | Pointer that gets the data. Ignored if NULL. |
Definition at line 28 of file g2cprod.c.
+ +References g2c_message_info::bytes_to_msg, g2c_section_info::bytes_to_sec, g2c_section5_info::data_def, g2c_file_info::f, G2C_EBADID, G2C_EFILE, G2C_EINVAL, G2C_ENOMEM, G2C_ENOMSG, G2C_ENOPRODUCT, G2C_ENOSECTION, G2C_ERROR, g2c_file, G2C_MAX_FILES, G2C_NOERROR, g2c_unpack7(), g2c_section3_info::grid_def, g2c_section_info::msg, g2c_message_info::msg_num, g2c_message_info::next, g2c_section_info::next, g2c_section5_info::num_data_points, g2c_section_info::prev, g2c_message_info::sec, g2c_section_info::sec_info, g2c_section_info::sec_len, g2c_section_info::sec_num, g2c_section_info::template, and g2c_section_info::template_len.
+ +Referenced by g2c_degrib2().
+ +
+
|
+ +extern | +
Global file information.
+ +Definition at line 10 of file g2cfile.c.
+ +Referenced by g2c_get_prod().
+ +
+ NCEPLIBS-g2c
+ 1.8.0
+
+ |
+
+ NCEPLIBS-g2c
+ 1.8.0
+
+ |
+
Internal utility functions for the NCEPLIBS-g2c library for the new g2c API. +More...
+ +Go to the source code of this file.
++Functions | |
int | g2c_log_file (int g2cid) |
Print a summary of the contents of an open GRIB2 file. More... | |
int | g2c_log_section (G2C_SECTION_INFO_T *sec) |
Log info about a section. More... | |
int | g2c_log_section1 (G2C_MESSAGE_INFO_T *msg) |
Log section 0 information. More... | |
const char * | g2c_strerror (int g2cerr) |
Given an error code, return an error message. More... | |
+Variables | |
G2C_FILE_INFO_T | g2c_file [G2C_MAX_FILES+1] |
Global file information. More... | |
G2C_CODE_TABLE_T * | g2c_table |
Pointer to the list of code tables. More... | |
Internal utility functions for the NCEPLIBS-g2c library for the new g2c API.
+ +Definition in file g2cutil.c.
+int g2c_log_file | +( | +int | +g2cid | ) | ++ |
Print a summary of the contents of an open GRIB2 file.
+If the NCEPLIBS-g2c library is built without the LOGGING option, this function will do nothing.
+g2cid | The file ID, returned by g2c_open() or g2c_create(). |
Definition at line 188 of file g2cutil.c.
+ +References g2c_message_info::bytes_in_msg, g2c_message_info::bytes_to_msg, g2c_message_info::center, g2c_message_info::day, G2C_EBADID, g2c_file, g2c_free_tables(), g2c_log_section(), g2c_log_section1(), G2C_NOERROR, g2c_table, g2c_xml_init(), 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::msg_num, g2c_message_info::next, g2c_section_info::next, g2c_message_info::num_fields, g2c_message_info::num_local, g2c_message_info::sec, 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 read_metadata().
+ +int g2c_log_section | +( | +G2C_SECTION_INFO_T * | +sec | ) | ++ |
Log info about a section.
+sec | Pointer to G2C_SECTION_INFO_T. |
Definition at line 152 of file g2cutil.c.
+ +References g2c_section_info::bytes_to_sec, g2c_message_info::discipline, G2C_MAX_NOAA_ABBREV_LEN, G2C_NOERROR, g2c_param_abbrev(), LOG, g2c_section_info::msg, g2c_section_info::sec_id, g2c_section_info::sec_len, g2c_section_info::sec_num, and g2c_section_info::template.
+ +Referenced by g2c_log_file().
+ +int g2c_log_section1 | +( | +G2C_MESSAGE_INFO_T * | +msg | ) | ++ |
Log section 0 information.
+msg | Pointer to G2C_MESSAGE_INFO_T which contains section 0 information. |
Definition at line 101 of file g2cutil.c.
+ +References g2c_message_info::center, g2c_message_info::day, g2c_message_info::discipline, g2c_find_desc(), G2C_MAX_GRIB_DESC_LEN, G2C_NOERROR, g2c_xml_init(), 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().
+ +const char* g2c_strerror | +( | +int | +g2cerr | ) | ++ |
Given an error code, return an error message.
+g2cerr | An error number returned by one of the g2c_* functions. |
Definition at line 29 of file g2cutil.c.
+ +References G2C_EBADEND, G2C_EBADID, G2C_EBADSECTION, G2C_EBADTEMPLATE, G2C_EBADTYPE, G2C_EFILE, G2C_EINVAL, G2C_EJPEG, G2C_EMSG, G2C_EMSGCOMPLETE, G2C_ENAMETOOLONG, G2C_ENOEND, G2C_ENOMEM, G2C_ENOMSG, G2C_ENOPARAM, G2C_ENOPRODUCT, G2C_ENOSECTION, G2C_ENOTEMPLATE, G2C_ENOTFOUND, G2C_ENOTGRIB, G2C_ENOTGRIB2, G2C_EPNG, G2C_ETOOMANYFILES, G2C_EXML, and G2C_NOERROR.
+ +
+
|
+ +extern | +
Global file information.
+ +Definition at line 10 of file g2cfile.c.
+ +Referenced by find_available_g2cid(), free_metadata(), g2c_add_file(), g2c_close(), g2c_find_msg2(), g2c_get_msg(), g2c_log_file(), g2c_seekmsg(), and read_metadata().
+ +
+
|
+ +extern | +
Pointer to the list of code tables.
+ +Definition at line 15 of file g2cxml.c.
+ +Referenced by g2c_find_desc_str(), g2c_find_table(), g2c_free_tables(), g2c_log_file(), g2c_print_tables(), and g2c_xml_init().
+ +
+ NCEPLIBS-g2c
+ 1.8.0
+
+ |
+
+ NCEPLIBS-g2c
+ 1.8.0
+
+ |
+
This file reads the GRIB2 XML files. +More...
+ +Go to the source code of this file.
++Functions | |
int | g2c_find_desc (char *title, int code, char *desc) |
Given a table title and an integer code, find a description. More... | |
int | g2c_find_desc_str (char *title, char *code, char *desc) |
Given a table title and a code, find a description. More... | |
G2C_CODE_ENTRY_T * | g2c_find_entry (char *desc, G2C_CODE_TABLE_T *table) |
Find an entry in a table given a description. More... | |
G2C_CODE_TABLE_T * | g2c_find_table (char *key) |
Find a table given a key. More... | |
void | g2c_free_tables () |
Free table memory. More... | |
void | g2c_print_tables () |
Print the table data. More... | |
int | g2c_xml_init () |
Init. More... | |
+Variables | |
xmlDocPtr | doc |
Contains the parsed XML document. More... | |
G2C_CODE_TABLE_T * | g2c_table = NULL |
Pointer to the list of code tables. More... | |
int g2c_find_desc | +( | +char * | +title, | +
+ | + | int | +code, | +
+ | + | char * | +desc | +
+ | ) | ++ |
Given a table title and an integer code, find a description.
+title | Title of table. |
code | Code to search for as an int. |
desc | Pointer that gets a copy of the description. Must be allocated to G2C_MAX_GRIB_DESC_LEN + 1. |
Definition at line 132 of file g2cxml.c.
+ +References g2c_find_desc_str(), and G2C_MAX_GRIB_CODE_LEN.
+ +Referenced by g2c_log_section1().
+ +int g2c_find_desc_str | +( | +char * | +title, | +
+ | + | char * | +code, | +
+ | + | char * | +desc | +
+ | ) | ++ |
Given a table title and a code, find a description.
+title | Title of table. |
code | Code to search for. |
desc | Pointer that gets a copy of the description. Must be allocated to G2C_MAX_GRIB_DESC_LEN + 1. |
Definition at line 84 of file g2cxml.c.
+ +References G2C_EINVAL, G2C_ENOTFOUND, G2C_MAX_GRIB_CODE_LEN, G2C_MAX_GRIB_TITLE_LEN, G2C_NOERROR, and g2c_table.
+ +Referenced by g2c_find_desc().
+ +G2C_CODE_ENTRY_T* g2c_find_entry | +( | +char * | +desc, | +
+ | + | G2C_CODE_TABLE_T * | +table | +
+ | ) | ++ |
Find an entry in a table given a description.
+desc | The description of the entry to find. |
table | A pointer to the table to search. |
Definition at line 170 of file g2cxml.c.
+ +References G2C_MAX_GRIB_DESC_LEN.
+ +G2C_CODE_TABLE_T* g2c_find_table | +( | +char * | +key | ) | ++ |
Find a table given a key.
+key | The table title to find. |
Definition at line 149 of file g2cxml.c.
+ +References G2C_MAX_GRIB_TITLE_LEN, and g2c_table.
+ +Referenced by g2c_xml_init().
+ +void g2c_free_tables | +( | +) | ++ |
Free table memory.
+ +Definition at line 42 of file g2cxml.c.
+ +References g2c_table.
+ +Referenced by g2c_log_file().
+ +void g2c_print_tables | +( | +) | ++ |
int g2c_xml_init | +( | +) | ++ |
Init.
+Definition at line 190 of file g2cxml.c.
+ +References doc, G2C_ENAMETOOLONG, G2C_ENOMEM, G2C_EXML, g2c_find_table(), G2C_MAX_GRIB_CODE_LEN, G2C_MAX_GRIB_DESC_LEN, G2C_MAX_GRIB_STATUS_LEN, G2C_MAX_GRIB_TITLE_LEN, G2C_NOERROR, and g2c_table.
+ +Referenced by g2c_log_file(), and g2c_log_section1().
+ +xmlDocPtr doc | +
Contains the parsed XML document.
+ +Definition at line 12 of file g2cxml.c.
+ +Referenced by g2c_xml_init().
+ +G2C_CODE_TABLE_T* g2c_table = NULL | +
Pointer to the list of code tables.
+ +Definition at line 15 of file g2cxml.c.
+ +Referenced by g2c_find_desc_str(), g2c_find_table(), g2c_free_tables(), g2c_log_file(), g2c_print_tables(), and g2c_xml_init().
+ +
+ NCEPLIBS-g2c
+ 1.8.0
+
+ |
+
References g2_unpack3().
+References g2_unpack3().
Referenced by g2_addfield().
@@ -183,9 +183,7 @@
+ NCEPLIBS-g2c
+ 1.8.0
+
+ |
+
+ NCEPLIBS-g2c
+ 1.8.0
+
+ |
+
+ NCEPLIBS-g2c
+ 1.8.0
+
+ |
+
+ NCEPLIBS-g2c
+ 1.8.0
+
+ |
+
+ NCEPLIBS-g2c
+ 1.8.0
+
+ |
+
+ NCEPLIBS-g2c
+ 1.8.0
+
+ |
+
+ NCEPLIBS-g2c
+ 1.8.0
+
+ |
+
+ NCEPLIBS-g2c
+ 1.8.0
+
+ |
+
+ NCEPLIBS-g2c
+ 1.8.0
+
+ |
+
+ NCEPLIBS-g2c
+ 1.8.0
+
+ |
+
+ NCEPLIBS-g2c
+ 1.8.0
+
+ |
+
+ NCEPLIBS-g2c
+ 1.8.0
+
+ |
+
+ NCEPLIBS-g2c
+ 1.8.0
+
+ |
+
+ NCEPLIBS-g2c
+ 1.8.0
+
+ |
+
+ NCEPLIBS-g2c
+ 1.8.0
+
+ |
+
+ NCEPLIBS-g2c
+ 1.8.0
+
+ |
+
+ NCEPLIBS-g2c
+ 1.8.0
+
+ |
+
+ NCEPLIBS-g2c
+ 1.8.0
+
+ |
+
+ NCEPLIBS-g2c
+ 1.8.0
+
+ |
+
+ NCEPLIBS-g2c
+ 1.8.0
+
+ |
+
+ NCEPLIBS-g2c
+ 1.8.0
+
+ |
+
+ NCEPLIBS-g2c
+ 1.8.0
+
+ |
+
+ NCEPLIBS-g2c
+ 1.8.0
+
+ |
+
+ NCEPLIBS-g2c
+ 1.8.0
+
+ |
+
+ NCEPLIBS-g2c
+ 1.8.0
+
+ |
+
+ NCEPLIBS-g2c
+ 1.8.0
+
+ |
+
+ NCEPLIBS-g2c
+ 1.8.0
+
+ |
+
+ NCEPLIBS-g2c
+ 1.8.0
+
+ |
+
+ NCEPLIBS-g2c
+ 1.8.0
+
+ |
+
+ NCEPLIBS-g2c
+ 1.8.0
+
+ |
+
+ NCEPLIBS-g2c
+ 1.8.0
+
+ |
+
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <sys/types.h>
#include <unistd.h>
Go to the source code of this file.
In specunpack() Can't handle 64 or 128 bit floats. More... | |
#define | G2_UNPACK3_BAD_GDT 5 |
In g2_unpack3(), undefined Grid Definition Template. More... | |
In g2_unpack3(), undefined Grid Definition Template. More... | |
#define | G2_UNPACK4_BAD_PDT 5 |
In g2_unpack4(), undefined Product Definition Template. More... | |
In g2_unpack6(), unrecognized pre-defined bit-map. More... | |
#define | G2_UNPACK7_BAD_DRT 4 |
In g2_unpack7(), unrecognized Data Representation Template. More... | |
In g2_unpack7(), unrecognized Data Representation Template. More... | |
#define | G2_UNPACK7_CORRUPT_SEC 7 |
In g2_unpack7(), corrupt section 7. More... | |
In g2_unpack7(), corrupt section 7. More... | |
#define | G2_UNPACK7_WRONG_GDT 5 |
In g2_unpack7(), need one of GDT 3.50 through 3.53 to decode DRT 5.51. More... | |
In g2_unpack7(), need one of GDT 3.50 through 3.53 to decode DRT 5.51. More... | |
#define | G2_UNPACK_BAD_SEC 2 |
Bad section number in unpacking function. More... | |
#define | G2_UNPACK_NO_MEM 6 |
Error allocating memory in unpack function. More... | |
#define | G2_VERSION "1.7.0" |
Current version of NCEPLIBS-g2c library. More... | |
#define | G2C_MSG_COMPLETE -51 |
GRIB message already complete. More... | |
#define | G2C_NO_ERROR 0 |
No error. More... | |
#define | G2C_NOT_GRIB -50 |
GRIB header not found. More... | |
#define | G2C_BYTE 1 |
signed 1 byte integer More... | |
#define | G2C_CHAR 2 |
ISO/ASCII character. More... | |
#define | G2C_CLOBBER 0x0000 |
Destroy existing file. More... | |
#define | G2C_DOUBLE 6 |
double precision floating point number More... | |
#define | G2C_EBADEND (-65) |
End of message in wrong place. More... | |
#define | G2C_EBADID (-55) |
Bad ID. More... | |
#define | G2C_EBADSECTION (-66) |
Invalid section number. More... | |
#define | G2C_EBADTEMPLATE (-70) |
Template problem. More... | |
#define | G2C_EBADTYPE (-73) |
Type not found. More... | |
#define | G2C_EFILE (-54) |
File I/O error. More... | |
#define | G2C_EINVAL (-53) |
Invalid input. More... | |
#define | G2C_EJPEG (-67) |
Error encoding/decoding JPEG data. More... | |
#define | G2C_EMSG (-58) |
Error decoding GRIB message. More... | |
#define | G2C_EMSGCOMPLETE (-51) |
GRIB message already complete. More... | |
#define | G2C_ENAMETOOLONG (-52) |
Name too long. More... | |
#define | G2C_ENOEND (-64) |
Cannot find end of GRIB message. More... | |
#define | G2C_ENOMEM (-57) |
Out of memory. More... | |
#define | G2C_ENOMSG (-59) |
No GRIB message found. More... | |
#define | G2C_ENOPARAM (-71) |
Parameter not found. More... | |
#define | G2C_ENOPRODUCT (-72) |
Product not found. More... | |
#define | G2C_ENOSECTION (-63) |
Cannot find section. More... | |
#define | G2C_ENOTEMPLATE (-69) |
Template not found. More... | |
#define | G2C_ENOTFOUND (-61) |
Table or entry not found. More... | |
#define | G2C_ENOTGRIB (-50) |
GRIB header not found. More... | |
#define | G2C_ENOTGRIB2 (-62) |
Not GRIB 2. More... | |
#define | G2C_EPNG (-68) |
Error encoding/decoding PNG data. More... | |
#define | G2C_ERROR 1 |
General error code, returned for some test errors. More... | |
#define | G2C_ETOOMANYFILES (-56) |
Trying to open too many files. More... | |
#define | G2C_EXML (-60) |
XML error. More... | |
#define | G2C_FLOAT 5 |
single precision floating point number More... | |
#define | G2C_INT 4 |
signed 4 byte integer More... | |
#define | G2C_INT64 10 |
signed 8-byte int More... | |
#define | G2C_JASPER_MAX_MEM 268435456 |
Maximum size for the Jasper memory buffer. More... | |
#define | G2C_JPEG_DRS_TEMPLATE_LEN 7 |
Length of the idrstmpl array for JPEG packing. More... | |
#define | G2C_MAX_DRS_TEMPLATE 9 |
Maximum number of DRS templates. More... | |
#define | G2C_MAX_DRS_TEMPLATE_MAPLEN 18 |
Maximum DRS template map length. More... | |
#define | G2C_MAX_FILES 3 |
Maximum number of open files. More... | |
#define | G2C_MAX_GDS_TEMPLATE 31 |
Maximum number of grid templates. More... | |
#define | G2C_MAX_GDS_TEMPLATE_MAPLEN 28 |
Maximum grid template map length. More... | |
#define | G2C_MAX_GRIB_CODE_LEN 20 |
Maximum length of code. More... | |
#define | G2C_MAX_GRIB_DESC_LEN 512 |
Maximum length of code description. More... | |
#define | G2C_MAX_GRIB_LEVEL_DESC_LEN 40 |
Maximum length of level description. More... | |
#define | G2C_MAX_GRIB_STATUS_LEN 40 |
Maximum length of code status. More... | |
#define | G2C_MAX_GRIB_TITLE_LEN 200 |
Maximum length of code table title. More... | |
#define | G2C_MAX_NAME 1024 |
Maximum length of a name. More... | |
#define | G2C_MAX_NOAA_ABBREV_LEN 8 |
Maximum length of a NOAA abbreviation of a parameter. More... | |
#define | G2C_MAX_NOAA_PARAM_LINE_LEN 120 |
Maximum length of a line in the NOAA abbreviation CSV file. More... | |
#define | G2C_MAX_NOAA_PARAMS 2000 |
Maximum number of known parameters with NOAA abbreviations. More... | |
#define | G2C_MAX_NUM_SECTIONS 1024 |
Maximum number of sections that can be handled in one message. More... | |
#define | G2C_MAX_PDS_TEMPLATE 47 |
Maximum number of PDS templates. More... | |
#define | G2C_MAX_PDS_TEMPLATE_MAPLEN 45 |
Maximum template map length. More... | |
#define | G2C_NOCLOBBER 0x0004 |
Don't destroy existing file. More... | |
#define | G2C_NOERROR 0 |
No error. More... | |
#define | G2C_NOWRITE 0x0000 |
Set read-only access for g2c_open(). More... | |
#define | G2C_PNG_DRS_TEMPLATE_LEN 5 |
Length of the idrstmpl array for PNG packing. More... | |
#define | G2C_SECTION0_ARRAY_LEN 3 |
Length of section 0 array. More... | |
#define | G2C_SECTION0_BYTES 16 |
Number of bytes in section 0. More... | |
#define | G2C_SECTION0_LEN 3 |
Length of section 0 array. More... | |
#define | G2C_SECTION1_ARRAY_LEN 13 |
Length of section 1 array. More... | |
#define | G2C_SECTION1_BYTES 21 |
Number of bytes in section 1 (not including reserved, optional data at the end of the section). More... | |
#define | G2C_SECTION1_LEN 13 |
Length of section 1 array. More... | |
#define | G2C_SHORT 3 |
signed 2 byte integer More... | |
#define | G2C_UBYTE 7 |
unsigned 1 byte int More... | |
#define | G2C_UINT 9 |
unsigned 4-byte int More... | |
#define | G2C_UINT64 11 |
unsigned 8-byte int More... | |
#define | G2C_USHORT 8 |
unsigned 2-byte int More... | |
#define | G2C_VERSION "1.8.0" |
Current version of NCEPLIBS-g2c library. More... | |
#define | G2C_WRITE 0x0001 |
Set read-write access for g2c_open(). More... | |
Typedefs | |
This subroutine unpacks Section 2 (Local Use Section) as defined in GRIB Edition 2. More... | |
g2int | g2_unpack3 (unsigned char *cgrib, g2int *iofst, g2int **igds, g2int **igdstmpl, g2int *mapgridlen, g2int **ideflist, g2int *idefnum) |
This routine unpacks Section 3 (Grid Definition Section) as defined in GRIB Edition 2. More... | |
This routine unpacks Section 3 (Grid Definition Section) from a GRIB2 message. More... | |
g2int | g2_unpack4 (unsigned char *cgrib, g2int *iofst, g2int *ipdsnum, g2int **ipdstmpl, g2int *mappdslen, float **coordlist, g2int *numcoord) |
This subroutine unpacks Section 4 (Product Definition Section) as defined in GRIB Edition 2. More... | |
This subroutine unpacks Section 6 (Bit-Map Section) as defined in GRIB Edition 2. More... | |
g2int | g2_unpack7 (unsigned char *cgrib, g2int *iofst, g2int igdsnum, g2int *igdstmpl, g2int idrsnum, g2int *idrstmpl, g2int ndpts, float **fld) |
This subroutine unpacks Section 7 (Data Section) as defined in GRIB Edition 2. More... | |
This subroutine unpacks Section 7 (Data Section) of a GRIB2 message. More... | |
int | g2c_close (int g2cid) |
Close a GRIB2 file, freeing resources. More... | |
int | g2c_compare (int g2cid1, int g2cid2) |
Compare the metadata of two open GRIB2 files. More... | |
int | g2c_dec_jpeg2000 (char *injpc, size_t bufsize, int *outfld) |
This Function decodes a JPEG2000 code stream specified in the JPEG2000 Part-1 standard (i.e., ISO/IEC 15444-1) using JasPer Software. More... | |
int | g2c_degrib2 (int g2cid, const char *fileout) |
Write a summary file like the degrib2 utility. More... | |
int | g2c_enc_jpeg2000 (unsigned char *cin, int width, int height, int nbits, int ltype, int ratio, int retry, char *outjpc, size_t jpclen) |
This Function encodes a grayscale image into a JPEG2000 code stream specified in the JPEG2000 Part-1 standard (i.e., ISO/IEC 15444-1) using JasPer Software. More... | |
int | g2c_find_desc (char *title, int code, char *desc) |
Given a table title and an integer code, find a description. More... | |
int | g2c_find_desc_str (char *title, char *code, char *desc) |
Given a table title and a code, find a description. More... | |
int | g2c_find_msg2 (int g2cid, size_t skip_bytes, size_t max_bytes, size_t *bytes_to_msg, size_t *bytes_in_msg) |
Search a file for the next GRIB1 or GRIB2 message. More... | |
void | g2c_free_tables () |
Free table memory. More... | |
void | g2c_gbit_int (unsigned char *in, int *iout, int iskip, int nbits) |
Get bits - unpack bits: Extract arbitrary size values from a packed bit string, right justifying each value in the unpacked iout array. More... | |
int | g2c_gbits_int (unsigned char *in, int *iout, int iskip, int nbits, int nskip, int n) |
Get bits - unpack bits: Extract arbitrary size values from a packed bit string, right justifying each value in the unpacked iout array. More... | |
int | g2c_get_drs_template (int drs_template_num, int *maplen, int *map, int *needext) |
Get DRS template information. More... | |
int | g2c_get_grid_template (int grid_template_num, int *maplen, int *map, int *needext) |
Get grid template information. More... | |
int | g2c_get_grid_template_extension (int grid_template_num, int *template, int *extlen, int *ext) |
Get grid template extension information. More... | |
int | g2c_get_msg (int g2cid, size_t skip_bytes, size_t max_bytes, size_t *bytes_to_msg, size_t *bytes_in_msg, unsigned char **cbuf) |
Search a file for the next GRIB1 or GRIB2 message, and read it, allocating space in memory to hold the message. More... | |
int | g2c_get_pds_template (int pds_template_num, int *maplen, int *map, int *needext) |
Get PDS template information. More... | |
int | g2c_get_pds_template_extension (int pds_template_num, int *template, int *extlen, int *ext) |
Get pds template extension information. More... | |
int | g2c_get_prod (int g2cid, int msg_num, int prod_num, int *num_data_points, float *data) |
Read the data for a product. More... | |
int | g2c_inq (int g2cid, int *num_msg) |
Learn about a GRIB2 file. More... | |
int | g2c_inq_dim (int g2cid, int msg_num, int prod_num, int dim_num, size_t *len, char *name, float *val) |
Learn about the one of the dimensions of a GRIB2 product. More... | |
int | g2c_inq_msg (int g2cid, int msg_num, unsigned char *discipline, int *num_fields, int *num_local, short *center, short *subcenter, unsigned char *master_version, unsigned char *local_version) |
Learn about a GRIB2 message. More... | |
int | g2c_inq_msg_time (int g2cid, int msg_num, unsigned char *sig_ref_time, short *year, unsigned char *month, unsigned char *day, unsigned char *hour, unsigned char *minute, unsigned char *second) |
Learn about the date/time information in a GRIB2 message. More... | |
int | g2c_inq_prod (int g2cid, int msg_num, int prod_num, int *pds_template_len, int *pds_template, int *gds_template_len, int *gds_template, int *drs_template_len, int *drs_template) |
Inquire about a product. More... | |
int | g2c_jpcpackd (double *fld, size_t width, size_t height, int *idrstmpl, unsigned char *cpack, size_t *lcpack) |
This function packs up a double array into a JPEG2000 code stream. More... | |
int | g2c_jpcpackf (float *fld, size_t width, size_t height, int *idrstmpl, unsigned char *cpack, size_t *lcpack) |
This function packs up a float array into a JPEG2000 code stream. More... | |
int | g2c_jpcunpackd (unsigned char *cpack, size_t len, int *idrstmpl, size_t ndpts, double *fld) |
Unpack JPEG2000 compressed data into an array of doubles, using info from the GRIB2 Data Representation Template 5.40 or 5.40000. More... | |
int | g2c_jpcunpackf (unsigned char *cpack, size_t len, int *idrstmpl, size_t 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. More... | |
int | g2c_log_file (int g2cid) |
Print a summary of the contents of an open GRIB2 file. More... | |
int | g2c_open (const char *path, int mode, int *g2cid) |
Open an existing GRIB2 file. More... | |
int | g2c_open_index (const char *data_file, const char *index_file, int mode, int *g2cid) |
Open a GRIB2 file with the help of an index file. More... | |
int | g2c_open_index1 (const char *index_file) |
Open a GRIB1 index file and read the contents. More... | |
int | g2c_param_abbrev (int g2disc, int g2cat, int g2num, char *abbrev) |
Get NOAA abbreviation for a GRIB2 parameter. More... | |
int | g2c_param_all (int param_idx, int *g1ver, int *g1val, int *g2disc, int *g2cat, int *g2num, char *abbdrev) |
Return all the information about a parameter. More... | |
int | g2c_param_g1tog2 (int g1val, int g1ver, int *g2disc, int *g2cat, int *g2num) |
Translate GRIB1 parameter to GRIB2 parameter. More... | |
int | g2c_param_g2tog1 (int g2disc, int g2cat, int g2num, int *g1val, int *g1ver) |
Translate GRIB2 parameter to GRIB1 parameter. More... | |
int | g2c_pngpackd (double *fld, size_t width, size_t height, int *idrstmpl, unsigned char *cpack, int *lcpack) |
This subroutine packs up a double data field into PNG image format. More... | |
int | g2c_pngpackf (float *fld, size_t width, size_t height, int *idrstmpl, unsigned char *cpack, int *lcpack) |
This subroutine packs up a float data field into PNG image format. More... | |
int | g2c_pngunpackd (unsigned char *cpack, size_t len, int *idrstmpl, size_t ndpts, double *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. More... | |
int | g2c_pngunpackf (unsigned char *cpack, size_t len, int *idrstmpl, size_t 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. More... | |
int | g2c_seekmsg (int g2cid, size_t skip, size_t *offset, size_t *msglen) |
Search a file for the next GRIB2 Message. More... | |
int | g2c_set_log_level (int new_level) |
Use this to set the global log level. More... | |
const char * | g2c_strerror (int g2cerr) |
Given an error code, return an error message. More... | |
int | g2c_unpack7 (unsigned char *cgrib, int igdsnum, int gds_tmpl_len, long long int *gdstmpl, int idrsnum, int drs_tmpl_len, long long int *drstmpl, int ndpts, float *fld) |
This subroutine unpacks Section 7 (Data Section) of a GRIB2 message. More... | |
int | g2c_write_index (int g2cid, int mode, const char *index_file) |
Create an index file from a GRIB2 file, just like those created by the grb2index utility. More... | |
int | g2c_xml_init () |
Init. More... | |
void | jpcpack (float *fld, g2int width, g2int height, g2int *idrstmpl, unsigned char *cpack, g2int *lcpack) |
This subroutine packs up a data field into a JPEG2000 code stream. More... | |
This function packs up a float array into a JPEG2000 code stream. More... | |
void | jpcpackd (double *fld, g2int width, g2int height, g2int *idrstmpl, unsigned char *cpack, g2int *lcpack) |
This subroutine packs up a data field into a JPEG2000 code stream. More... | |
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. More... | |
g2int | jpcunpackd (unsigned char *cpack, g2int len, g2int *idrstmpl, g2int ndpts, double *fld) |
Unpack JPEG2000 compressed data into an array of doubles, using info from the GRIB2 Data Representation Template 5.40 or 5.40000. More... | |
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. More... | |
void | pngpackd (double *fld, g2int width, g2int height, g2int *idrstmpl, unsigned char *cpack, g2int *lcpack) |
This subroutine packs up a double data field into PNG image format. More... | |
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. More... | |
g2int | pngunpackd (unsigned char *cpack, g2int len, g2int *idrstmpl, g2int ndpts, double *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. More... | |
void | seekgb (FILE *lugb, g2int iseek, g2int mseek, g2int *lskip, g2int *lgrib) |
This subprogram searches a file for the next GRIB Message. More... | |
Search a file for the next GRIB Message. More... | |
Header file for NCEPLIBS-g2c library.
-Date | Programmer | Comments | Date | Programmer | Comments |
---|---|---|
2002-10-25 | Gilbert | Initial | 2002-10-25 | Gilbert | Initial |
2009-01-14 | Vuong | Changed struct template to gtemplate | 2009-01-14 | Vuong | Changed struct template to gtemplate |
2021-11-9 | Ed Hartnett | Moved many prototypes to new internal header grib2_int.h. | 2021-11-9 | Ed Hartnett | Moved many prototypes to new internal header grib2_int.h. |
2022-04-15 | Ed Hartnett | Added error codes related to JPEG. | 2022-04-15 | Ed Hartnett | Added error codes related to JPEG. |
2022-08-15 | Ed Hartnett | Added compression functions for double. | 2022-08-15 | Ed Hartnett | Added compression functions for double. |
Data Fields | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -678,7 +993,7 @@ Definition at line 311 of file grib2.h.
+Definition at line 310 of file grib2.h. +Definition at line 458 of file grib2.h. @@ -714,7 +1029,7 @@g2_addfield() no bitmap in the GRIB message.
-Definition at line 315 of file grib2.h. +Definition at line 463 of file grib2.h. @@ -750,7 +1065,7 @@g2_addfield() section 3 (GDS) not previously defined in message.
-Definition at line 317 of file grib2.h. +Definition at line 465 of file grib2.h. @@ -786,7 +1101,7 @@g2_addfield() could not find requested Product Definition Template.
-Definition at line 318 of file grib2.h. +Definition at line 466 of file grib2.h. @@ -822,7 +1137,7 @@g2_addgrid() Could not find requested Grid Definition Template.
-Definition at line 448 of file grib2.h. @@ -858,7 +1173,7 @@Definition at line 312 of file grib2.h.
+Definition at line 276 of file grib2.h. +Definition at line 424 of file grib2.h. @@ -894,7 +1209,7 @@g2_getfld() didn't find "7777" at end of message.
-Definition at line 291 of file grib2.h. +Definition at line 439 of file grib2.h. @@ -930,7 +1245,7 @@g2_getfld() unpacking section 2.
-Definition at line 293 of file grib2.h. +Definition at line 441 of file grib2.h. @@ -966,7 +1281,7 @@g2_getfld() unpacking section 4.
-Definition at line 295 of file grib2.h. +Definition at line 443 of file grib2.h. @@ -1002,7 +1317,7 @@g2_getfld() unpacking section 6.
-Definition at line 297 of file grib2.h. +Definition at line 445 of file grib2.h. @@ -1038,7 +1353,7 @@g2_getfld(), must be 2.
-Definition at line 285 of file grib2.h. +Definition at line 433 of file grib2.h. @@ -1074,7 +1389,7 @@g2_getfld() encountered unrecognized section.
-Definition at line 298 of file grib2.h. +Definition at line 446 of file grib2.h. @@ -1110,7 +1425,7 @@g2_getfld(), Data Representation Template not implemented.
-Definition at line 283 of file grib2.h. +Definition at line 431 of file grib2.h. @@ -1146,7 +1461,7 @@g2_info() found "7777" not where expected.
-Definition at line 287 of file grib2.h. +Definition at line 435 of file grib2.h. @@ -1182,7 +1497,7 @@g2_gribend() GRIB message was not initialized - call g2_create() first.
-Definition at line 281 of file grib2.h. +Definition at line 429 of file grib2.h. @@ -1218,7 +1533,7 @@g2_info(), must be 2.
-Definition at line 282 of file grib2.h. +Definition at line 430 of file grib2.h. @@ -1254,7 +1569,7 @@g2_info() can't find beginning characters "GRIB".
-Definition at line 279 of file grib2.h. +Definition at line 427 of file grib2.h. @@ -1290,7 +1605,7 @@g2_info() found "7777" not where expected.
-Definition at line 324 of file grib2.h. +Definition at line 472 of file grib2.h. @@ -1326,7 +1641,7 @@dec_jpeg2000() decoded image had multiple color components.
-Definition at line 323 of file grib2.h. +Definition at line 471 of file grib2.h. @@ -1362,7 +1677,7 @@enc_jpeg2000()/dec_jpeg2000() error initializing jasper library.
-Definition at line 320 of file grib2.h. +Definition at line 468 of file grib2.h. @@ -1398,7 +1713,7 @@Definition at line 25 of file grib2.h.
+Definition at line 423 of file grib2.h. @@ -1434,7 +1749,7 @@Definition at line 24 of file grib2.h.
+Definition at line 321 of file grib2.h. +Definition at line 469 of file grib2.h. @@ -1468,9 +1783,9 @@
-Definition at line 304 of file grib2.h. +Definition at line 452 of file grib2.h. @@ -1506,7 +1821,7 @@g2_unpack5(), undefined Data Representation Template.
-Definition at line 306 of file grib2.h. +Definition at line 454 of file grib2.h. @@ -1540,9 +1855,9 @@
-In g2_unpack7(), corrupt section 7. +In g2_unpack7(), corrupt section 7. -Definition at line 307 of file grib2.h. +Definition at line 455 of file grib2.h. @@ -1576,9 +1891,9 @@
-Definition at line 449 of file grib2.h. @@ -1614,340 +1929,4284 @@Definition at line 302 of file grib2.h.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
This routine packs up Sections 4 through 7 for a given field and adds them to a GRIB2 message. -They are Product Definition Section, Data Representation Section, Bit-Map Section and Data Section, respectively. -This routine is used with routines g2_create(), g2_addlocal(), g2_addgrid(), and g2_gribend() to create a complete GRIB2 message. Function g2_create() must be called first to initialize a new GRIB2 message. Function g2_addgrid() must be called after g2_create() and before this routine to add the appropriate grid description to the GRIB2 message. A call to g2_gribend() is required to complete GRIB2 message after all fields have been added. --Program History Log-
Definition at line 98 of file g2_addfield.c. +Out of memory. -References cmplxpack(), gtemplate::ext, gtemplate::extlen, extpdstemplate(), G2_ADD_MSG_COMPLETE, G2_ADD_MSG_INIT, G2_ADDFIELD_BAD_BITMAP, G2_ADDFIELD_BAD_DRT, G2_ADDFIELD_BAD_GDS, G2_ADDFIELD_BAD_GDT, G2_ADDFIELD_BAD_PDT, G2_ADDFIELD_ERR, G2_BAD_SEC, G2_BAD_SEC_COUNTS, g2c_check_msg(), G2C_MSG_COMPLETE, G2C_NOT_GRIB, gbit(), getdim(), getdrstemplate(), getpdstemplate(), getpoly(), jpcpack(), gtemplate::map, gtemplate::maplen, mkieee(), gtemplate::needext, pngpack(), sbit(), sbits(), simpack(), and specpack(). +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Set read-only access for g2c_open(). + + + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Set read-write access for g2c_open(). + + + +
+
+
+
+
+
+
+
+
+
+This routine packs up Sections 4 through 7 for a given field and adds them to a GRIB2 message. +They are Product Definition Section, Data Representation Section, Bit-Map Section and Data Section, respectively. +This routine is used with routines g2_create(), g2_addlocal(), g2_addgrid(), and g2_gribend() to create a complete GRIB2 message. Function g2_create() must be called first to initialize a new GRIB2 message. Function g2_addgrid() must be called after g2_create() and before this routine to add the appropriate grid description to the GRIB2 message. A call to g2_gribend() is required to complete GRIB2 message after all fields have been added. ++Program History Log+
Definition at line 98 of file g2_addfield.c. + +References cmplxpack(), gtemplate::ext, gtemplate::extlen, extpdstemplate(), G2_ADD_MSG_COMPLETE, G2_ADD_MSG_INIT, G2_ADDFIELD_BAD_BITMAP, G2_ADDFIELD_BAD_DRT, G2_ADDFIELD_BAD_GDS, G2_ADDFIELD_BAD_GDT, G2_ADDFIELD_BAD_PDT, G2_ADDFIELD_ERR, G2_BAD_SEC, G2_BAD_SEC_COUNTS, g2c_check_msg(), G2C_EMSGCOMPLETE, G2C_ENOTGRIB, gbit(), getdim(), getdrstemplate(), getpdstemplate(), getpoly(), jpcpack(), gtemplate::map, gtemplate::maplen, mkieee(), gtemplate::needext, pngpack(), sbit(), sbits(), simpack(), and specpack(). + +
+
+
+
+This routine packs up a Grid Definition Section (Section 3) and adds it to a GRIB2 message. +It is used with routines g2_create(), g2_addlocal(), g2_addfield(), and g2_gribend() to create a complete GRIB2 message. g2_create() must be called first to initialize a new GRIB2 message. ++Program History Log+
Definition at line 70 of file g2_addgrid.c. + +References gtemplate::ext, extgridtemplate(), gtemplate::extlen, G2_ADD_MSG_COMPLETE, G2_ADD_MSG_INIT, G2_ADDGRID_BAD_GDT, G2_BAD_SEC, G2_BAD_SEC_COUNTS, g2c_check_msg(), G2C_EMSGCOMPLETE, G2C_ENOTGRIB, gbit(), getgridtemplate(), gtemplate::map, gtemplate::maplen, gtemplate::needext, sbit(), and sbits(). + +
+
+
+
+This routine adds a Local Use Section (Section 2) to a GRIB2 message. +It is used with routines g2_create(), g2_addgrid(), g2_addfield(), and g2_gribend() to create a complete GRIB2 message. +
Definition at line 40 of file g2_addlocal.c. + +References G2_ADD_MSG_COMPLETE, G2_ADD_MSG_INIT, G2_BAD_SEC, G2_BAD_SEC_COUNTS, g2c_check_msg(), G2C_EMSGCOMPLETE, G2C_ENOTGRIB, gbit(), and sbit(). + +
+
+
+
+This routine initializes a new GRIB2 message and packs GRIB2 Section 0 (Indicator Section) and Section 1 (Identification Section). +This routine is used with routines g2_addlocal(), g2_addgrid(), g2_addfield(), and g2_gribend() to create a complete GRIB2 message. g2_create() must be called first to initialize a new GRIB2 message. A call to g2_gribend() is required to complete GRIB2 message after all fields have been added. +
This routine is intended for use with routines g2_addlocal(), g2_addgrid(), g2_addfield(), and g2_gribend() to create a complete GRIB2 message. + +
Definition at line 68 of file g2_create.c. + +References G2_CREATE_GRIB_VERSION, LENSEC0, MAPSEC1LEN, and sbit(). + +
+
+
+
+This routine frees up memory that was allocated for struct gribfield. +
Definition at line 24 of file g2_free.c. + +References gribfield::bmap, gribfield::coord_list, gribfield::fld, gribfield::idrtmpl, gribfield::idsect, gribfield::igdtmpl, gribfield::ipdtmpl, gribfield::list_opt, and gribfield::local. + +Referenced by g2_getfld(). + +
+
+
+
+This subroutine returns all the metadata, template values, bit-map (if applicable), and the unpacked data for a given data field. +All of the information returned is stored in a gribfield structure, which is defined in file grib2.h. Users of this routine will need to include grib2.h in their source code that calls this routine. +Since there can be multiple data fields packed into a GRIB2 message, the calling routine indicates which field is being requested with the ifldnum argument. ++Program History Log+
+Example:+#include "grib2.h"
+gribfield *gfld;
+ret=g2_getfld(cgrib,1,1,1,&gfld);
+ ...
+g2_free(gfld);
+g2int g2_getfld(unsigned char *cgrib, g2int ifldnum, g2int unpack, g2int expand, gribfield **gfld) This subroutine returns all the metadata, template values, bit-map (if applicable),... Definition: g2_getfld.c:91 Header file for NCEPLIBS-g2c library. Routine g2_info() can be used to first determine how many data fields exist in a given GRIB message. +
Definition at line 91 of file g2_getfld.c. + +References gribfield::bmap, gribfield::coord_list, gribfield::discipline, gribfield::expanded, gribfield::fld, g2_free(), G2_GETFLD_BAD_END, G2_GETFLD_BAD_SEC1, G2_GETFLD_BAD_SEC2, G2_GETFLD_BAD_SEC3, G2_GETFLD_BAD_SEC4, G2_GETFLD_BAD_SEC5, G2_GETFLD_BAD_SEC6, G2_GETFLD_BAD_SEC7, G2_GETFLD_GRIB_VERSION, G2_GETFLD_INVAL, G2_GETFLD_INVAL_SEC, G2_GETFLD_NO_BITMAP, G2_GETFLD_NO_GRIB, G2_GETFLD_WRONG_END, G2_GETFLD_WRONG_NFLDS, G2_NO_ERROR, g2_unpack1(), g2_unpack2(), g2_unpack3(), g2_unpack4(), g2_unpack5(), g2_unpack6(), g2_unpack7(), gbit(), gribfield::griddef, gribfield::ibmap, gribfield::idrtlen, gribfield::idrtmpl, gribfield::idrtnum, gribfield::idsect, gribfield::idsectlen, gribfield::ifldnum, gribfield::igdtlen, gribfield::igdtmpl, gribfield::igdtnum, gribfield::interp_opt, gribfield::ipdtlen, gribfield::ipdtmpl, gribfield::ipdtnum, gribfield::list_opt, gribfield::local, gribfield::locallen, gribfield::ndpts, gribfield::ngrdpts, gribfield::num_coord, gribfield::num_opt, gribfield::numoct_opt, gribfield::unpacked, and gribfield::version. + +
+
+
+
+This routine finalizes a GRIB2 message after all grids and fields have been added. +It adds the End Section ("7777") to the end of the GRIB message and calculates the length and stores it in the appropriate place in Section 0. This routine is used with routines g2_create(), g2_addlocal(), g2_addgrid(), and g2_addfield() to create a complete GRIB2 message. +
Definition at line 37 of file g2_gribend.c. + +References G2_ADD_MSG_COMPLETE, G2_ADD_MSG_INIT, G2_BAD_SEC, G2_BAD_SEC_COUNTS, g2c_check_msg(), G2C_EMSGCOMPLETE, G2C_ENOTGRIB, gbit(), and sbit(). + +
+
+
+
+This subroutine searches through a GRIB2 message and returns the number of gridded fields found in the message and the number (and maximum size) of Local Use Sections. +Also various checks are performed to see if the message is a valid GRIB2 message. +
Definition at line 68 of file g2_info.c. + +References G2_INFO_BAD_END, G2_INFO_GRIB_VERSION, G2_INFO_INVAL_SEC, G2_INFO_NO_GRIB, G2_INFO_NO_SEC1, G2_INFO_WRONG_END, gbit(), and LOG. + +
+
+
+
+This subroutine unpacks Section 1 - Identification Section as defined in GRIB Edition 2. +
Definition at line 55 of file g2_unpack1.c. + +References G2_NO_ERROR, G2_UNPACK_BAD_SEC, G2_UNPACK_NO_MEM, and gbit(). + +Referenced by g2_getfld(). + +
+
+
+
+This subroutine unpacks Section 2 (Local Use Section) as defined in GRIB Edition 2. ++Program History Log+
Definition at line 38 of file g2_unpack2.c. + +References G2_NO_ERROR, G2_UNPACK_BAD_SEC, G2_UNPACK_NO_MEM, and gbit(). + +Referenced by g2_getfld(). + +
+
+
+
+This routine unpacks Section 3 (Grid Definition Section) from a GRIB2 message. ++Program History Log+
Definition at line 62 of file g2_unpack3.c. + +References gtemplate::ext, extgridtemplate(), gtemplate::extlen, G2_NO_ERROR, G2_UNPACK3_BAD_GDT, G2_UNPACK_BAD_SEC, G2_UNPACK_NO_MEM, gbit(), gbits(), getgridtemplate(), gtemplate::map, gtemplate::maplen, and gtemplate::needext. + +Referenced by g2_getfld(), getdim(), and getpoly(). + +
+
+
+
+This subroutine unpacks Section 4 (Product Definition Section) as defined in GRIB Edition 2. ++Program History Log+
Definition at line 46 of file g2_unpack4.c. + +References gtemplate::ext, gtemplate::extlen, extpdstemplate(), G2_NO_ERROR, G2_UNPACK4_BAD_PDT, G2_UNPACK_BAD_SEC, G2_UNPACK_NO_MEM, gbit(), gbits(), getpdstemplate(), gtemplate::map, gtemplate::maplen, gtemplate::needext, and rdieee(). + +Referenced by g2_getfld(). + +
+
+
+
+This subroutine unpacks Section 5 (Data Representation Section) as defined in GRIB Edition 2. ++Program History Log+
Definition at line 42 of file g2_unpack5.c. + +References gtemplate::ext, extdrstemplate(), gtemplate::extlen, G2_NO_ERROR, G2_UNPACK5_BAD_DRT, G2_UNPACK_BAD_SEC, G2_UNPACK_NO_MEM, gbit(), getdrstemplate(), gtemplate::map, gtemplate::maplen, and gtemplate::needext. + +Referenced by g2_getfld(). + +
+
+
+
+This subroutine unpacks Section 6 (Bit-Map Section) as defined in GRIB Edition 2. +
Definition at line 33 of file g2_unpack6.c. + +References G2_NO_ERROR, G2_UNPACK_BAD_SEC, G2_UNPACK_NO_MEM, gbit(), and gbits(). + +Referenced by g2_getfld(). + +
+
+
+
+This subroutine unpacks Section 7 (Data Section) of a GRIB2 message. +This function is maintained for backward compatibility. Users may wish to use the newer g2c_unpack7() function instead. +
Definition at line 207 of file g2_unpack7.c. + +References g2c_unpack7_int(). + +Referenced by g2_getfld(). + +
+
+
+
+Close a GRIB2 file, freeing resources. +
Definition at line 1357 of file g2cfile.c. + +References g2c_file_info::f, free_metadata(), G2C_EBADID, G2C_EFILE, g2c_file, G2C_MAX_FILES, G2C_NOERROR, g2c_file_info::g2cid, LOG, MUTEX_LOCK, MUTEX_UNLOCK, g2c_file_info::num_messages, and g2c_file_info::path. + +Referenced by main(). + +
+
+
+
+Compare the metadata of two open GRIB2 files. +
Definition at line 28 of file g2ccompare.c. + +References g2c_message_info::center, g2c_section5_info::data_def, g2c_message_info::day, g2c_message_info::discipline, G2C_EBADID, G2C_ENOSECTION, G2C_ERROR, g2c_file, G2C_MAX_FILES, G2C_NOERROR, g2c_section3_info::grid_def, g2c_message_info::hour, g2c_section3_info::interp_list, g2c_message_info::local_version, LOG, g2c_message_info::master_version, g2c_message_info::minute, g2c_message_info::month, g2c_file_info::msg, g2c_message_info::next, g2c_section_info::next, g2c_section4_info::num_coord, g2c_section3_info::num_data_points, g2c_section5_info::num_data_points, g2c_message_info::num_fields, g2c_message_info::num_local, g2c_file_info::num_messages, g2c_section3_info::num_opt, g2c_section_info::prev, g2c_section4_info::prod_def, g2c_message_info::sec, g2c_section_info::sec_info, g2c_section_info::sec_num, g2c_message_info::second, g2c_message_info::sig_ref_time, g2c_section3_info::source_grid_def, g2c_message_info::status, g2c_message_info::subcenter, g2c_section_info::template, g2c_section_info::template_len, g2c_message_info::type, and g2c_message_info::year. + +Referenced by main(). + +
+
+
+
+This Function decodes a JPEG2000 code stream specified in the JPEG2000 Part-1 standard (i.e., ISO/IEC 15444-1) using JasPer Software. +
Definition at line 174 of file dec_jpeg2000.c. + +References int_dec_jpeg2000(). + +
+
+
+
+Write a summary file like the degrib2 utility. +
Definition at line 566 of file g2cdegrib2.c. + +References g2c_message_info::bytes_in_msg, g2c_message_info::bytes_to_msg, g2c_message_info::center, g2c_section5_info::data_def, g2c_message_info::day, g2c_message_info::discipline, G2C_EBADID, G2C_EFILE, G2C_EINVAL, G2C_ENOSECTION, G2C_ERROR, g2c_file, g2c_get_datetime(), g2c_get_level_desc(), g2c_get_prod(), G2C_MAX_FILES, G2C_MAX_NOAA_ABBREV_LEN, G2C_MAX_TYPE_OF_FIXED_SURFACE_LEN, G2C_NOERROR, g2c_param_abbrev(), g2c_section3_info::grid_def, g2c_message_info::hour, g2c_section6_info::indicator, g2c_section3_info::interp_list, g2c_message_info::local_version, LOG, g2c_message_info::master_version, g2c_message_info::minute, g2c_message_info::month, g2c_section_info::msg, g2c_message_info::msg_num, g2c_message_info::next, g2c_section_info::next, g2c_section4_info::num_coord, g2c_section3_info::num_data_points, g2c_section5_info::num_data_points, g2c_message_info::num_fields, g2c_message_info::num_local, g2c_section3_info::num_opt, g2c_section3_info::optional, g2c_section_info::prev, g2c_section4_info::prod_def, g2c_message_info::sec, g2c_section_info::sec_info, g2c_section_info::sec_len, g2c_section_info::sec_num, g2c_message_info::second, g2c_message_info::sig_ref_time, g2c_section3_info::source_grid_def, g2c_message_info::status, g2c_message_info::subcenter, g2c_section_info::template, g2c_section_info::template_len, g2c_message_info::type, and g2c_message_info::year. + +Referenced by main(). + +
+
+
+
+This Function encodes a grayscale image into a JPEG2000 code stream specified in the JPEG2000 Part-1 standard (i.e., ISO/IEC 15444-1) using JasPer Software. ++Program History Log+
Definition at line 51 of file enc_jpeg2000.c. + +References enc_jpeg2000(). + +
+
+
+
+Given a table title and an integer code, find a description. +
Definition at line 132 of file g2cxml.c. + +References g2c_find_desc_str(), and G2C_MAX_GRIB_CODE_LEN. + +Referenced by g2c_log_section1(). + +
+
+
+
+Given a table title and a code, find a description. +
Definition at line 84 of file g2cxml.c. + +References G2C_EINVAL, G2C_ENOTFOUND, G2C_MAX_GRIB_CODE_LEN, G2C_MAX_GRIB_TITLE_LEN, G2C_NOERROR, and g2c_table. + +Referenced by g2c_find_desc(). + +
+
+
+
+Search a file for the next GRIB1 or GRIB2 message. +A grib message is identified by its indicator section, i.e. an 8-byte sequence with 'GRIB' in bytes 1-4 and a '1' or '2' in byte 8. If found, the length of the message is decoded from bytes 5-7. The search is done over a given section of the file. The search is terminated if an eof or i/o error is encountered. +
Definition at line 164 of file g2cfile.c. + +References G2C_EBADID, G2C_EFILE, G2C_EINVAL, G2C_EMSG, G2C_ENOMEM, G2C_ERROR, g2c_file, G2C_MAGIC_HEADER_LEN, G2C_NOERROR, LOG, MIN, and READ_BUF_SIZE. + +
+
+
+
+Free table memory. + +
Definition at line 42 of file g2cxml.c. + +References g2c_table. + +Referenced by g2c_log_file(). + +
+
+
+
+Get bits - unpack bits: Extract arbitrary size values from a packed bit string, right justifying each value in the unpacked iout array. +This is similar to gbit(), but with int types instead of g2int. +
Definition at line 114 of file gbits.c. + +References g2c_gbits_int(). + +
+
+
+
+Get bits - unpack bits: Extract arbitrary size values from a packed bit string, right justifying each value in the unpacked iout array. +This is similar to gbits(), but with int types instead of g2int. +
Definition at line 139 of file gbits.c. + +References G2C_EINVAL, G2C_ENOMEM, G2C_NOERROR, and gbits(). + +Referenced by g2c_gbit_int(). + +
+
+
+
+Get DRS template information. +The DRS template consists of a template map, and its length. There are no supported DRS templates with extensions. +
Definition at line 256 of file drstemplates.c. + +References G2C_ENOTEMPLATE, G2C_MAX_DRS_TEMPLATE, G2C_NOERROR, and templatesdrs. + +Referenced by g2c_rw_section5_metadata(). + +
+
+
+
+Get grid template information. +The grid template consists of a template map, its length, and, for some templates, an extra extension map, and its length. If an extension is needed, use g2c_get_grid_template_extension() to get it. +
Definition at line 376 of file gridtemplates.c. + +References G2C_ENOTEMPLATE, G2C_MAX_GDS_TEMPLATE, G2C_NOERROR, and templatesgrid. + +Referenced by g2c_rw_section3_metadata(). + +
+
+
+
+Get grid template extension information. +
Definition at line 301 of file gridtemplates.c. + +References gtemplate::ext, extgridtemplate(), gtemplate::extlen, G2C_EINVAL, G2C_ENOMEM, G2C_ENOTEMPLATE, G2C_MAX_GDS_TEMPLATE, G2C_NOERROR, and templatesgrid. + +
+
+
+
+Search a file for the next GRIB1 or GRIB2 message, and read it, allocating space in memory to hold the message. +A grib message is identified by its indicator section, i.e. an 8-byte sequence with 'GRIB' in bytes 1-4 and a '1' or '2' in byte 8. If found, the length of the message is decoded from bytes 5-7. The search is done over a given section of the file. The search is terminated if an EOF or I/O error is encountered. +
Definition at line 293 of file g2cfile.c. + +References G2C_EBADID, G2C_EFILE, G2C_EINVAL, G2C_ENOMEM, G2C_ENOMSG, G2C_ERROR, g2c_file, G2C_MIN_MAX_BYTES, G2C_NOERROR, LOG, and seekgb(). + +
+
+
+
+Get PDS template information. +The PDS template consists of a template map, its length, and, for some templates, an extra extension map, and its length. If an extension is needed, use g2c_get_pds_template_extension() to get it. +
Definition at line 816 of file pdstemplates.c. + +References G2C_ENOTEMPLATE, G2C_MAX_PDS_TEMPLATE, G2C_NOERROR, and templatespds. + +Referenced by g2c_rw_section4_metadata(). + +
+
+
+
+Get pds template extension information. +
Definition at line 741 of file pdstemplates.c. + +References gtemplate::ext, gtemplate::extlen, extpdstemplate(), G2C_EINVAL, G2C_ENOMEM, G2C_ENOTEMPLATE, G2C_MAX_PDS_TEMPLATE, G2C_NOERROR, and templatespds. + +
+
+
+
+Read the data for a product. +
Definition at line 28 of file g2cprod.c. + +References g2c_message_info::bytes_to_msg, g2c_section_info::bytes_to_sec, g2c_section5_info::data_def, g2c_file_info::f, G2C_EBADID, G2C_EFILE, G2C_EINVAL, G2C_ENOMEM, G2C_ENOMSG, G2C_ENOPRODUCT, G2C_ENOSECTION, G2C_ERROR, g2c_file, G2C_MAX_FILES, G2C_NOERROR, g2c_unpack7(), g2c_section3_info::grid_def, g2c_section_info::msg, g2c_message_info::msg_num, g2c_message_info::next, g2c_section_info::next, g2c_section5_info::num_data_points, g2c_section_info::prev, g2c_message_info::sec, g2c_section_info::sec_info, g2c_section_info::sec_len, g2c_section_info::sec_num, g2c_section_info::template, and g2c_section_info::template_len. + +Referenced by g2c_degrib2(). + +
+
+
+
+Learn about a GRIB2 file. +
Definition at line 31 of file g2cinq.c. + +References G2C_EBADID, g2c_file, G2C_MAX_FILES, G2C_NOERROR, MUTEX_LOCK, MUTEX_UNLOCK, and g2c_file_info::num_messages. + +
+
+
+
+Learn about the one of the dimensions of a GRIB2 product. +
Definition at line 328 of file g2cinq.c. + +References G2C_EBADID, G2C_ENOMSG, G2C_ENOPRODUCT, G2C_ENOSECTION, g2c_file, G2C_MAX_FILES, G2C_MAX_NAME, G2C_NOERROR, g2c_dim_info::len, g2c_message_info::msg_num, MUTEX_LOCK, g2c_dim_info::name, g2c_message_info::next, g2c_section_info::next, g2c_section_info::prev, g2c_message_info::sec, g2c_section_info::sec_info, g2c_section_info::sec_num, and g2c_dim_info::value. + +
+
+
+
+Learn about a GRIB2 message. +
Definition at line 86 of file g2cinq.c. + +References g2c_message_info::center, g2c_message_info::discipline, G2C_EBADID, G2C_ENOMSG, g2c_file, G2C_MAX_FILES, G2C_NOERROR, g2c_message_info::local_version, g2c_message_info::master_version, g2c_message_info::msg_num, g2c_message_info::next, g2c_message_info::num_fields, g2c_message_info::num_local, and g2c_message_info::subcenter. + +
+
+
+
+Learn about the date/time information in a GRIB2 message. +
Definition at line 149 of file g2cinq.c. + +References g2c_message_info::day, G2C_EBADID, G2C_ENOMSG, g2c_file, G2C_MAX_FILES, G2C_NOERROR, g2c_message_info::hour, g2c_message_info::minute, g2c_message_info::month, g2c_message_info::msg_num, g2c_message_info::next, g2c_message_info::second, g2c_message_info::sig_ref_time, and g2c_message_info::year. + +
+
+
+
+Inquire about a product. +
Definition at line 207 of file g2cinq.c. + +References G2C_EBADID, G2C_ENOMSG, G2C_ENOPRODUCT, G2C_ENOSECTION, g2c_file, G2C_MAX_FILES, G2C_NOERROR, g2c_message_info::msg_num, MUTEX_LOCK, MUTEX_UNLOCK, g2c_message_info::next, g2c_section_info::next, g2c_section_info::prev, g2c_message_info::sec, g2c_section_info::sec_info, g2c_section_info::sec_num, g2c_section_info::template, and g2c_section_info::template_len. + +
+
+
+
+This function packs up a double 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. +This function is the V2 API version of jpcpack() for doubles. +
Definition at line 387 of file jpcpack.c. + +References G2C_JPEG_DRS_TEMPLATE_LEN, and jpcpack_int(). + +
+
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. +This function is the V2 API version of jpcpack() for floats.
Definition at line 70 of file g2_addgrid.c. +Definition at line 321 of file jpcpack.c. -References gtemplate::ext, extgridtemplate(), gtemplate::extlen, G2_ADD_MSG_COMPLETE, G2_ADD_MSG_INIT, G2_ADDGRID_BAD_GDT, G2_BAD_SEC, G2_BAD_SEC_COUNTS, g2c_check_msg(), G2C_MSG_COMPLETE, G2C_NOT_GRIB, gbit(), getgridtemplate(), gtemplate::map, gtemplate::maplen, gtemplate::needext, sbit(), and sbits(). +References G2C_JPEG_DRS_TEMPLATE_LEN, and jpcpack_int(). - -◆ g2_addlocal()+ +◆ g2c_jpcunpackd()
+
+
+Unpack JPEG2000 compressed data into an array of doubles, using info from the GRIB2 Data Representation Template 5.40 or 5.40000. +This function is the V2 API version of jpcunpack() for doubles. +
Definition at line 200 of file jpcunpack.c. + +References G2C_JPEG_DRS_TEMPLATE_LEN, jpcunpack_int(), and LOG. + +◆ g2c_jpcunpackf()+ +
+
+
Definition at line 160 of file jpcunpack.c. + +References G2C_JPEG_DRS_TEMPLATE_LEN, jpcunpack_int(), and LOG. + + + + +◆ g2c_log_file()+ +
+
+
+
+
+
+
+Print a summary of the contents of an open GRIB2 file. +If the NCEPLIBS-g2c library is built without the LOGGING option, this function will do nothing. +
Definition at line 188 of file g2cutil.c. + +References g2c_message_info::bytes_in_msg, g2c_message_info::bytes_to_msg, g2c_message_info::center, g2c_message_info::day, G2C_EBADID, g2c_file, g2c_free_tables(), g2c_log_section(), g2c_log_section1(), G2C_NOERROR, g2c_table, g2c_xml_init(), 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::msg_num, g2c_message_info::next, g2c_section_info::next, g2c_message_info::num_fields, g2c_message_info::num_local, g2c_message_info::sec, 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 read_metadata(). + +◆ g2c_open()+ +
+
-
-
+
+
+
Open an existing GRIB2 file.
Definition at line 40 of file g2_addlocal.c. +Definition at line 1193 of file g2cfile.c. -References G2_ADD_MSG_COMPLETE, G2_ADD_MSG_INIT, G2_BAD_SEC, G2_BAD_SEC_COUNTS, g2c_check_msg(), G2C_MSG_COMPLETE, G2C_NOT_GRIB, gbit(), and sbit(). +References g2c_add_file(), MUTEX_LOCK, MUTEX_UNLOCK, and read_metadata(). + +Referenced by main(). ◆ g2_create()+ +◆ g2c_open_index()
This routine is intended for use with routines g2_addlocal(), g2_addgrid(), g2_addfield(), and g2_gribend() to create a complete GRIB2 message. - -
Definition at line 68 of file g2_create.c. +Definition at line 786 of file g2cindex.c. -References G2_CREATE_GRIB_VERSION, LENSEC0, MAPSEC1LEN, and sbit(). +References add_msg(), add_section(), g2c_message_info::bytes_to_bms, g2c_message_info::bytes_to_data, g2c_message_info::bytes_to_local, g2c_message_info::bytes_to_msg, g2c_message_info::discipline, g2c_add_file(), G2C_EBADSECTION, G2C_EFILE, G2C_EINVAL, G2C_ENAMETOOLONG, g2c_file, g2c_file_io_ubyte(), g2c_file_io_uint(), G2C_FILE_READ, G2C_INDEX_BASENAME_LEN, G2C_INDEX_DATE_STR_LEN, G2C_INDEX_HEADER_LEN, G2C_INDEX_STR1_LEN, G2C_INDEX_TIME_STR_LEN, g2c_log_section1(), G2C_MAX_NAME, G2C_NOERROR, g2c_rw_section1_metadata(), g2c_start_index_record(), LOG, g2c_message_info::master_version, MUTEX_LOCK, and MUTEX_UNLOCK. - -◆ g2_free()+ +◆ g2c_open_index1()
-
This routine frees up memory that was allocated for struct gribfield. +Open a GRIB1 index file and read the contents.
Definition at line 24 of file g2_free.c. +
References gribfield::bmap, gribfield::coord_list, gribfield::fld, gribfield::idrtmpl, gribfield::idsect, gribfield::igdtmpl, gribfield::ipdtmpl, gribfield::list_opt, and gribfield::local. +Definition at line 685 of file g2cindex.c. -Referenced by g2_getfld(). +References G2C_EFILE, G2C_EINVAL, G2C_FILE_READ, G2C_INDEX1_BDS_VAL_LEN, G2C_INDEX1_BMS_VAL_LEN, G2C_INDEX1_GDS_VAL_LEN, G2C_INDEX1_PDS_VAL_LEN, G2C_INDEX_BASENAME_LEN, G2C_INDEX_DATE_STR_LEN, G2C_INDEX_HEADER_LEN, G2C_INDEX_TIME_STR_LEN, G2C_NOERROR, g2c_start_index1_record(), LOG, MUTEX_LOCK, MUTEX_UNLOCK, read_hdr_rec1(), and read_hdr_rec2(). ◆ g2_getfld()+ +◆ g2c_param_abbrev()
Get NOAA abbreviation for a GRIB2 parameter.
-Example:-Routine g2_info() can be used to first determine how many data fields exist in a given GRIB message. -
Definition at line 91 of file g2_getfld.c. +Definition at line 1091 of file g2cparams.c. -References gribfield::bmap, gribfield::coord_list, gribfield::discipline, gribfield::expanded, gribfield::fld, g2_free(), G2_GETFLD_BAD_END, G2_GETFLD_BAD_SEC1, G2_GETFLD_BAD_SEC2, G2_GETFLD_BAD_SEC3, G2_GETFLD_BAD_SEC4, G2_GETFLD_BAD_SEC5, G2_GETFLD_BAD_SEC6, G2_GETFLD_BAD_SEC7, G2_GETFLD_GRIB_VERSION, G2_GETFLD_INVAL, G2_GETFLD_INVAL_SEC, G2_GETFLD_NO_BITMAP, G2_GETFLD_NO_GRIB, G2_GETFLD_WRONG_END, G2_GETFLD_WRONG_NFLDS, G2_NO_ERROR, g2_unpack1(), g2_unpack2(), g2_unpack3(), g2_unpack4(), g2_unpack5(), g2_unpack6(), g2_unpack7(), gbit(), gribfield::griddef, gribfield::ibmap, gribfield::idrtlen, gribfield::idrtmpl, gribfield::idrtnum, gribfield::idsect, gribfield::idsectlen, gribfield::ifldnum, gribfield::igdtlen, gribfield::igdtmpl, gribfield::igdtnum, gribfield::interp_opt, gribfield::ipdtlen, gribfield::ipdtmpl, gribfield::ipdtnum, gribfield::list_opt, gribfield::local, gribfield::locallen, gribfield::ndpts, gribfield::ngrdpts, gribfield::num_coord, gribfield::num_opt, gribfield::numoct_opt, gribfield::unpacked, and gribfield::version. +References G2C_MAX_NOAA_ABBREV_LEN, G2C_MAX_NOAA_PARAMS, G2C_NOERROR, LOG, and param. + +Referenced by g2c_degrib2(), and g2c_log_section(). - -◆ g2_gribend()+ +◆ g2c_param_all()
-
This routine finalizes a GRIB2 message after all grids and fields have been added. -It adds the End Section ("7777") to the end of the GRIB message and calculates the length and stores it in the appropriate place in Section 0. This routine is used with routines g2_create(), g2_addlocal(), g2_addgrid(), and g2_addfield() to create a complete GRIB2 message. +Return all the information about a parameter.
Definition at line 37 of file g2_gribend.c. +Definition at line 1185 of file g2cparams.c. -References G2_ADD_MSG_COMPLETE, G2_ADD_MSG_INIT, G2_BAD_SEC, G2_BAD_SEC_COUNTS, g2c_check_msg(), G2C_MSG_COMPLETE, G2C_NOT_GRIB, gbit(), and sbit(). +References g2c_param::g1num, g2c_param::g1ver, G2C_EINVAL, G2C_MAX_NOAA_ABBREV_LEN, G2C_MAX_NOAA_PARAMS, G2C_NOERROR, g2c_param::g2cat, g2c_param::g2disc, g2c_param::g2num, and param. ◆ g2_info()+ +◆ g2c_param_g1tog2()
-
- This subroutine searches through a GRIB2 message and returns the number of gridded fields found in the message and the number (and maximum size) of Local Use Sections. -Also various checks are performed to see if the message is a valid GRIB2 message. -
+
+
Translate GRIB1 parameter to GRIB2 parameter. +
◆ g2_unpack1()+ +◆ g2c_param_g2tog1()
Definition at line 55 of file g2_unpack1.c. + +
References G2_NO_ERROR, G2_UNPACK_BAD_SEC, G2_UNPACK_NO_MEM, and gbit(). +Definition at line 1136 of file g2cparams.c. -Referenced by g2_getfld(). +References g2c_param::g1num, g2c_param::g1ver, G2C_ENOPARAM, G2C_MAX_NOAA_PARAMS, G2C_NOERROR, LOG, and param. - -◆ g2_unpack2()+ +◆ g2c_pngpackd()
This subroutine packs up a double 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.
Definition at line 38 of file g2_unpack2.c. + +
References G2_NO_ERROR, G2_UNPACK_BAD_SEC, G2_UNPACK_NO_MEM, and gbit(). +Definition at line 336 of file pngpack.c. -Referenced by g2_getfld(). +References G2C_PNG_DRS_TEMPLATE_LEN, and pngpack_int(). - -◆ g2_unpack3()+ +◆ g2c_pngpackf()
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.
Definition at line 57 of file g2_unpack3.c. + -References gtemplate::ext, extgridtemplate(), gtemplate::extlen, G2_NO_ERROR, G2_UNPACK3_BAD_GDT, G2_UNPACK_BAD_SEC, G2_UNPACK_NO_MEM, gbit(), gbits(), getgridtemplate(), gtemplate::map, gtemplate::maplen, and gtemplate::needext. +Definition at line 282 of file pngpack.c. -Referenced by g2_getfld(), getdim(), and getpoly(). +References G2C_PNG_DRS_TEMPLATE_LEN, and pngpack_int(). - -◆ g2_unpack4()+ +◆ g2c_pngunpackd()
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.
Definition at line 46 of file g2_unpack4.c. + +
References gtemplate::ext, gtemplate::extlen, extpdstemplate(), G2_NO_ERROR, G2_UNPACK4_BAD_PDT, G2_UNPACK_BAD_SEC, G2_UNPACK_NO_MEM, gbit(), gbits(), getpdstemplate(), gtemplate::map, gtemplate::maplen, gtemplate::needext, and rdieee(). +Definition at line 179 of file pngunpack.c. -Referenced by g2_getfld(). +References G2C_PNG_DRS_TEMPLATE_LEN, and pngunpack_int(). - -◆ g2_unpack5()+ +◆ g2c_pngunpackf()
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.
Definition at line 42 of file g2_unpack5.c. + +
References gtemplate::ext, extdrstemplate(), gtemplate::extlen, G2_NO_ERROR, G2_UNPACK5_BAD_DRT, G2_UNPACK_BAD_SEC, G2_UNPACK_NO_MEM, gbit(), getdrstemplate(), gtemplate::map, gtemplate::maplen, and gtemplate::needext. +Definition at line 147 of file pngunpack.c. -Referenced by g2_getfld(). +References G2C_PNG_DRS_TEMPLATE_LEN, and pngunpack_int(). - -◆ g2_unpack6()+ +◆ g2c_seekmsg()
|
#define G2_VERSION "1.7.0" | +#define G2C_BYTE 1 |
#define G2C_MSG_COMPLETE -51 | +#define G2C_CHAR 2 |
#define G2C_NO_ERROR 0 | +#define G2C_CLOBBER 0x0000 |
#define G2C_NOT_GRIB -50 | +#define G2C_DOUBLE 6 |
typedef float g2float | +#define G2C_EBADEND (-65) |
typedef int64_t g2int | +#define G2C_EBADID (-55) |
typedef uint64_t g2intu | +#define G2C_EBADSECTION (-66) |
g2int g2_addgrid | -( | -unsigned char * | -cgrib, | +#define G2C_ENOMSG (-59) | +