NCEPLIBS-g2  3.4.5
gridtemplates Module Reference

This Fortran Module contains info on all the available GRIB2 Grid Definition Templates used in Section 3 (GDS). More...

Data Types

type  gridtemplate
 

Functions/Subroutines

subroutine extgridtemplate (number, list, nummap, map)
 This subroutine generates the remaining octet map for a given Grid Definition Template, if required. More...
 
integer function getgdtlen (number)
 This function returns the initial length (number of entries) in the "static" part of specified Grid Definition Template 3.number. More...
 
integer function getgridindex (number)
 This function returns the index of specified Grid Definition Template 3.NN in array templates. More...
 
subroutine getgridtemplate (number, nummap, map, needext, iret)
 This subroutine grid template information for a specified Grid Definition Template 3.NN. More...
 

Variables

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

Detailed Description

This Fortran Module contains info on all the available GRIB2 Grid Definition Templates used in Section 3 (GDS).

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 3.120 as an example) This module also contains two subroutines. Subroutine getgridtemplate returns the octet map for a specified Template number, and subroutine extgridtemplate 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.

PROGRAM HISTORY LOG:

  • 2000-05-09 Stephen Gilbert Initial development
  • 2003-09-02 Stephen Gilbert Added GDT 3.31 Albers Equal Area
  • 2007-04-24 Boi Vuong Added GDT 3.204 Curilinear Orthogonal Grids
  • 2008-05-29 Boi Vuong Added GDT 3.32768 Rotate Lat/Lon E-grid
  • 2010-05-10 Boi Vuong Added GDT 3.32769 Rotate Lat/Lon Non E-Stagger grid
  • 2013-08-06 Boi Vuong Added GDT 3.4,3.5,3.12,3.101,3.140
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/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-09

Data Type Documentation

◆ gridtemplates::gridtemplate

type gridtemplates::gridtemplate

Definition at line 50 of file gridtemplates.f.

Data Fields
integer, dimension(maxlen) mapgrid
integer mapgridlen
logical needext
integer template_num

Function/Subroutine Documentation

◆ extgridtemplate()

subroutine gridtemplates::extgridtemplate ( 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 Grid 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.

PROGRAM HISTORY LOG:

  • 2000-05-09 Stephen Gilbert
  • 2013-07-30 Boi Vuong Added GDT 3.4,3.5,3.12,3.101,3.140
Parameters
[in]numberNN, indicating the number of the Grid Definition Template 3.NN that is being requested.
[in]listThe list of values for each entry in the Grid 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 GDS.
Author
Stephen Gilbert
Date
2000-05-09

Definition at line 341 of file gridtemplates.f.

◆ getgdtlen()

integer function gridtemplates::getgdtlen ( integer, intent(in)  number)

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

Parameters
[in]numberNN, indicating the number of the Grid Definition Template 3.NN that is being requested.
Returns
Number of entries in the "static" part of GDT 3.number. Or 0, if requested template is not found.
Author
Stephen Gilbert
Date
2004-05-11

Definition at line 408 of file gridtemplates.f.

◆ getgridindex()

integer function gridtemplates::getgridindex ( integer, intent(in)  number)

This function returns the index of specified Grid Definition Template 3.NN in array templates.

Parameters
[in]numberNN, indicating the number of the Grid Definition Template 3.NN that is being requested.
Returns
Index of GDT 3.NN in array templates, if template exists. -1, otherwise.
Author
Stephen Gilbert
Date
2001-06-28

Definition at line 262 of file gridtemplates.f.

◆ getgridtemplate()

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

This subroutine grid template information for a specified Grid Definition Template 3.NN.

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 Grid Definition Template 3.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 GDS.
[out]needextLogical variable indicating whether the Grid Defintion Template has to be extended.
[out]iretError return code.
  • 0 no error.
  • 1 Undefine Grid Template number.
Author
Stephen Gilbert
Date
2000-05-09

Definition at line 296 of file gridtemplates.f.

Variable Documentation

◆ maxlen

integer, parameter gridtemplates::maxlen =200

maximum number of octets in mapgrid

Definition at line 47 of file gridtemplates.f.

◆ maxtemp

integer, parameter gridtemplates::maxtemp =31

maximum number of entries in the template

Definition at line 48 of file gridtemplates.f.

◆ templates

type(gridtemplate), dimension(maxtemp) gridtemplates::templates

a gridtemplate type

Definition at line 57 of file gridtemplates.f.