NCEPLIBS-g2  3.4.5
drstemplates Module Reference

This Fortran Module contains info on all the available GRIB2 Data Representation Templates used in Section 5 (DRS). More...

Data Types

type  drstemplate
 

Functions/Subroutines

subroutine extdrstemplate (number, list, nummap, map)
 This subroutine generates the remaining octet map for a given Data Representation Template, if required. More...
 
integer function getdrsindex (number)
 This function returns the index of specified Data Representation Template 5.NN (NN=number) in array templates. More...
 
subroutine getdrstemplate (number, nummap, map, needext, iret)
 This subroutine returns DRS template information for a . More...
 

Variables

integer, parameter maxlen =200
 maximum number of octets in mapgrid More...
 
integer, parameter maxtemp =9
 maximum number of entries in the template More...
 
type(drstemplate), dimension(maxtemptemplates
 template in type of drstemplate More...
 

Detailed Description

This Fortran Module contains info on all the available GRIB2 Data Representation Templates used in Section 5 (DRS).

Each Template has three parts: The number of entries in the template (mapgridlen); A map of the template (mapgrid), which contains the number of octets in which to pack each of the template values; and 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. ( See Template 5.1 as an example )

This module also contains two subroutines. Subroutine getdrstemplate returns the octet map for a specified Template number, and subroutine extdrstemplate will calculate the extended octet map of an appropriate template given values for the "static" part of the template. See docblocks below for the arguments and usage of these routines.

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
2001-04-03

Data Type Documentation

◆ drstemplates::drstemplate

type drstemplates::drstemplate

Definition at line 43 of file drstemplates.f.

Data Fields
integer, dimension(maxlen) mapdrs
integer mapdrslen
logical needext
integer template_num

Function/Subroutine Documentation

◆ extdrstemplate()

subroutine drstemplates::extdrstemplate ( 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 Data Representation Template, if required.

Author
Stephen Gilbert
Date
2000-05-11 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]numberNN, indicating the number of the Data Representation Template 5.NN that is being requested.
[in]listThe list of values for each entry in the Data Representation Template 5.NN.
[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 GDS.
Author
Stephen Gilbert
Date
2000-05-11

Definition at line 207 of file drstemplates.f.

◆ getdrsindex()

integer function drstemplates::getdrsindex ( integer, intent(in)  number)

This function returns the index of specified Data Representation Template 5.NN (NN=number) in array templates.

Author
Stephen Gilbert
Date
2001-06-28
Parameters
[in]numberNN, indicating the number of the Data Representation Template 5.NN that is being requested.
Returns
Index of DRT 5.NN in array templates, if template exists. = -1, otherwise.
Author
Stephen Gilbert
Date
2001-06-28

Definition at line 129 of file drstemplates.f.

◆ getdrstemplate()

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

This subroutine returns DRS template information for a .

specified Data Representation Template 5.NN.

Author
Stephen Gilbert
Date
2000-05-11 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]numberNN, indicating the number of the Data Representation Template 5.NN 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 DRS.
[out]needextLogical variable indicating whether the Data Representation Template has to be extended.
[out]iretError return code.
  • 0 = no error
  • 1 = Undefined Data Representation Template number.
Author
Stephen Gilbert
Date
2000-05-11

Definition at line 165 of file drstemplates.f.

Variable Documentation

◆ maxlen

integer, parameter drstemplates::maxlen =200

maximum number of octets in mapgrid

Definition at line 39 of file drstemplates.f.

◆ maxtemp

integer, parameter drstemplates::maxtemp =9

maximum number of entries in the template

Definition at line 40 of file drstemplates.f.

◆ templates

type(drstemplate), dimension(maxtemp) drstemplates::templates

template in type of drstemplate

Simple Packing Complex Packing Complex Packing - Spatial Diff Simple Packing - Spectral Data Complex Packing - Spectral Data JPEG2000 Encoding PNG Encoding JPEG2000 Encoding PNG Encoding

Definition at line 50 of file drstemplates.f.