File: section.4.def

package info (click to toggle)
eccodes 2.46.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 154,956 kB
  • sloc: cpp: 163,970; ansic: 26,310; sh: 22,006; f90: 6,854; perl: 6,361; python: 5,352; java: 2,226; javascript: 1,427; yacc: 854; fortran: 543; lex: 359; makefile: 279; xml: 183; awk: 66
file content (180 lines) | stat: -rw-r--r-- 7,003 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
# (C) Copyright 2005- ECMWF.

transient timeRangeIndicator=0 : no_copy,hidden;
transient is_localtime=0 : no_copy,hidden;

position offsetSection4;
section_length[4] section4Length ;
meta section4Pointer section_pointer(offsetSection4,section4Length,4);

unsigned[1] numberOfSection = 4:read_only;

unsigned[2] NV : dump ;
alias numberOfVerticalCoordinateValues=NV ;
alias numberOfCoordinatesValues=NV;
# For table 4.5, code 150 Generalized vertical height coordinate
alias numberOfVerticalGridDescriptors=NV ;

transient neitherPresent = 0;

# if (centre==7 || centre==46) {
#    alias disableGrib1LocalSection=true;
# }

concept datasetForLocal(unknown) {
  "tigge"        = {productionStatusOfProcessedData=4;}
  "tigge"        = {productionStatusOfProcessedData=5;}
  "s2s"          = {productionStatusOfProcessedData=6;}
  "s2s"          = {productionStatusOfProcessedData=7;}
  "cerise"       = {marsClass=50;}
  "era6"        = {marsClass=40;} # for ERA6 parameters with constituentType
  "hydro_legacy" = {marsClass=35;} # EFAS/GLOFAS
  "hydro_legacy" = {marsClass=38;} # ULYSSES
  "hydro"        = {marsClass=42;} # EFAS
  "hydro"        = {marsClass=43;} # GLOFAS
  "hydro"        = {marsClass=48;} # C3S European hydrology
  "hydro"        = {marsClass=49;} # C3S Global hydrology
  "fire"         = {marsClass=39;} # Global Wildfire awareness system
  "uerra"        = {productionStatusOfProcessedData=8;} # UERRA
  "uerra"        = {productionStatusOfProcessedData=9;}
  "uerra"        = {productionStatusOfProcessedData=10;} # CARRA/CERRA
  "uerra"        = {productionStatusOfProcessedData=11;}
  "destine"      = {productionStatusOfProcessedData=12;} # Destination Earth
  "destine"      = {productionStatusOfProcessedData=13;}
  "destinegen1"  = {productionStatusOfProcessedData=12;generation=1;} # DestinE ClimateDT Generation 1
  "destinegen1"  = {productionStatusOfProcessedData=13;generation=1;}
  "era"          = {marsClass=22;}
  "era"          = {marsClass=5;}
  "era"          = {marsClass=23;}
  "era"          = {marsClass=14;}
  "era"          = {marsClass=21;}
  "era"          = {marsClass=24;}
  "era"          = {marsClass=3;}
  "era"          = {marsClass=30;}
  "era"          = {marsClass=33;}
  "nextgems"     = {marsClass=53;}
  "unknown"      = { dummy=1; }
}

# MTG2Switch logic defined here
# 0 = pre-MTG2 encoding used
# 1 = post-MTG2 encoding used
# 2 = post-MTG2 encoding with paramId + chemId used

# By default centres will use post MTG2 parameter concepts (= 1) to retain the status quo.
# The default can then be modified based on the below tablesVersion, according to the
# conditions defined in the MTG2SwitchViaTablesVersion concept at the top level or in the
# concept at the centre/pseudocentre level

concept MTG2SwitchViaTablesVersion(false, "MTG2SwitchViaTablesVersionConcept.def", conceptsDir2, conceptsDir1): hidden, read_only;

# Then the logic for the MTG2 switch default value in these cases is
# applied in the below function - cf. the mtg2_switch_default accessor
# This is as follows:
#     tablesVersion <= tablesVersionMTG2Switch, then MTG2SwitchDefault=0., i.e. we are pre-MTG2
#     tablesVersion > tablesVersionMTG2Switch, and class=mc/cr  then MTG2SwitchDefault=2., i.e. we are post-MTG2 with param-chem split.
#     tablesVersion > tablesVersionMTG2Switch  in all other cases then MTG2SwitchDefault=1., i.e. we are post-MTG2.

