NCEPLIBS-g2  3.4.5
addgrid.f File Reference

This subroutine packs up a Grid Definition Section (Section 3) and adds 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)
 This routine is used with routines gribcreate(), addlocal(), addfield(), and gribend() to create a complete GRIB2 message. More...
 

Detailed Description

This subroutine packs up a Grid Definition Section (Section 3) and adds it to a GRIB2 message.

Author
Stephen Gilbert
Date
2000-05-01

Definition in file addgrid.f.

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 
)

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

Subroutine gribcreate must be called first to initialize a new 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. (Code Table 3.11)
  • igds(5)=Grid Definition Template Number (Code Table 3.1)
[in]igdstmplContains the data values for the specified Grid Definition Template ( NN=igds(5) ). Each element of this integer array contains an entry (in the order specified) of Grid Defintion Template 3.NN
[in]igdstmplenMax dimension of igdstmpl()
[in]ideflist(Used if igds(3) .ne. 0) This array contains the number of grid points contained in each row ( or column )
[in]idefnum(Used if igds(3) .ne. 0) The number of entries in array ideflist. i.e. 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.
Note
: Note that the Local Use Section ( Section 2 ) can only follow Section 1 or Section 7 in a GRIB2 message.
Author
Stephen Gilbert
Date
2000-05-01

Definition at line 48 of file addgrid.f.