1# (C) Copyright 2005- ECMWF.
2# Wave 2D spectra direction and frequency
3
4template mars_labeling "grib1/mars_labeling.def";
5
6unsigned[1] perturbationNumber  : dump;
7alias number = perturbationNumber;
8
9unsigned[1] numberOfForecastsInEnsemble : dump ;
10alias totalNumber=numberOfForecastsInEnsemble;
11
12unsigned[1] directionNumber : dump ;
13alias mars.direction = directionNumber;
14
15unsigned[1] frequencyNumber : dump ;
16alias mars.frequency = frequencyNumber;
17
18unsigned[1] numberOfDirections : dump ;
19alias totalNumberOfDirections = numberOfDirections ;
20
21unsigned[1] numberOfFrequencies  : dump;
22alias totalNumberOfFrequencies = numberOfFrequencies ;
23
24unsigned[4] directionScalingFactor  : dump;
25alias integerScalingFactorAppliedToDirections = directionScalingFactor;
26
27unsigned[4] frequencyScalingFactor  : dump;
28alias integerScalingFactorAppliedToFrequencies =  frequencyScalingFactor ;
29
30constant localFlagLatestVersion = 4 : hidden;
31codetable[1] localFlag "grib1/local.13.table" = localFlagLatestVersion;
32
33#!
34#!  Old versions of wave 2D spectra direction and frequency do not
35#!  have the systemNumber and methodNumber, and the flag is set to 0.
36#!
37#if0                             -       IF_EQ   0       flag
38#spareSetToZero                  65      PAD     n/a     36
39#endif0                          -       ENDIF   if0
40if(localFlag == 0)
41{
42  pad padding_loc13_1(36);
43}
44
45#!
46#!  Old versions of wave 2D spectra direction and frequency do not
47#!  have the systemNumber and methodNumber, and the flag is set to 0.
48#!
49#!
50#!
51#if1                             -       IF_EQ   1       flag
52#systemNumber                    065     I2      -       -
53#methodNumber                    067     I2      -       -
54#spareSetToZero1                 069     PAD     n/a     32
55#endif1                          -       ENDIF   if1
56if(localFlag == 1)
57{
58  unsigned[2] systemNumber  : dump;
59  unsigned[2] methodNumber  : dump;
60  alias system = systemNumber;
61  alias method = methodNumber;
62  pad padding_loc13_2(32);
63}
64
65#if2             -   IF_EQ   2   flag
66#systemNumber            065 I2  -   -
67#methodNumber            067 I2  -   -
68#referenceDate           069 I4  -   -
69#climateDateFrom         073 I4  -   -
70#climateDateTo           077 I4  -   -
71#spareSetToZero2         081 PAD n/a 20
72#endif2              -   ENDIF   if2
73if(localFlag == 2)
74{
75  unsigned[2] systemNumber  : dump;
76  unsigned[2] methodNumber  : dump;
77  unsigned[4] referenceDate : dump ;
78  unsigned[4] climateDateFrom : dump ;
79  unsigned[4] climateDateTo : dump ;
80  alias system = systemNumber;
81  alias method = methodNumber;
82  alias refdate = referenceDate;
83  pad padding_loc13_3(20);
84}
85
86#if3             -   IF_EQ   3   flag
87#systemNumber            065 I2  -   -
88#methodNumber            067 I2  -   -
89#referenceDate           069 I4  -   -
90#climateDateFrom         073 I4  -   -
91#climateDateTo           077 I4  -   -
92#legBaseDate             081 I4  -   -
93#legBaseTime             085 I2  -   -
94#legNumber               087 I1  -   -
95#oceanAtmosphereCoupling 088 I1  -   -
96#spareSetToZero3         089 PAD n/a 12
97#endif3          -   ENDIF   if3
98if(localFlag == 3)
99{
100  unsigned[2] systemNumber = 65535 : dump,can_be_missing ;
101  unsigned[2] methodNumber = 65535 : dump,can_be_missing ;
102  unsigned[4] referenceDate : dump ;
103  unsigned[4] climateDateFrom : dump ;
104  unsigned[4] climateDateTo : dump ;
105  unsigned[4] legBaseDate : dump;
106  alias baseDateOfThisLeg = legBaseDate;
107  unsigned[2] legBaseTime : dump;
108  alias baseTimeOfThisLeg = legBaseTime;
109  unsigned[1] legNumber : dump;
110  unsigned[1] oceanAtmosphereCoupling : dump;
111  pad padding_loc13_4(12);
112  alias system = systemNumber;
113  alias method = methodNumber;
114  alias refdate = referenceDate;
115
116  alias mars._leg_number = legNumber;
117}
118
119#if4             -   IF_EQ   4   flag
120#systemNumber             065 I2  -   -
121#methodNumber             067 I2  -   -
122#referenceDate            069 I4  -   -
123#climateDateFrom          073 I4  -   -
124#climateDateTo            077 I4  -   -
125#legBaseDate              081 I4  -   -
126#legBaseTime              085 I2  -   -
127#legNumber                087 I1  -   -
128#oceanAtmosphereCoupling  088 I1  -   -
129#offsetToEndOf4DvarWindow 089 I2  -   -
130#lengthOf4DvarWindow      091 I2  -   -
131#spareSetToZero3          093 PAD n/a 8
132#endif4          -   ENDIF   if4
133if(localFlag == 4)
134{
135   unsigned[2] systemNumber = 65535 : dump,can_be_missing ;
136   unsigned[2] methodNumber = 65535 : dump,can_be_missing ;
137   unsigned[4] referenceDate : dump ;
138   unsigned[4] climateDateFrom : dump ;
139   unsigned[4] climateDateTo : dump ;
140   unsigned[4] legBaseDate : dump;
141   alias baseDateOfThisLeg = legBaseDate;
142   unsigned[2] legBaseTime : dump;
143   alias baseTimeOfThisLeg = legBaseTime;
144   unsigned[1] legNumber : dump;
145   unsigned[1] oceanAtmosphereCoupling : dump;
146
147   # Hours
148   unsigned[2] offsetToEndOf4DvarWindow : dump;
149   alias anoffset=offsetToEndOf4DvarWindow;
150   unsigned[2] lengthOf4DvarWindow : dump;
151
152   alias system = systemNumber;
153   alias method = methodNumber;
154   alias refdate = referenceDate;
155
156   alias mars._leg_number = legNumber;
157
158   pad padding_loc13_5(8);
159}
160
161unsigned[4] scaledDirections[numberOfDirections] : dump;
162unsigned[4] scaledFrequencies[numberOfFrequencies] : dump;
163
164constant GRIBEXSection1Problem = 100 + 4 * numberOfDirections + 4 * numberOfFrequencies - section1Length ;
165