1 #ifndef gridtemplates_H
2 #define gridtemplates_H
3 #include "grib2.h"
4 
5 //   PRGMMR: Gilbert         ORG: W/NP11    DATE: 2001-10-26
6 //
7 // ABSTRACT: This Fortran Module contains info on all the available
8 //   GRIB2 Grid Definition Templates used in Section 3 (GDS).
9 //   The information describing each template is stored in the
10 //   gridtemplate structure defined below.
11 //
12 //   Each Template has three parts: The number of entries in the template
13 //   (mapgridlen);  A map of the template (mapgrid), which contains the
14 //   number of octets in which to pack each of the template values; and
15 //   a logical value (needext) that indicates whether the Template needs
16 //   to be extended.  In some cases the number of entries in a template
17 //   can vary depending upon values specified in the "static" part of
18 //   the template.  ( See Template 3.120 as an example )
19 //
20 //   NOTE:  Array mapgrid contains the number of octets in which the
21 //   corresponding template values will be stored.  A negative value in
22 //   mapgrid is used to indicate that the corresponding template entry can
23 //   contain negative values.  This information is used later when packing
24 //   (or unpacking) the template data values.  Negative data values in GRIB
25 //   are stored with the left most bit set to one, and a negative number
26 //   of octets value in mapgrid[] indicates that this possibility should
27 //   be considered.  The number of octets used to store the data value
28 //   in this case would be the absolute value of the negative value in
29 //   mapgrid[].
30 //
31 // PROGRAM HISTORY LOG:
32 //
33 // 2001-10-26  Gilbert
34 // 2007-08-16  Vuong     -  Added GDT 3.204  Curvilinear Orthogonal Grid
35 // 2008-07-08  Vuong     -  Added GDT 3.32768 Rot Lat/Lon E-grid (Arakawa)
36 // 2010-05-11  Vuong     -  Added GDT 3.32769 Rotate Lat/Lon Non-E Staggered grid (Arakawa)
37 // 2013-08-06  Vuong     -  Added GDT 3.4,3.5,3.12,3.101,3.140
38 //
39 ////////////////////////////////////////////////////////////////////
40 
41       #define MAXGRIDTEMP 31              // maximum number of templates
42       #define MAXGRIDMAPLEN 200           // maximum template map length
43 
44       struct gridtemplate
45       {
46           g2int template_num;
47           g2int mapgridlen;
48           g2int needext;
49           g2int mapgrid[MAXGRIDMAPLEN];
50       };
51 
52 const struct gridtemplate *get_templatesgrid(void);
53 g2int getgridindex(g2int number);
54 
55 #endif  /*  gridtemplates_H  */
56