eccodes/definitions/grib2/template.4.horizontal.def

99 lines
3.7 KiB
Modula-2
Raw Permalink Normal View History

2020-01-28 14:32:34 +00:00
# (C) Copyright 2005- ECMWF.
2013-03-25 12:04:10 +00:00
2023-08-16 14:03:40 +00:00
# Type of first fixed surface
codetable[1] typeOfFirstFixedSurface ('4.5.table',masterDir,localDir) : dump,edition_specific,string_type;
2013-03-25 12:04:10 +00:00
meta unitsOfFirstFixedSurface codetable_units(typeOfFirstFixedSurface) : dump;
meta nameOfFirstFixedSurface codetable_title(typeOfFirstFixedSurface) : dump;
2023-08-16 14:03:40 +00:00
# Scale factor of first fixed surface
signed[1] scaleFactorOfFirstFixedSurface = missing() : can_be_missing,dump,edition_specific;
2013-03-25 12:04:10 +00:00
2023-08-16 14:03:40 +00:00
# Scaled value of first fixed surface
unsigned[4] scaledValueOfFirstFixedSurface = missing() : can_be_missing,dump,edition_specific;
2013-03-25 12:04:10 +00:00
2023-08-16 14:03:40 +00:00
# Type of second fixed surface
codetable[1] typeOfSecondFixedSurface ('4.5.table',masterDir,localDir) = 255 : dump,edition_specific;
meta unitsOfSecondFixedSurface codetable_units(typeOfSecondFixedSurface) : dump;
meta nameOfSecondFixedSurface codetable_title(typeOfSecondFixedSurface) : dump;
2013-03-25 12:04:10 +00:00
2023-08-16 14:03:40 +00:00
# Scale factor of second fixed surface
signed[1] scaleFactorOfSecondFixedSurface = missing() : can_be_missing,dump,edition_specific;
2013-03-25 12:04:10 +00:00
2023-08-16 14:03:40 +00:00
# Scaled value of second fixed surface
unsigned[4] scaledValueOfSecondFixedSurface = missing() : can_be_missing,dump,edition_specific;
2013-03-25 12:04:10 +00:00
transient pressureUnits="hPa";
concept vertical.typeOfLevel (unknown,"typeOfLevelConcept.def",conceptsDir2,conceptsDir1);
2013-03-25 12:04:10 +00:00
alias levelType=typeOfFirstFixedSurface;
if (typeOfSecondFixedSurface == 255) {
# Only one surface
2013-03-25 12:04:10 +00:00
meta level g2level(typeOfFirstFixedSurface,
scaleFactorOfFirstFixedSurface,
scaledValueOfFirstFixedSurface,
pressureUnits) :dump;
transient bottomLevel=level; # Do not use alias (see GRIB-725)
transient topLevel=level;
2013-03-25 12:04:10 +00:00
} else {
# Two surfaces
2013-03-25 12:04:10 +00:00
meta topLevel g2level(typeOfFirstFixedSurface,
scaleFactorOfFirstFixedSurface,
scaledValueOfFirstFixedSurface,
pressureUnits) :dump;
meta bottomLevel g2level(typeOfSecondFixedSurface,
scaleFactorOfSecondFixedSurface,
scaledValueOfSecondFixedSurface,
pressureUnits) :dump;
alias level=topLevel; # (see GRIB-725)
2022-02-22 17:27:41 +00:00
2013-03-25 12:04:10 +00:00
}
alias ls.level=level;
alias vertical.level=level;
alias vertical.bottomLevel=bottomLevel;
alias vertical.topLevel=topLevel;
alias extraDim=false;
2013-03-25 12:04:10 +00:00
if (defined(extraDimensionPresent)) {
2013-07-23 17:06:45 +00:00
if (extraDimensionPresent) {
alias extraDim=true;
2013-07-23 17:06:45 +00:00
}
2013-03-25 12:04:10 +00:00
}
if (extraDim) {
2013-07-23 17:06:45 +00:00
alias mars.levelist = dimension;
alias mars.levtype = dimensionType;
2013-03-25 12:04:10 +00:00
} else {
2014-07-16 13:47:24 +00:00
# See GRIB-74 why we store the pressureUnits in a transient
transient tempPressureUnits=pressureUnits;
# Same as typeOfLevel != "surface" but much quicker to evaluate
# than via the concept
if ( ! (typeOfFirstFixedSurface == 1 && typeOfSecondFixedSurface == 255) ) {
2014-07-16 13:47:24 +00:00
if (tempPressureUnits is "Pa") {
2013-07-23 17:06:45 +00:00
meta marsLevel scale(level,one,hundred) : read_only;
alias mars.levelist=marsLevel;
} else {
alias mars.levelist = level;
}
}
2022-01-27 19:04:41 +00:00
# ECC-1333: levtype should be read-only in GRIB2
concept mars.levtype(unknown,"marsLevtypeConcept.def",conceptsDir2,conceptsDir1):no_copy, read_only;
2013-07-23 17:06:45 +00:00
# GRIB-372: levelist alias does not pertain to surface parameters
transient tempLevtype = levtype; # Faster to copy the concept so we evaluate it once
if (tempLevtype is "sfc" || tempLevtype is "o2d") {
2013-07-23 17:06:45 +00:00
unalias mars.levelist;
}
2013-03-25 12:04:10 +00:00
}
# See ECC-854, ECC-1435, ECC-1451, ECC-1462
if( (typeOfFirstFixedSurface == 151 && typeOfSecondFixedSurface == 151) ||
(typeOfFirstFixedSurface == 152 && typeOfSecondFixedSurface == 152) ||
(typeOfFirstFixedSurface == 168 && typeOfSecondFixedSurface == 168) ||
(typeOfFirstFixedSurface == 114 && typeOfSecondFixedSurface == 114) ) {
alias mars.levelist = bottomLevel;
alias ls.level = bottomLevel;
alias vertical.level = bottomLevel;
}
2013-03-25 12:04:10 +00:00
alias ls.typeOfLevel=typeOfLevel;