Scroll to navigation

getdim.c(3) NCEPLIBS-g2c getdim.c(3)

NAME

getdim.c - Return the dimensions and scanning mode of a grid definition packed in GRIB2 Grid Definition Section 3 format.

SYNOPSIS

#include <stdio.h>
#include <stdlib.h>
#include 'grib2.h'

Functions


g2int g2_unpack3 (unsigned char *, g2int *, g2int **, g2int **, g2int *, g2int **, g2int *)
This routine unpacks Section 3 (Grid Definition Section) as defined in GRIB Edition 2. g2int getdim (unsigned char *csec3, g2int *width, g2int *height, g2int *iscan)
This subroutine returns the dimensions and scanning mode of a grid definition packed in GRIB2 Grid Definition Section 3 format.

Detailed Description

Return the dimensions and scanning mode of a grid definition packed in GRIB2 Grid Definition Section 3 format.

Author

Stephen Gilbert

Date

2002-12-11

Definition in file getdim.c.

Function Documentation

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. PROGRAM HISTORY LOG:

  • 2002-10-31 Gilbert
  • 2009-01-14 Vuong Changed structure name template to gtemplate

Parameters

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.
  • igds[0] Source of grid definition (see Code Table 3.0)
  • igds[1] Number of grid points in the defined grid.
  • igds[2] Number of octets needed for each additional grid points definition. Used to define number of points in each row (or column) for non-regular grids. = 0, if using regular grid.
  • igds[3] Interpretation of list for optional points definition. (Code Table 3.11)
  • igds[4] Grid Definition Template Number (Code Table 3.1).

igdstmpl - Pointer to integer array containing the data values for the specified Grid Definition Template (NN=igds[4]). Each element of this integer array contains an entry (in the order specified) of Grid Defintion Template 3.NN
mapgridlen- Number of elements in igdstmpl[]. i.e. number of entries in Grid Defintion Template 3.NN (NN=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 ). (part of Section 3).
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.

Returns

  • 0 no error
  • 2 Not Section 3
  • 5 'GRIB' message contains an undefined Grid Definition Template.
  • 6 memory allocation error

Author

Stephen Gilbert

Date

2002-10-31

Definition at line 53 of file g2_unpack3.c.

Referenced by getdim().

g2int getdim (unsigned char * csec3, g2int * width, g2int * height, g2int * iscan)

This subroutine returns the dimensions and scanning mode of a grid definition packed in GRIB2 Grid Definition Section 3 format.

Parameters

csec3 Character array that contains the packed GRIB2 GDS.
width x (or i) dimension of the grid. 0 of grid not recognized.
height y (or j) dimension of the grid. 0 of grid not recognized.
iscan Scanning mode (see Code Table 3.4). 0 of grid not recognized.

Returns

Always returns 0.

Author

Stephen Gilbert

Date

2002-12-11

Definition at line 30 of file getdim.c.

References g2_unpack3().

Referenced by g2_addfield().

Author

Generated automatically by Doxygen for NCEPLIBS-g2c from the source code.

Fri Jun 3 2022 Version 1.6.4