NCEPLIBS-g2  3.5.0
pdstemplates Module Reference

Information on all GRIB2 Product Definition Templates used in Section 4 - the Product Definition Section (PDS) More...

Data Types

type  pdstemplate
 This is the defined type for a Product Definition Section (PDS) template. More...
 

Functions/Subroutines

subroutine extpdstemplate (number, list, nummap, map)
 This subroutine generates the remaining octet map for a given Product Definition Template, if required. More...
 
integer function getpdsindex (number)
 This function returns the index of specified Product Definition Template in array templates. More...
 
subroutine getpdstemplate (number, nummap, map, needext, iret)
 This subroutine returns PDS template information for a specified Product Definition Template. More...
 
integer function getpdtlen (number)
 This function returns the initial length (number of entries) in the static part of specified Product Definition Template. More...
 

Variables

integer, parameter maxlen = 200
 MAXLEN max length of entries. More...
 
integer, parameter maxtemp = 43
 MAXTEMP maximum number of templates. More...
 
type(pdstemplate), dimension(maxtemptemplates
 template in type of pdstemplate More...
 

Detailed Description

Information on all GRIB2 Product Definition Templates used in Section 4 - the Product Definition Section (PDS)

Each Template has three parts:

  1. The number of entries in the template (mapppdslen);
  2. A map of the template (mappds), which contains the number of octets in which to pack each of the template values;
  3. a logical value (needext) that indicates whether the Template needs to be extended. In some cases the number of entries in a template can vary depending upon values specified in the static part of the template. (Template 4.3 as an example).

This module also contains two subroutines.

  • getpdstemplate() returns the octet map for a specified Template number.
  • extpdstemplate() will calculate the extended octet map of an appropriate template given values for the static part of the template.
Note
Array mapgrid contains the number of octets in which the corresponding template values will be stored. A negative value in mapgrid is used to indicate that the corresponding template entry can contain negative values. This information is used later when packing (or unpacking) the template data values. Negative data values in GRIB are stored with the left most bit set to one, and a negative number of octets value in mapgrid indicates that this possibility should be considered. The number of octets used to store the data value in this case would be the absolute value of the negative value in mapgrid.
Author
Stephen Gilbert
Date
2000-05-11

Data Type Documentation

◆ pdstemplates::pdstemplate

type pdstemplates::pdstemplate

This is the defined type for a Product Definition Section (PDS) template.

Definition at line 46 of file pdstemplates.F90.

Data Fields
integer, dimension(maxlen) mappds Number of octets in which to pack each value.
integer mappdslen The number of entries in the template.
logical needext Does template need to be extended?
integer template_num Template number.

Function/Subroutine Documentation

◆ extpdstemplate()

subroutine pdstemplates::extpdstemplate ( integer, intent(in)  number,
integer, dimension(*), intent(in)  list,
integer, intent(out)  nummap,
integer, dimension(*), intent(out)  map 
)

This subroutine generates the remaining octet map for a given Product Definition Template, if required.

Some Templates can vary depending on data values given in an earlier part of the Template, and it is necessary to know some of the earlier entry values to generate the full octet map of the Template.

Parameters
[in]numberthe Product Definition Template number.
[in]listAn array containing the number of octets that match the Product Definition Template.
[out]nummapNumber of entries in the Template.
[out]mapAn array containing the number of octets that each template entry occupies when packed up into the PDS.
Author
Stephen Gilbert
Date
2000-05-11

Definition at line 430 of file pdstemplates.F90.

References getpdsindex(), and templates.

Referenced by addfield(), gf_unpack4(), and unpack4().

◆ getpdsindex()

integer function pdstemplates::getpdsindex ( integer, intent(in)  number)

This function returns the index of specified Product Definition Template in array templates.

Parameters
[in]numberthe Product Definition Template number.
Returns
  • Index of PDT in array templates, if template exists.
  • -1, otherwise.
Author
Stephen Gilbert
Date
2001-06-28

Definition at line 355 of file pdstemplates.F90.

References maxtemp, and templates.

Referenced by extpdstemplate(), getpdstemplate(), and getpdtlen().

◆ getpdstemplate()

subroutine pdstemplates::getpdstemplate ( integer, intent(in)  number,
integer, intent(out)  nummap,
integer, dimension(*), intent(out)  map,
logical, intent(out)  needext,
integer, intent(out)  iret 
)

This subroutine returns PDS template information for a specified Product Definition Template.

The number of entries in the template is returned along with a map of the number of octets occupied by each entry. Also, a flag is returned to indicate whether the template would need to be extended.

Parameters
[in]numberthe Product Definition Template number that is being requested.
[out]nummapNumber of entries in the Template.
[out]mapAn array containing the number of octets that each template entry occupies when packed up into the PDS.
[out]needextLogical variable indicating whether the Product Defintion Template has to be extended.
[out]iretError return code.
  • 0 no error.
  • 1 Undefine Product Template number.
Author
Stephen Gilbert
Date
2000-05-11

Definition at line 390 of file pdstemplates.F90.

References getpdsindex(), and templates.

Referenced by addfield(), gf_unpack4(), and unpack4().

◆ getpdtlen()

integer function pdstemplates::getpdtlen ( integer, intent(in)  number)

This function returns the initial length (number of entries) in the static part of specified Product Definition Template.

Parameters
[in]numberthe Product Definition Template number.
Returns
  • Number of entries in the static part of PDT.
  • 0, if requested template is not found.
Author
Stephen Gilbert
Date
2004-05-11

Definition at line 660 of file pdstemplates.F90.

References getpdsindex(), and templates.

Variable Documentation

◆ maxlen

integer, parameter pdstemplates::maxlen = 200

MAXLEN max length of entries.

Definition at line 41 of file pdstemplates.F90.

◆ maxtemp

integer, parameter pdstemplates::maxtemp = 43

MAXTEMP maximum number of templates.

Definition at line 42 of file pdstemplates.F90.

Referenced by getpdsindex().

◆ templates

type(pdstemplate), dimension(maxtemp) pdstemplates::templates

template in type of pdstemplate

Definition at line 53 of file pdstemplates.F90.

Referenced by extpdstemplate(), getpdsindex(), getpdstemplate(), and getpdtlen().