2020-01-28 14:32:34 +00:00
|
|
|
# (C) Copyright 2005- ECMWF.
|
2019-04-25 12:26:15 +00:00
|
|
|
|
2013-03-25 12:04:10 +00:00
|
|
|
transient timeRangeIndicator=0 : no_copy,hidden;
|
|
|
|
|
|
|
|
position offsetSection4;
|
2014-06-21 21:28:40 +00:00
|
|
|
section_length[4] section4Length ;
|
2013-03-25 12:04:10 +00:00
|
|
|
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 ;
|
|
|
|
|
|
|
|
# Product Definition Template Number
|
|
|
|
|
|
|
|
transient neitherPresent = 0;
|
|
|
|
|
|
|
|
if (centre==7 || centre==46) {
|
|
|
|
alias disableGrib1LocalSection=one;
|
|
|
|
}
|
|
|
|
|
|
|
|
codetable[2] productDefinitionTemplateNumber('4.0.table',masterDir,localDir) : dump;
|
|
|
|
|
|
|
|
if (section2Used == 1) {
|
|
|
|
when (new()) {
|
|
|
|
set_nofail productDefinitionTemplateNumber=productDefinitionTemplateNumberInternal;
|
|
|
|
}
|
|
|
|
}
|
2014-03-25 11:12:01 +00:00
|
|
|
transient genVertHeightCoords = 0;
|
2013-03-25 12:04:10 +00:00
|
|
|
template productDefinition "grib2/template.4.[productDefinitionTemplateNumber:l].def" ;
|
|
|
|
|
|
|
|
if (defined(marsStream) && defined(marsType)) {
|
2015-11-23 13:52:38 +00:00
|
|
|
template_nofail marsKeywords1 "mars/grib.[marsStream:s].[marsType:s].def";
|
2013-03-25 12:04:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
template parameters "grib2/parameters.def";
|
|
|
|
|
|
|
|
# Detect if this is for Generalized vertical height coordinates
|
|
|
|
if (defined(typeOfFirstFixedSurface)) {
|
|
|
|
if (typeOfFirstFixedSurface == 150) {
|
|
|
|
transient genVertHeightCoords = 1;
|
2013-05-08 10:53:09 +00:00
|
|
|
transient PVPresent = 0;
|
2013-03-25 12:04:10 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (genVertHeightCoords) {
|
|
|
|
# Generalized vertical height coordinate case
|
2014-03-25 11:12:01 +00:00
|
|
|
ieeefloat nlev : dump ;
|
|
|
|
ieeefloat numberOfVGridUsed : dump;
|
|
|
|
byte[16] uuidOfVGrid : dump;
|
|
|
|
|
2013-12-05 15:51:59 +00:00
|
|
|
alias numberOfVerticalCoordinateValues = nlev;
|
|
|
|
alias numberOfCoordinatesValues = nlev;
|
|
|
|
alias numberOfVerticalGridDescriptors = nlev;
|
2013-03-25 12:04:10 +00:00
|
|
|
}
|
|
|
|
else {
|
2013-12-05 15:51:59 +00:00
|
|
|
if (NV == 0){
|
2013-03-25 12:04:10 +00:00
|
|
|
transient PVPresent = 0;
|
|
|
|
} else {
|
|
|
|
transient PVPresent = 1;
|
|
|
|
}
|
2014-07-01 13:58:06 +00:00
|
|
|
# See GRIB-547
|
|
|
|
if (PVPresent || NV>0){
|
2013-03-25 12:04:10 +00:00
|
|
|
ieeefloat pv[numberOfCoordinatesValues] : dump;
|
|
|
|
alias vertical.pv=pv;
|
|
|
|
}
|
2014-09-29 16:36:13 +00:00
|
|
|
|
|
|
|
# GRIB-534: To easily remove vertical coordinates, set this key to 1
|
|
|
|
concept_nofail deletePV(unknown) {
|
|
|
|
"1" = { PVPresent=0; NV=0; }
|
|
|
|
}
|
|
|
|
|
2013-03-25 12:04:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
meta md5Section4 md5(offsetSection4,section4Length);
|