meta MTG2SwitchDefault mtg2_switch_default(tablesVersion, tablesVersionMTG2Switch, marsClass, MTG2SwitchViaTablesVersion) : hidden, read_only;

# This sets the default for the MTG2Switch concept which we then define below
# Default=1 unless changed by the above concept, or by adding an entry to the concept below in a given centre/pseudocentre.

concept MTG2Switch(MTG2SwitchDefault, "MTG2SwitchConcept.def", conceptsDir2,conceptsDir1): hidden, read_only, long_type;

# ECC-2002
# if datasetForLocal is not "unknown", we remap conceptsDir1 and conceptsDir2
# See the g2_concept_dir accessor

codetable[2] productDefinitionTemplateNumber('4.0.table',masterDir,localDir) : dump;

if (section2Used == 1) {
   when (new()) {
      set_nofail productDefinitionTemplateNumber=productDefinitionTemplateNumberInternal;
   }
}
transient genVertHeightCoords = 0;

if (productDefinitionTemplateNumber >= 32768) {
   template productDefinition "grib2/local/[centreForLocal]/template.4.[productDefinitionTemplateNumber:l].def";
} else {
   template productDefinition "grib2/templates/template.4.[productDefinitionTemplateNumber:l].def";
}

if ( setLocalDefinition || (defined(marsStream) && defined(marsType)) ) {
   template_nofail marsKeywords1 "mars/grib.[marsStream:s].[marsType:s].def";
}

concept productDefinitionTemplateName(unknown, "productDefinitionTemplateConcept.def", conceptsDir2,conceptsDir1): no_copy;

template parameters "grib2/parameters.def";

# Hook for local extras
# pseudo-centres are defined via datasetForLocal, see concept defined in this file
# while centres are using the standard centre keys
# if not distinguished, for pseudo-centres it will load the centre specific section4_extras.def instead
if ( defined(datasetForLocal) && datasetForLocal isnot "unknown" ) {
 template_nofail extras "grib2/local/[datasetForLocal]/section4_extras.def";
} else {
 template_nofail extras "grib2/local/[centre]/section4_extras.def";
}

# Detect if this is for Generalized Vertical Height Coordinates
if (defined(typeOfFirstFixedSurface)) {
   if (typeOfFirstFixedSurface == 150) {
      transient genVertHeightCoords = 1;
      transient PVPresent = 0;
   }
}

if (genVertHeightCoords) {
   # Generalized vertical height coordinate case
   ieeefloat nlev : dump ;
   ieeefloat numberOfVGridUsed : dump;
   byte[16] uuidOfVGrid : dump;

   alias numberOfVerticalCoordinateValues = nlev;
   alias numberOfCoordinatesValues = nlev;
   alias numberOfVerticalGridDescriptors = nlev;
}
else {
   if (NV == 0){
      transient PVPresent = 0;
   } else {
      transient PVPresent = 1;
   }
   # See GRIB-547
   if (PVPresent || NV>0){
      ieeefloat pv[numberOfCoordinatesValues] : dump;
      alias vertical.pv=pv;
   }

   # GRIB-534: To easily remove vertical coordinates, set this key to 1
   concept_nofail deletePV(unknown) {
      "1" = { PVPresent=0; NV=0; }
   }
}

if (MTG2Switch > 0) {
   concept paramtype(unknown, "paramtypeConcept.def", conceptsDir2, conceptsDir1): hidden, read_only;

   if (defined(stream) && is_one_of(stream,"sttd","stte")){
    concept statType (unknown,"stattypeConcept.def",conceptsDir2,conceptsDir1) : read_only;
    alias mars.stattype = statType;
   }

   concept timeSpan (unknown,"timespanConcept.def",conceptsDir2,conceptsDir1) : read_only;

   # we use an abbreviation for fromstart -> fs
   if (timeSpan is "fromstart") {
      constant timeSpanfs = "fs" ;
      alias mars.timespan = timeSpanfs;
   }
   else {
      if (timeSpan isnot "unknown") {
         alias mars.timespan = timeSpan;
      }
   }
}

meta md5Section4 md5(offsetSection4,section4Length);