.TH "g2_unpack7.c" 3 "Tue May 3 2022" "Version 1.6.4" "NCEPLIBS-g2c" \" -*- nroff -*- .ad l .nh .SH NAME g2_unpack7.c \- Unpack Section 7 (Data Section) as defined in GRIB Edition 2\&. .SH SYNOPSIS .br .PP \fC#include \fP .br \fC#include \fP .br \fC#include \fP .br \fC#include \fP .br \fC#include 'grib2\&.h'\fP .br .SS "Functions" .in +1c .ti -1c .RI "int \fBcomunpack\fP (unsigned char *, \fBg2int\fP, \fBg2int\fP, \fBg2int\fP *, \fBg2int\fP, \fBg2float\fP *)" .br .RI "This subroutine unpacks a data field that was packed using a complex packing algorithm as defined in the GRIB2 documention, using info from the GRIB2 Data Representation Template 5\&.2 or 5\&.3\&. " .ti -1c .RI "\fBg2int\fP \fBg2_unpack7\fP (unsigned char *cgrib, \fBg2int\fP *iofst, \fBg2int\fP igdsnum, \fBg2int\fP *igdstmpl, \fBg2int\fP idrsnum, \fBg2int\fP *idrstmpl, \fBg2int\fP ndpts, \fBg2float\fP **fld)" .br .RI "This subroutine unpacks Section 7 (Data Section) as defined in GRIB Edition 2\&. " .ti -1c .RI "\fBg2int\fP \fBjpcunpack\fP (unsigned char *, \fBg2int\fP, \fBg2int\fP *, \fBg2int\fP, \fBg2float\fP *)" .br .RI "This subroutine unpacks a data field that was packed into a JPEG2000 code stream using info from the GRIB2 Data Representation Template 5\&.40 or 5\&.40000\&. " .ti -1c .RI "\fBg2int\fP \fBpngunpack\fP (unsigned char *, \fBg2int\fP, \fBg2int\fP *, \fBg2int\fP, \fBg2float\fP *)" .br .RI "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\&. " .ti -1c .RI "\fBg2int\fP \fBsimunpack\fP (unsigned char *, \fBg2int\fP *, \fBg2int\fP, \fBg2float\fP *)" .br .RI "This subroutine unpacks a data field that was packed using a simple packing algorithm as defined in the GRIB2 documention, using info from the GRIB2 Data Representation Template 5\&.0\&. " .ti -1c .RI "\fBg2int\fP \fBspecunpack\fP (unsigned char *, \fBg2int\fP *, \fBg2int\fP, \fBg2int\fP, \fBg2int\fP, \fBg2int\fP, \fBg2float\fP *)" .br .RI "This subroutine unpacks a spectral data field that was packed using the complex packing algorithm for spherical harmonic data as defined in the GRIB2 documention, using info from the GRIB2 Data Representation Template 5\&.51\&. " .in -1c .SH "Detailed Description" .PP Unpack Section 7 (Data Section) as defined in GRIB Edition 2\&. .PP \fBAuthor\fP .RS 4 Stephen Gilbert .RE .PP \fBDate\fP .RS 4 2002-10-31 .RE .PP .PP Definition in file \fBg2_unpack7\&.c\fP\&. .SH "Function Documentation" .PP .SS "int comunpack (unsigned char * cpack, \fBg2int\fP lensec, \fBg2int\fP idrsnum, \fBg2int\fP * idrstmpl, \fBg2int\fP ndpts, \fBg2float\fP * fld)" .PP This subroutine unpacks a data field that was packed using a complex packing algorithm as defined in the GRIB2 documention, using info from the GRIB2 Data Representation Template 5\&.2 or 5\&.3\&. Supports GRIB2 complex packing templates with or without spatial differences (i\&.e\&. DRTs 5\&.2 and 5\&.3)\&. .PP PROGRAM HISTORY LOG: .IP "\(bu" 2 2002-10-29 Gilbert .IP "\(bu" 2 2004-12-16 Gilbert Added test (provided by Arthur Taylor/MDL) to verify that group widths and lengths are consistent with section length\&. .PP .PP \fBParameters\fP .RS 4 \fIcpack\fP pointer to the packed data field\&. .br \fIlensec\fP length of section 7 (used for error checking)\&. .br \fIidrsnum\fP Data Representation Template number 5\&.N Must equal 2 or 3\&. .br \fIidrstmpl\fP pointer to the array of values for Data Representation Template 5\&.2 or 5\&.3 .br \fIndpts\fP The number of data values to unpack .br \fIfld\fP Contains the unpacked data values\&. fld must be allocated with at least ndpts*sizeof(g2float) bytes before calling this routine\&. .RE .PP \fBReturns\fP .RS 4 0 for success, error code otherwise\&. .RE .PP \fBAuthor\fP .RS 4 Stephen Gilbert .RE .PP \fBDate\fP .RS 4 2002-10-29 .RE .PP .PP Definition at line 39 of file comunpack\&.c\&. .PP References gbit(), gbits(), int_power(), and rdieee()\&. .PP Referenced by g2_unpack7()\&. .SS "\fBg2int\fP g2_unpack7 (unsigned char * cgrib, \fBg2int\fP * iofst, \fBg2int\fP igdsnum, \fBg2int\fP * igdstmpl, \fBg2int\fP idrsnum, \fBg2int\fP * idrstmpl, \fBg2int\fP ndpts, \fBg2float\fP ** fld)" .PP This subroutine unpacks Section 7 (Data Section) as defined in GRIB Edition 2\&. PROGRAM HISTORY LOG: .IP "\(bu" 2 2002-10-31 Gilbert .IP "\(bu" 2 2002-12-20 Gilbert - Added GDT info to arguments and added 5\&.51 processing\&. .IP "\(bu" 2 2003-08-29 Gilbert - Added support for new templates using PNG and JPEG2000 algorithms/templates\&. .IP "\(bu" 2 2004-11-29 Gilbert - JPEG2000 now allowed to use WMO Template no\&. 5\&.40 PNG now allowed to use WMO Template no\&. 5\&.41 .IP "\(bu" 2 2004-12-16 Taylor - Added check on comunpack return code\&. .IP "\(bu" 2 2008-12-23 Wesley - Initialize Number of data points unpacked .PP .PP \fBParameters\fP .RS 4 \fIcgrib\fP char array containing Section 7 of the GRIB2 message .br \fIiofst\fP Bit offset of the beginning of Section 7 in cgrib\&. .br \fIigdsnum\fP Grid Definition Template Number (see Code Table 3\&.0) (Only used for DRS Template 5\&.51) .br \fIigdstmpl\fP 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)\&. .br \fIidrsnum\fP Data Representation Template Number (see Code Table 5\&.0) .br \fIidrstmpl\fP 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 .br \fIndpts\fP Number of data points unpacked and returned\&. .br \fIfld\fP Pointer to a float array containing the unpacked data field\&. .RE .PP \fBReturns\fP .RS 4 .IP "\(bu" 2 0 no error .IP "\(bu" 2 2 Not section 7 .IP "\(bu" 2 4 Unrecognized Data Representation Template .IP "\(bu" 2 5 need one of GDT 3\&.50 through 3\&.53 to decode DRT 5\&.51 .IP "\(bu" 2 6 memory allocation error .IP "\(bu" 2 7 corrupt section 7\&. .PP .RE .PP \fBAuthor\fP .RS 4 Stephen Gilbert .RE .PP \fBDate\fP .RS 4 2002-10-31 .RE .PP .PP Definition at line 66 of file g2_unpack7\&.c\&. .PP References comunpack(), gbit(), jpcunpack(), pngunpack(), rdieee(), simunpack(), and specunpack()\&. .PP Referenced by g2_getfld()\&. .SS "\fBg2int\fP jpcunpack (unsigned char * cpack, \fBg2int\fP len, \fBg2int\fP * idrstmpl, \fBg2int\fP ndpts, \fBg2float\fP * fld)" .PP This subroutine unpacks a data field that was packed into a JPEG2000 code stream using info from the GRIB2 Data Representation Template 5\&.40 or 5\&.40000\&. .PP \fBParameters\fP .RS 4 \fIcpack\fP The packed data field (character*1 array)\&. .br \fIlen\fP length of packed field cpack\&. .br \fIidrstmpl\fP Pointer to array of values for Data Representation Template 5\&.40 or 5\&.40000\&. .br \fIndpts\fP The number of data values to unpack\&. .br \fIfld\fP Contains the unpacked data values\&. .RE .PP \fBReturns\fP .RS 4 0 for success, 1 for memory allocation error\&. .RE .PP \fBAuthor\fP .RS 4 Stephem Gilbert .RE .PP \fBDate\fP .RS 4 2003-08-27 .RE .PP .PP Definition at line 29 of file jpcunpack\&.c\&. .PP References dec_jpeg2000(), int_power(), and rdieee()\&. .PP Referenced by g2_unpack7()\&. .SS "\fBg2int\fP pngunpack (unsigned char * cpack, \fBg2int\fP len, \fBg2int\fP * idrstmpl, \fBg2int\fP ndpts, \fBg2float\fP * fld)" .PP 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\&. .PP \fBParameters\fP .RS 4 \fIcpack\fP The packed data field (character*1 array)\&. .br \fIlen\fP length of packed field cpack()\&. .br \fIidrstmpl\fP Pointer to array of values for Data Representation Template 5\&.41 or 5\&.40010\&. .br \fIndpts\fP The number of data values to unpack\&. .br \fIfld\fP Contains the unpacked data values\&. .RE .PP \fBReturns\fP .RS 4 0 for success, 1 for memory allocation error\&. .RE .PP \fBAuthor\fP .RS 4 Stephen Gilbert .RE .PP \fBDate\fP .RS 4 2003-08-27 .RE .PP .PP Definition at line 27 of file pngunpack\&.c\&. .PP References dec_png(), gbits(), int_power(), and rdieee()\&. .PP Referenced by g2_unpack7()\&. .SS "\fBg2int\fP simunpack (unsigned char * cpack, \fBg2int\fP * idrstmpl, \fBg2int\fP ndpts, \fBg2float\fP * fld)" .PP This subroutine unpacks a data field that was packed using a simple packing algorithm as defined in the GRIB2 documention, using info from the GRIB2 Data Representation Template 5\&.0\&. .PP \fBParameters\fP .RS 4 \fIcpack\fP pointer to the packed data field\&. .br \fIidrstmpl\fP pointer to the array of values for Data Representation Template 5\&.0\&. .br \fIndpts\fP The number of data values to unpack\&. .br \fIfld\fP Contains the unpacked data values\&. fld must be allocated with at least ndpts*sizeof(g2float) bytes before calling this routine\&. .RE .PP \fBReturns\fP .RS 4 0 for success, error code otherwise\&. .RE .PP \fBAuthor\fP .RS 4 Stephen Gilbert .RE .PP \fBDate\fP .RS 4 2002-10-29 .RE .PP .PP Definition at line 26 of file simunpack\&.c\&. .PP References gbits(), int_power(), and rdieee()\&. .PP Referenced by g2_unpack7()\&. .SS "\fBg2int\fP specunpack (unsigned char * cpack, \fBg2int\fP * idrstmpl, \fBg2int\fP ndpts, \fBg2int\fP JJ, \fBg2int\fP KK, \fBg2int\fP MM, \fBg2float\fP * fld)" .PP This subroutine unpacks a spectral data field that was packed using the complex packing algorithm for spherical harmonic data as defined in the GRIB2 documention, using info from the GRIB2 Data Representation Template 5\&.51\&. .PP \fBParameters\fP .RS 4 \fIcpack\fP pointer to the packed data field\&. .br \fIidrstmpl\fP pointer to the array of values for Data Representation Template 5\&.51\&. .br \fIndpts\fP The number of data values to unpack (real and imaginary parts)\&. .br \fIJJ\fP pentagonal resolution parameter\&. .br \fIKK\fP pentagonal resolution parameter\&. .br \fIMM\fP pentagonal resolution parameter\&. .br \fIfld\fP Contains the unpacked data values\&. fld must be allocated with at least ndpts*sizeof(g2float) bytes before calling this routine\&. .RE .PP \fBReturns\fP .RS 4 0 for success, -3 for wrong type\&. .RE .PP \fBAuthor\fP .RS 4 Stephen Gilbert .RE .PP \fBDate\fP .RS 4 2000-06-21 .RE .PP .PP Definition at line 34 of file specunpack\&.c\&. .PP References gbits(), int_power(), and rdieee()\&. .PP Referenced by g2_unpack7()\&. .SH "Author" .PP Generated automatically by Doxygen for NCEPLIBS-g2c from the source code\&.