NCEPLIBS-g2  3.4.7
addgrid.F90 File Reference

Pack up a Grid Definition Section (Section 3) and add it to a GRIB2 message. More...

Go to the source code of this file.

Functions/Subroutines

subroutine addgrid (cgrib, lcgrib, igds, igdstmpl, igdstmplen, ideflist, idefnum, ierr)
 Add a Grid Definition Section (Section 3) to a GRIB2 message. More...
 

Detailed Description

Pack up a Grid Definition Section (Section 3) and add it to a GRIB2 message.

Author
Stephen Gilbert
Date
2000-05-01

Definition in file addgrid.F90.

Function/Subroutine Documentation

◆ addgrid()

subroutine addgrid ( character(len = 1), dimension(lcgrib), intent(inout)  cgrib,
integer, intent(in)  lcgrib,
integer, dimension(*), intent(in)  igds,
integer, dimension(*), intent(in)  igdstmpl,
integer, intent(in)  igdstmplen,
integer, dimension(idefnum), intent(in)  ideflist,
integer, intent(in)  idefnum,
integer, intent(out)  ierr 
)

Add a Grid Definition Section (Section 3) to a GRIB2 message.

This routine is used with routines gribcreate(), addlocal(), addfield(), and gribend() to create a complete GRIB2 message.

Parameters
[in,out]cgribCharacter array to contain the GRIB2 message.
[in]lcgribMaximum length (bytes) of array cgrib.
[in]igdsContains information needed for GRIB Grid Definition Section 3. Must be dimensioned >= 5.
  • igds(1) Source of grid definition (see Code Table 3.0).
  • igds(2) Number of grid points in the defined grid.
  • igds(3) 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(4) Interpretation of list for optional points definition. (See Code Table 3.11).
  • igds(5) Grid Definition Template Number (See Code Table 3.1).
[in]igdstmplContains the data values for the Grid Definition Template specified by igds(5). This should have the length of mapgridlen of the selected grid template.
[in]igdstmplenMax dimension of igdstmpl. This must be at least as large as the mapgridlen of the chosen template.
[in]ideflist(Used if igds(3) .ne. 0). This array contains the number of grid points contained in each row (or column).
[in]idefnumThe number of entries in array ideflist. This is the number of rows (or columns) for which optional grid points are defined.
[out]ierrError return code.
  • 0 no error.
  • 1 GRIB message was not initialized. Need to call routine gribcreate first.
  • 2 GRIB message already complete. Cannot add new section.
  • 3 Sum of Section byte counts doesn't add to total byte count.
  • 4 Previous Section was not 1, 2 or 7.
  • 5 Could not find requested Grid Definition Template.
Author
Stephen Gilbert
Date
2000-05-01

Definition at line 49 of file addgrid.F90.

References gridtemplates::extgridtemplate(), g2_gbytec(), g2_sbytec(), g2_sbytesc(), and gridtemplates::getgridtemplate().

Referenced by putgb2().