1# Copyright 2005-2018 ECMWF.
2#
3# This software is licensed under the terms of the Apache Licence Version 2.0
4# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
5#
6# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
7# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
8#
9
10# START 1/local.98.13 ----------------------------------------------------------------------
11# LOCAL 98 13
12#
13# localDefinitionTemplate_013
14# ---------------------------
15#
16# Description            Octet    Code    Ksec1    Count
17# -----------            -----    ----    -----    -----
18#localDefinitionNumber           41      I1      37      -
19#class                           42      I1      38      -
20#type                            43      I1      39      -
21#stream                          44      I2      40      -
22#experimentVersionNumber         46      A4      41      -
23#number                          50      I1      42      -
24#total                           51      I1      43      -
25#directionNumber                 52      I1      44      -
26#frequencyNumber                 53      I1      45      -
27#numberOfDirections              54      I1      46      -
28#numberOfFrequencies             55      I1      47      -
29#directionScalingFactor          56      I4      48      -
30#frequencyScalingFactor          60      I4      49      -
31#flag                            64      F1      -       3
32#scaledDirections                101     LP_I4   50      numberOfDirections
33#scaledFrequencies               -       LP_I4   -       numberOfFrequencies
34#
35
36template mars_labeling "grib1/mars_labeling.def";
37
38unsigned[1] perturbationNumber  : dump;
39alias number = perturbationNumber;
40
41unsigned[1] numberOfForecastsInEnsemble : dump ;
42alias totalNumber=numberOfForecastsInEnsemble;
43
44unsigned[1] directionNumber : dump ;
45alias mars.direction = directionNumber;
46
47unsigned[1] frequencyNumber : dump ;
48alias mars.frequency = frequencyNumber;
49
50unsigned[1] numberOfDirections : dump ;
51alias totalNumberOfDirections = numberOfDirections ;
52
53unsigned[1] numberOfFrequencies  : dump;
54alias totalNumberOfFrequencies = numberOfFrequencies ;
55
56unsigned[4] directionScalingFactor  : dump;
57alias integerScalingFactorAppliedToDirections = directionScalingFactor;
58
59unsigned[4] frequencyScalingFactor  : dump;
60alias integerScalingFactorAppliedToFrequencies =  frequencyScalingFactor ;
61
62constant localFlagLatestVersion = 4 : hidden;
63codetable[1] localFlag "grib1/local.13.table" = localFlagLatestVersion;
64
65#!
66#!  Old versions of wave 2D spectra direction and frequency do not
67#!  have the systemNumber and methodNumber, and the flag is set to 0.
68#!
69#if0                             -       IF_EQ   0       flag
70#spareSetToZero                  65      PAD     n/a     36
71#endif0                          -       ENDIF   if0
72if(localFlag == 0)
73{
74  pad padding_loc13_1(36);
75}
76
77#!
78#!  Old versions of wave 2D spectra direction and frequency do not
79#!  have the systemNumber and methodNumber, and the flag is set to 0.
80#!
81#!
82#!
83#if1                             -       IF_EQ   1       flag
84#systemNumber                    065     I2      -       -
85#methodNumber                    067     I2      -       -
86#spareSetToZero1                 069     PAD     n/a     32
87#endif1                          -       ENDIF   if1
88if(localFlag == 1)
89{
90  unsigned[2] systemNumber  : dump;
91  unsigned[2] methodNumber  : dump;
92  alias system = systemNumber;
93  alias method = methodNumber;
94  pad padding_loc13_2(32);
95}
96
97#if2             -   IF_EQ   2   flag
98#systemNumber            065 I2  -   -
99#methodNumber            067 I2  -   -
100#referenceDate           069 I4  -   -
101#climateDateFrom         073 I4  -   -
102#climateDateTo           077 I4  -   -
103#spareSetToZero2         081 PAD n/a 20
104#endif2              -   ENDIF   if2
105if(localFlag == 2)
106{
107  unsigned[2] systemNumber  : dump;
108  unsigned[2] methodNumber  : dump;
109  unsigned[4] referenceDate : dump ;
110  unsigned[4] climateDateFrom : dump ;
111  unsigned[4] climateDateTo : dump ;
112  alias system = systemNumber;
113  alias method = methodNumber;
114  alias refdate = referenceDate;
115  pad padding_loc13_3(20);
116}
117
118#if3             -   IF_EQ   3   flag
119#systemNumber            065 I2  -   -
120#methodNumber            067 I2  -   -
121#referenceDate           069 I4  -   -
122#climateDateFrom         073 I4  -   -
123#climateDateTo           077 I4  -   -
124#legBaseDate             081 I4  -   -
125#legBaseTime             085 I2  -   -
126#legNumber               087 I1  -   -
127#oceanAtmosphereCoupling 088 I1  -   -
128#spareSetToZero3         089 PAD n/a 12
129#endif3          -   ENDIF   if3
130if(localFlag == 3)
131{
132  unsigned[2] systemNumber = 65535 : dump,can_be_missing ;
133  unsigned[2] methodNumber = 65535 : dump,can_be_missing ;
134  unsigned[4] referenceDate : dump ;
135  unsigned[4] climateDateFrom : dump ;
136  unsigned[4] climateDateTo : dump ;
137  unsigned[4] legBaseDate : dump;
138  alias baseDateOfThisLeg = legBaseDate;
139  unsigned[2] legBaseTime : dump;
140  alias baseTimeOfThisLeg = legBaseTime;
141  unsigned[1] legNumber : dump;
142  unsigned[1] oceanAtmosphereCoupling : dump;
143  pad padding_loc13_4(12);
144  alias system = systemNumber;
145  alias method = methodNumber;
146  alias refdate = referenceDate;
147
148  alias mars._leg_number = legNumber;
149}
150
151#if4             -   IF_EQ   4   flag
152#systemNumber             065 I2  -   -
153#methodNumber             067 I2  -   -
154#referenceDate            069 I4  -   -
155#climateDateFrom          073 I4  -   -
156#climateDateTo            077 I4  -   -
157#legBaseDate              081 I4  -   -
158#legBaseTime              085 I2  -   -
159#legNumber                087 I1  -   -
160#oceanAtmosphereCoupling  088 I1  -   -
161#offsetToEndOf4DvarWindow 089 I2  -   -
162#lengthOf4DvarWindow      091 I2  -   -
163#spareSetToZero3          093 PAD n/a 8
164#endif4          -   ENDIF   if4
165if(localFlag == 4)
166{
167   unsigned[2] systemNumber = 65535 : dump,can_be_missing ;
168   unsigned[2] methodNumber = 65535 : dump,can_be_missing ;
169   unsigned[4] referenceDate : dump ;
170   unsigned[4] climateDateFrom : dump ;
171   unsigned[4] climateDateTo : dump ;
172   unsigned[4] legBaseDate : dump;
173   alias baseDateOfThisLeg = legBaseDate;
174   unsigned[2] legBaseTime : dump;
175   alias baseTimeOfThisLeg = legBaseTime;
176   unsigned[1] legNumber : dump;
177   unsigned[1] oceanAtmosphereCoupling : dump;
178
179   # Hours
180   unsigned[2] offsetToEndOf4DvarWindow : dump;
181   alias anoffset=offsetToEndOf4DvarWindow;
182   unsigned[2] lengthOf4DvarWindow : dump;
183
184   alias system = systemNumber;
185   alias method = methodNumber;
186   alias refdate = referenceDate;
187
188   alias mars._leg_number = legNumber;
189
190   pad padding_loc13_5(8);
191}
192
193 unsigned[4] scaledDirections[numberOfDirections] : dump;
194 unsigned[4] scaledFrequencies[numberOfFrequencies] : dump;
195
196constant GRIBEXSection1Problem = 100 + 4 * numberOfDirections + 4 * numberOfFrequencies - section1Length ;
197
198# END   1/local.98.13 ----------------------------------------------------------------------
199