Loading...
Searching...
No Matches
getpoly.c
Go to the documentation of this file.
#include "grib2_int.h"
#include <stdio.h>
#include <stdlib.h>
g2int
getpoly(unsigned char *csec3, g2int *jj, g2int *kk, g2int *mm)
{
g2int *igdstmpl, *list_opt;
g2int *igds;
g2int iofst, igdtlen, num_opt;
iofst = 0; /* set offset to beginning of section */
if (!g2_unpack3(csec3, &iofst, &igds, &igdstmpl, &igdtlen,
&list_opt, &num_opt))
{
switch (igds[4]) /* Template number */
{
case 50: /* Spherical harmonic coefficients */
case 51:
case 52:
case 53: {
*jj = igdstmpl[0];
*kk = igdstmpl[1];
*mm = igdstmpl[2];
break;
}
default: {
*jj = 0;
*kk = 0;
*mm = 0;
break;
}
} /* end switch */
}
else
{
*jj = 0;
*kk = 0;
*mm = 0;
}
if (igds)
free(igds);
if (igdstmpl)
free(igdstmpl);
if (list_opt)
free(list_opt);
return 0;
}
g2_unpack3
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
getpoly
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
g2int
int64_t g2int
Long integer type.
Definition grib2.h:32
grib2_int.h
Header file with internal function prototypes NCEPLIBS-g2c library.