NCEPLIBS-g2c 2.0.0
Loading...
Searching...
No Matches
getpoly.c
Go to the documentation of this file.
1
7#include "grib2_int.h"
8#include <stdio.h>
9#include <stdlib.h>
10
40getpoly(unsigned char *csec3, g2int *jj, g2int *kk, g2int *mm)
41{
42
43 g2int *igdstmpl, *list_opt;
44 g2int *igds;
45 g2int iofst, igdtlen, num_opt;
46
47 iofst = 0; /* set offset to beginning of section */
48 if (!g2_unpack3(csec3, &iofst, &igds, &igdstmpl, &igdtlen,
49 &list_opt, &num_opt))
50 {
51 switch (igds[4]) /* Template number */
52 {
53 case 50: /* Spherical harmonic coefficients */
54 case 51:
55 case 52:
56 case 53: {
57 *jj = igdstmpl[0];
58 *kk = igdstmpl[1];
59 *mm = igdstmpl[2];
60 break;
61 }
62 default: {
63 *jj = 0;
64 *kk = 0;
65 *mm = 0;
66 break;
67 }
68 } /* end switch */
69 }
70 else
71 {
72 *jj = 0;
73 *kk = 0;
74 *mm = 0;
75 }
76
77 if (igds)
78 free(igds);
79 if (igdstmpl)
80 free(igdstmpl);
81 if (list_opt)
82 free(list_opt);
83
84 return 0;
85}
g2int g2_unpack3(unsigned char *cgrib, g2int *iofst, g2int **igds, g2int **igdstmpl, g2int *mapgridlen, g2int **ideflist, g2int *idefnum)
Unpack Section 3 (Grid Definition Section) of a GRIB2 message.
Definition g2_unpack3.c:62
g2int getpoly(unsigned char *csec3, g2int *jj, g2int *kk, g2int *mm)
This subroutine returns the J, K, and M pentagonal resolution parameters specified in a GRIB Grid Def...
Definition getpoly.c:40
int64_t g2int
Long integer type.
Definition grib2.h:32
Header file with internal function prototypes NCEPLIBS-g2c library.