コード例 #1
0
def load(h):

    h.add(_.Codetable('parameterCategory', 1, "4.1.[discipline:l].table", _.Get('masterDir'), _.Get('localDir')))
    h.add(_.Codetable('parameterNumber', 1, "4.2.[discipline:l].[parameterCategory:l].table", _.Get('masterDir'), _.Get('localDir')))
    h.add(_.Codetable_units('parameterUnits', _.Get('parameterNumber')))
    h.add(_.Codetable_title('parameterName', _.Get('parameterNumber')))
    h.add(_.Unsigned('partitionTable', 1))
    h.add(_.Unsigned('numberOfPartitions', 1))

    with h.list('partitions'):
        for i in range(0, h.get_l('numberOfPartitions')):
            h.add(_.Unsigned('partitionItems', 2))
    h.add(_.Codetable('partitionNumber', 2, "4.[partitionTable].table", _.Get('masterDir'), _.Get('localDir')))
    h.add(_.Codetable('typeOfGeneratingProcess', 1, "4.3.table", _.Get('masterDir'), _.Get('localDir')))
    h.add(_.Unsigned('backgroundProcess', 1))
    h.alias('backgroundGeneratingProcessIdentifier', 'backgroundProcess')
    h.add(_.Unsigned('generatingProcessIdentifier', 1))
    h.add(_.Unsigned('hoursAfterDataCutoff', 2))
    h.alias('hoursAfterReferenceTimeOfDataCutoff', 'hoursAfterDataCutoff')
    h.add(_.Unsigned('minutesAfterDataCutoff', 1))
    h.alias('minutesAfterReferenceTimeOfDataCutoff', 'minutesAfterDataCutoff')
    h.add(_.Codetable('indicatorOfUnitOfTimeRange', 1, "4.4.table", _.Get('masterDir'), _.Get('localDir')))
    h.alias('defaultStepUnits', 'one')
    _.Template('grib2/localConcepts/[centre:s]/default_step_units.def', True).load(h)
    h.add(_.TransientCodetable('stepUnits', 1, "stepUnits.table"))
    h.add(_.Signed('forecastTime', 4))
コード例 #2
0
def load(h):

    h.add(_.Codetable('parameterCategory', 1, "4.1.[discipline:l].table", _.Get('masterDir'), _.Get('localDir')))
    h.add(_.Codetable('parameterNumber', 1, "4.2.[discipline:l].[parameterCategory:l].table", _.Get('masterDir'), _.Get('localDir')))
    h.add(_.Codetable_units('parameterUnits', _.Get('parameterNumber')))
    h.add(_.Codetable_title('parameterName', _.Get('parameterNumber')))
    h.add(_.Codetable('typeOfGeneratingProcess', 1, "4.3.table", _.Get('masterDir'), _.Get('localDir')))
    h.add(_.Unsigned('backgroundProcess', 1))
    h.alias('backgroundGeneratingProcessIdentifier', 'backgroundProcess')
    h.add(_.Unsigned('generatingProcessIdentifier', 1))
    h.add(_.Unsigned('hoursAfterDataCutoff', 2))
    h.alias('hoursAfterReferenceTimeOfDataCutoff', 'hoursAfterDataCutoff')
    h.add(_.Unsigned('minutesAfterDataCutoff', 1))
    h.alias('minutesAfterReferenceTimeOfDataCutoff', 'minutesAfterDataCutoff')
    h.add(_.Codetable('indicatorOfUnitOfTimeRange', 1, "4.4.table", _.Get('masterDir'), _.Get('localDir')))
    h.alias('defaultStepUnits', 'one')
    _.Template('grib2/localConcepts/[centre:s]/default_step_units.def', True).load(h)
    h.add(_.TransientCodetable('stepUnits', 1, "stepUnits.table"))
    h.add(_.Signed('forecastTime', 4))
    h.add(_.Codetable('horizontalDimensionProcessed', 1, "4.220.table", _.Get('masterDir'), _.Get('localDir')))
    h.add(_.Codetable('treatmentOfMissingData', 1, "4.221.table", _.Get('masterDir'), _.Get('localDir')))
    h.add(_.Codetable('typeOfStatisticalProcessing', 1, "4.10.table", _.Get('masterDir'), _.Get('localDir')))
    h.add(_.Unsigned('startOfRange', 4))
    h.add(_.Unsigned('endOfRange', 4))
    h.add(_.Unsigned('numberOfDataValues', 2))
コード例 #3
0
def load(h):

    h.add(
        _.Codetable('parameterCategory', 1, "4.1.[discipline:l].table",
                    _.Get('masterDir'), _.Get('localDir')))
    h.add(
        _.Codetable('parameterNumber', 1,
                    "4.2.[discipline:l].[parameterCategory:l].table",
                    _.Get('masterDir'), _.Get('localDir')))
    h.add(_.Codetable_units('parameterUnits', _.Get('parameterNumber')))
    h.add(_.Codetable_title('parameterName', _.Get('parameterNumber')))
    h.add(_.Unsigned('inputProcessIdentifier', 2))
    h.add(_.StringCodetable('inputOriginatingCentre', 2, "common/c-11.table"))
    h.add(_.Unsigned('typeOfPostProcessing', 1))
    h.add(
        _.Codetable('typeOfGeneratingProcess', 1, "4.3.table",
                    _.Get('masterDir'), _.Get('localDir')))
    h.add(_.Unsigned('backgroundProcess', 1))
    h.alias('backgroundGeneratingProcessIdentifier', 'backgroundProcess')
    h.add(_.Unsigned('generatingProcessIdentifier', 1))
    h.add(_.Unsigned('hoursAfterDataCutoff', 2))
    h.alias('hoursAfterReferenceTimeOfDataCutoff', 'hoursAfterDataCutoff')
    h.add(_.Unsigned('minutesAfterDataCutoff', 1))
    h.alias('minutesAfterReferenceTimeOfDataCutoff', 'minutesAfterDataCutoff')
    h.add(
        _.Codetable('indicatorOfUnitOfTimeRange', 1, "4.4.table",
                    _.Get('masterDir'), _.Get('localDir')))
    h.alias('defaultStepUnits', 'one')
    _.Template('grib2/localConcepts/[centre:s]/default_step_units.def',
               True).load(h)
    h.add(_.TransientCodetable('stepUnits', 1, "stepUnits.table"))
    h.add(_.Signed('forecastTime', 4))
コード例 #4
0
def load(h):

    h.add(_.Codetable('parameterCategory', 1, "4.1.[discipline:l].table", _.Get('masterDir'), _.Get('localDir')))
    h.add(_.Codetable('parameterNumber', 1, "4.2.[discipline:l].[parameterCategory:l].table", _.Get('masterDir'), _.Get('localDir')))
    h.add(_.Codetable_units('parameterUnits', _.Get('parameterNumber')))
    h.add(_.Codetable_title('parameterName', _.Get('parameterNumber')))
    h.add(_.Codetable('aerosolType', 2, "4.233.table", _.Get('masterDir'), _.Get('localDir')))
    h.add(_.Codetable('sourceSinkChemicalPhysicalProcess', 1, "4.238.table", _.Get('masterDir'), _.Get('localDir')))
    h.add(_.Codetable('typeOfSizeInterval', 1, "4.91.table", _.Get('masterDir'), _.Get('localDir')))
    h.alias('typeOfIntervalForFirstAndSecondSize', 'typeOfSizeInterval')
    h.add(_.Signed('scaleFactorOfFirstSize', 1))
    h.add(_.Signed('scaledValueOfFirstSize', 4))
    h.add(_.Signed('scaleFactorOfSecondSize', 1))
    h.add(_.Signed('scaledValueOfSecondSize', 4))
    h.add(_.Codetable('typeOfWavelengthInterval', 1, "4.91.table", _.Get('masterDir'), _.Get('localDir')))
    h.alias('typeOfIntervalForFirstAndSecondWavelength', 'typeOfWavelengthInterval')
    h.add(_.Signed('scaleFactorOfFirstWavelength', 1))
    h.add(_.Signed('scaledValueOfFirstWavelength', 4))
    h.add(_.Signed('scaleFactorOfSecondWavelength', 1))
    h.add(_.Signed('scaledValueOfSecondWavelength', 4))
    h.add(_.Codetable('typeOfGeneratingProcess', 1, "4.3.table", _.Get('masterDir'), _.Get('localDir')))
    h.add(_.Unsigned('backgroundProcess', 1))
    h.alias('backgroundGeneratingProcessIdentifier', 'backgroundProcess')
    h.add(_.Unsigned('generatingProcessIdentifier', 1))
    h.add(_.Unsigned('hoursAfterDataCutoff', 2))
    h.alias('hoursAfterReferenceTimeOfDataCutoff', 'hoursAfterDataCutoff')
    h.add(_.Unsigned('minutesAfterDataCutoff', 1))
    h.alias('minutesAfterReferenceTimeOfDataCutoff', 'minutesAfterDataCutoff')
    h.add(_.Codetable('indicatorOfUnitOfTimeRange', 1, "4.4.table", _.Get('masterDir'), _.Get('localDir')))
    h.alias('defaultStepUnits', 'one')
    _.Template('grib2/localConcepts/[centre:s]/default_step_units.def', True).load(h)
    h.add(_.TransientCodetable('stepUnits', 1, "stepUnits.table"))
    h.add(_.Signed('forecastTime', 4))
コード例 #5
0
ファイル: template_4_31_def.py プロジェクト: ecmwf/pyeccodes
def load(h):

    h.add(_.Constant('dataRepresentationType', 90))
    h.add(
        _.Codetable('parameterCategory', 1, "4.1.[discipline:l].table",
                    _.Get('masterDir'), _.Get('localDir')))
    h.add(
        _.Codetable('parameterNumber', 1,
                    "4.2.[discipline:l].[parameterCategory:l].table",
                    _.Get('masterDir'), _.Get('localDir')))
    h.add(_.Codetable_units('parameterUnits', _.Get('parameterNumber')))
    h.add(_.Codetable_title('parameterName', _.Get('parameterNumber')))
    h.add(
        _.Codetable('typeOfGeneratingProcess', 1, "4.3.table",
                    _.Get('masterDir'), _.Get('localDir')))
    h.add(_.Unsigned('observationGeneratingProcessIdentifier', 1))
    h.alias('generatingProcessIdentifier',
            'observationGeneratingProcessIdentifier')
    h.add(_.Unsigned('NB', 1))
    h.alias('numberOfContributingSpectralBands', 'NB')

    with h.list('listOfContributingSpectralBands'):
        for i in range(0, h.get_l('numberOfContributingSpectralBands')):
            h.add(_.Unsigned('satelliteSeries', 2))
            h.add(_.Unsigned('satelliteNumber', 2))
            h.add(_.Unsigned('instrumentType', 2))
            h.add(_.Unsigned('scaleFactorOfCentralWaveNumber', 1))
            h.add(_.Unsigned('scaledValueOfCentralWaveNumber', 4))
コード例 #6
0
def load(h):

    h.add(_.Codetable('parameterCategory', 1, "4.1.[discipline:l].table", _.Get('masterDir'), _.Get('localDir')))
    h.add(_.Codetable('parameterNumber', 1, "4.2.[discipline:l].[parameterCategory:l].table", _.Get('masterDir'), _.Get('localDir')))
    h.add(_.Codetable_units('parameterUnits', _.Get('parameterNumber')))
    h.add(_.Codetable_title('parameterName', _.Get('parameterNumber')))
    h.add(_.Codetable('typeOfGeneratingProcess', 1, "4.3.table", _.Get('masterDir'), _.Get('localDir')))
    h.add(_.Unsigned('backgroundProcess', 1))
    h.alias('backgroundGeneratingProcessIdentifier', 'backgroundProcess')
    h.add(_.Unsigned('generatingProcessIdentifier', 1))
    h.add(_.Unsigned('hoursAfterDataCutoff', 2))
    h.alias('hoursAfterReferenceTimeOfDataCutoff', 'hoursAfterDataCutoff')
    h.add(_.Unsigned('minutesAfterDataCutoff', 1))
    h.alias('minutesAfterReferenceTimeOfDataCutoff', 'minutesAfterDataCutoff')
    h.add(_.Codetable('indicatorOfUnitOfTimeRange', 1, "4.4.table", _.Get('masterDir'), _.Get('localDir')))
    h.alias('defaultStepUnits', 'one')
    _.Template('grib2/localConcepts/[centre:s]/default_step_units.def', True).load(h)
    h.add(_.TransientCodetable('stepUnits', 1, "stepUnits.table"))
    h.add(_.Signed('forecastTime', 4))
    h.add(_.Step_in_units('startStep', _.Get('forecastTime'), _.Get('indicatorOfUnitOfTimeRange'), _.Get('stepUnits')))
    h.add(_.G2end_step('endStep', _.Get('startStep'), _.Get('stepUnits')))
    h.alias('step', 'startStep')
    h.alias('marsStep', 'startStep')
    h.alias('mars.step', 'startStep')
    h.alias('marsStartStep', 'startStep')
    h.alias('marsEndStep', 'endStep')
    h.add(_.G2step_range('stepRange', _.Get('startStep')))
    h.alias('ls.stepRange', 'stepRange')

    def stepTypeInternal_inline_concept(h):
        def wrapped(h):

            dummy = h.get_l('dummy')

            if dummy == 1:
                return 'instant'

        return wrapped

    h.add(_.Concept('stepTypeInternal', None, concepts=stepTypeInternal_inline_concept(h)))

    h.alias('time.stepType', 'stepType')
    h.alias('time.stepRange', 'stepRange')
    h.alias('time.stepUnits', 'stepUnits')
    h.alias('time.dataDate', 'dataDate')
    h.alias('time.dataTime', 'dataTime')
    h.alias('time.startStep', 'startStep')
    h.alias('time.endStep', 'endStep')
    h.add(_.Validity_date('validityDate', _.Get('dataDate'), _.Get('dataTime'), _.Get('step'), _.Get('stepUnits')))
    h.alias('time.validityDate', 'validityDate')
    h.add(_.Validity_time('validityTime', _.Get('dataDate'), _.Get('dataTime'), _.Get('step'), _.Get('stepUnits')))
    h.alias('time.validityTime', 'validityTime')
コード例 #7
0
def load(h):

    h.add(
        _.Codetable('parameterCategory', 1, "4.1.[discipline:l].table",
                    _.Get('masterDir'), _.Get('localDir')))
    h.add(
        _.Codetable('parameterNumber', 1,
                    "4.2.[discipline:l].[parameterCategory:l].table",
                    _.Get('masterDir'), _.Get('localDir')))
    h.add(_.Codetable_units('parameterUnits', _.Get('parameterNumber')))
    h.add(_.Codetable_title('parameterName', _.Get('parameterNumber')))
    h.add(
        _.Codetable('tileClassification', 1, "4.242.table", _.Get('masterDir'),
                    _.Get('localDir')))
    h.add(_.Unsigned('totalNumberOfTileAttributePairs', 1))
    h.add(_.Unsigned('numberOfUsedSpatialTiles', 1))
    h.add(_.Unsigned('tileIndex', 1))
    h.add(_.Unsigned('numberOfUsedTileAttributes', 1))
    h.add(
        _.Codetable('attributeOfTile', 1, "4.241.table", _.Get('masterDir'),
                    _.Get('localDir')))
    h.alias('NT', 'totalNumberOfTileAttributePairs')
    h.alias('NUT', 'numberOfUsedSpatialTiles')
    h.alias('ITN', 'tileIndex')
    h.alias('NAT', 'numberOfUsedTileAttributes')
    h.add(
        _.Codetable('typeOfGeneratingProcess', 1, "4.3.table",
                    _.Get('masterDir'), _.Get('localDir')))
    h.add(_.Unsigned('backgroundProcess', 1))
    h.alias('backgroundGeneratingProcessIdentifier', 'backgroundProcess')
    h.add(_.Unsigned('generatingProcessIdentifier', 1))
    h.add(_.Unsigned('hoursAfterDataCutoff', 2))
    h.alias('hoursAfterReferenceTimeOfDataCutoff', 'hoursAfterDataCutoff')
    h.add(_.Unsigned('minutesAfterDataCutoff', 1))
    h.alias('minutesAfterReferenceTimeOfDataCutoff', 'minutesAfterDataCutoff')
    h.add(
        _.Codetable('indicatorOfUnitOfTimeRange', 1, "4.4.table",
                    _.Get('masterDir'), _.Get('localDir')))
    h.alias('defaultStepUnits', 'one')
    _.Template('grib2/localConcepts/[centre:s]/default_step_units.def',
               True).load(h)
    h.add(_.TransientCodetable('stepUnits', 1, "stepUnits.table"))
    h.add(_.Signed('forecastTime', 4))
コード例 #8
0
def load(h):

    h.add(
        _.Codetable('parameterCategory', 1, "4.1.[discipline:l].table",
                    _.Get('masterDir'), _.Get('localDir')))
    h.add(
        _.Codetable('parameterNumber', 1,
                    "4.2.[discipline:l].[parameterCategory:l].table",
                    _.Get('masterDir'), _.Get('localDir')))
    h.add(_.Codetable_units('parameterUnits', _.Get('parameterNumber')))
    h.add(_.Codetable_title('parameterName', _.Get('parameterNumber')))
    h.add(
        _.Codetable('typeOfGeneratingProcess', 1, "4.3.table",
                    _.Get('masterDir'), _.Get('localDir')))
    h.add(_.Unsigned('numberOfRadarSitesUsed', 1))
    h.add(
        _.Codetable('indicatorOfUnitOfTimeRange', 1, "4.4.table",
                    _.Get('masterDir'), _.Get('localDir')))
    h.alias('defaultStepUnits', 'one')
    _.Template('grib2/localConcepts/[centre:s]/default_step_units.def',
               True).load(h)
    h.add(_.TransientCodetable('stepUnits', 1, "stepUnits.table"))
    h.add(_.Unsigned('siteLatitude', 4))
    h.add(_.Unsigned('siteLongitude', 4))
    h.add(_.Unsigned('siteElevation', 2))
    h.add(_.Unsigned('siteId', 4))
    h.add(_.Unsigned('siteId', 2))
    h.add(
        _.Codetable('operatingMode', 1, "4.12.table", _.Get('masterDir'),
                    _.Get('localDir')))
    h.add(_.Unsigned('reflectivityCalibrationConstant', 1))
    h.add(
        _.Codetable('qualityControlIndicator', 1, "4.13.table",
                    _.Get('masterDir'), _.Get('localDir')))
    h.add(
        _.Codetable('clutterFilterIndicator', 1, "4.14.table",
                    _.Get('masterDir'), _.Get('localDir')))
    h.add(_.Unsigned('constantAntennaElevationAngle', 1))
    h.add(_.Unsigned('accumulationInterval', 2))
    h.add(_.Unsigned('referenceReflectivityForEchoTop', 1))
    h.add(_.Unsigned('rangeBinSpacing', 3))
    h.add(_.Unsigned('radialAngularSpacing', 2))
コード例 #9
0
def load(h):

    h.add(_.Unsigned('forecastProbabilityNumber', 1))
    h.add(_.Unsigned('totalNumberOfForecastProbabilities', 1))
    h.add(
        _.Codetable('probabilityType', 1, "4.9.table", _.Get('masterDir'),
                    _.Get('localDir')))
    h.add(_.Codetable_title('probabilityTypeName', _.Get('probabilityType')))
    h.add(_.Signed('scaleFactorOfLowerLimit', 1))
    h.add(_.Signed('scaledValueOfLowerLimit', 4))
    h.add(
        _.From_scale_factor_scaled_value('lowerLimit',
                                         _.Get('scaleFactorOfLowerLimit'),
                                         _.Get('scaledValueOfLowerLimit')))
    h.add(_.Signed('scaleFactorOfUpperLimit', 1))
    h.add(_.Signed('scaledValueOfUpperLimit', 4))
    h.add(
        _.From_scale_factor_scaled_value('upperLimit',
                                         _.Get('scaleFactorOfUpperLimit'),
                                         _.Get('scaledValueOfUpperLimit')))
コード例 #10
0
def load(h):

    h.add(_.StringCodetable('typeOfFirstFixedSurface', 1, "4.5.table", _.Get('masterDir'), _.Get('localDir')))
    h.add(_.Codetable_units('unitsOfFirstFixedSurface', _.Get('typeOfFirstFixedSurface')))
    h.add(_.Codetable_title('nameOfFirstFixedSurface', _.Get('typeOfFirstFixedSurface')))
    h.add(_.Signed('scaleFactorOfFirstFixedSurface', 1))
    h.add(_.Unsigned('scaledValueOfFirstFixedSurface', 4))
    h.add(_.Codetable('typeOfSecondFixedSurface', 1, "4.5.table", _.Get('masterDir'), _.Get('localDir')))
    h.add(_.Codetable_units('unitsOfSecondFixedSurface', _.Get('typeOfSecondFixedSurface')))
    h.add(_.Codetable_title('nameOfSecondFixedSurface', _.Get('typeOfSecondFixedSurface')))
    h.add(_.Signed('scaleFactorOfSecondFixedSurface', 1))
    h.add(_.Unsigned('scaledValueOfSecondFixedSurface', 4))
    h.add(_.Transient('pressureUnits', "hPa"))

    def typeOfLevel_inline_concept(h):
        def wrapped(h):

            typeOfFirstFixedSurface = h.get_l('typeOfFirstFixedSurface')
            typeOfSecondFixedSurface = h.get_l('typeOfSecondFixedSurface')

            if typeOfFirstFixedSurface == 1 and typeOfSecondFixedSurface == 255:
                return 'surface'

            if typeOfFirstFixedSurface == 2 and typeOfSecondFixedSurface == 255:
                return 'cloudBase'

            if typeOfFirstFixedSurface == 3 and typeOfSecondFixedSurface == 255:
                return 'cloudTop'

            if typeOfFirstFixedSurface == 4 and typeOfSecondFixedSurface == 255:
                return 'isothermZero'

            if typeOfFirstFixedSurface == 5 and typeOfSecondFixedSurface == 255:
                return 'adiabaticCondensation'

            if typeOfFirstFixedSurface == 6 and typeOfSecondFixedSurface == 255:
                return 'maxWind'

            if typeOfFirstFixedSurface == 7 and typeOfSecondFixedSurface == 255:
                return 'tropopause'

            if typeOfFirstFixedSurface == 8 and typeOfSecondFixedSurface == 255:
                return 'nominalTop'

            if typeOfFirstFixedSurface == 9 and typeOfSecondFixedSurface == 255:
                return 'seaBottom'

            if typeOfFirstFixedSurface == 10 and typeOfSecondFixedSurface == 255:
                return 'atmosphere'

            if typeOfFirstFixedSurface == 20 and typeOfSecondFixedSurface == 255:
                return 'isothermal'

            pressureUnits = h.get_s('pressureUnits')

            if typeOfFirstFixedSurface == 100 and typeOfSecondFixedSurface == 255 and pressureUnits == "Pa":
                return 'isobaricInPa'

            if typeOfFirstFixedSurface == 100 and pressureUnits == "hPa" and typeOfSecondFixedSurface == 255:
                return 'isobaricInhPa'

            if typeOfFirstFixedSurface == 100 and typeOfSecondFixedSurface == 100:
                return 'isobaricLayer'

            if typeOfFirstFixedSurface == 101 and typeOfSecondFixedSurface == 255:
                return 'meanSea'

            if typeOfFirstFixedSurface == 102 and typeOfSecondFixedSurface == 255:
                return 'heightAboveSea'

            if typeOfFirstFixedSurface == 102 and typeOfSecondFixedSurface == 102:
                return 'heightAboveSeaLayer'

            if typeOfFirstFixedSurface == 103 and typeOfSecondFixedSurface == 255:
                return 'heightAboveGround'

            if typeOfFirstFixedSurface == 103 and typeOfSecondFixedSurface == 103:
                return 'heightAboveGroundLayer'

            if typeOfFirstFixedSurface == 104 and typeOfSecondFixedSurface == 255:
                return 'sigma'

            if typeOfFirstFixedSurface == 104 and typeOfSecondFixedSurface == 104:
                return 'sigmaLayer'

            if typeOfFirstFixedSurface == 105 and typeOfSecondFixedSurface == 255:
                return 'hybrid'

            if typeOfFirstFixedSurface == 118 and typeOfSecondFixedSurface == 255:
                return 'hybridHeight'

            if typeOfFirstFixedSurface == 105 and typeOfSecondFixedSurface == 105:
                return 'hybridLayer'

            if typeOfFirstFixedSurface == 106 and typeOfSecondFixedSurface == 255:
                return 'depthBelowLand'

            if typeOfFirstFixedSurface == 106 and typeOfSecondFixedSurface == 106:
                return 'depthBelowLandLayer'

            if typeOfFirstFixedSurface == 107 and typeOfSecondFixedSurface == 255:
                return 'theta'

            if typeOfFirstFixedSurface == 107 and typeOfSecondFixedSurface == 107:
                return 'thetaLayer'

            if typeOfFirstFixedSurface == 108 and typeOfSecondFixedSurface == 255:
                return 'pressureFromGround'

            if typeOfFirstFixedSurface == 108 and typeOfSecondFixedSurface == 108:
                return 'pressureFromGroundLayer'

            if typeOfFirstFixedSurface == 109 and typeOfSecondFixedSurface == 255:
                return 'potentialVorticity'

            if typeOfFirstFixedSurface == 111 and typeOfSecondFixedSurface == 255:
                return 'eta'

            if typeOfFirstFixedSurface == 151 and typeOfSecondFixedSurface == 255:
                return 'soil'

            if typeOfFirstFixedSurface == 151 and typeOfSecondFixedSurface == 151:
                return 'soilLayer'

            genVertHeightCoords = h.get_l('genVertHeightCoords')
            NV = h.get_l('NV')

            if genVertHeightCoords == 1 and typeOfFirstFixedSurface == 150 and NV == 6:
                return 'generalVertical'

            if genVertHeightCoords == 1 and typeOfFirstFixedSurface == 150 and typeOfSecondFixedSurface == 150 and NV == 6:
                return 'generalVerticalLayer'

            if typeOfFirstFixedSurface == 160 and typeOfSecondFixedSurface == 255:
                return 'depthBelowSea'

            if typeOfFirstFixedSurface == 1 and typeOfSecondFixedSurface == 8:
                return 'entireAtmosphere'

            if typeOfFirstFixedSurface == 1 and typeOfSecondFixedSurface == 9:
                return 'entireOcean'

            if typeOfFirstFixedSurface == 114 and typeOfSecondFixedSurface == 255:
                return 'snow'

            if typeOfFirstFixedSurface == 114 and typeOfSecondFixedSurface == 114:
                return 'snowLayer'

            scaleFactorOfFirstFixedSurface = h.get_l('scaleFactorOfFirstFixedSurface')
            scaledValueOfFirstFixedSurface = h.get_l('scaledValueOfFirstFixedSurface')

            if typeOfFirstFixedSurface == 160 and scaleFactorOfFirstFixedSurface == 0 and scaledValueOfFirstFixedSurface == 0 and typeOfSecondFixedSurface == 255:
                return 'oceanSurface'

            if typeOfFirstFixedSurface == 160 and typeOfSecondFixedSurface == 160:
                return 'oceanLayer'

            if typeOfFirstFixedSurface == 169 and typeOfSecondFixedSurface == 255:
                return 'mixedLayerDepth'

        return wrapped

    h.add(_.Concept('typeOfLevel', 'unknown', concepts=typeOfLevel_inline_concept(h)))

    h.alias('vertical.typeOfLevel', 'typeOfLevel')
    h.alias('levelType', 'typeOfFirstFixedSurface')

    if (h.get_l('typeOfSecondFixedSurface') == 255):
        h.add(_.G2level('level', _.Get('typeOfFirstFixedSurface'), _.Get('scaleFactorOfFirstFixedSurface'), _.Get('scaledValueOfFirstFixedSurface'), _.Get('pressureUnits')))
        h.add(_.Transient('bottomLevel', _.Get('level')))
        h.add(_.Transient('topLevel', _.Get('level')))
    else:
        h.add(_.G2level('topLevel', _.Get('typeOfFirstFixedSurface'), _.Get('scaleFactorOfFirstFixedSurface'), _.Get('scaledValueOfFirstFixedSurface'), _.Get('pressureUnits')))
        h.add(_.G2level('bottomLevel', _.Get('typeOfSecondFixedSurface'), _.Get('scaleFactorOfSecondFixedSurface'), _.Get('scaledValueOfSecondFixedSurface'), _.Get('pressureUnits')))
        h.alias('level', 'topLevel')

    h.alias('ls.level', 'level')
    h.alias('vertical.level', 'level')
    h.alias('vertical.bottomLevel', 'bottomLevel')
    h.alias('vertical.topLevel', 'topLevel')
    h.alias('extraDim', 'zero')

    if h._defined('extraDimensionPresent'):

        if h.get_l('extraDimensionPresent'):
            h.alias('extraDim', 'one')


    if h.get_l('extraDim'):
        h.alias('mars.levelist', 'dimension')
        h.alias('mars.levtype', 'dimensionType')
    else:
        h.add(_.Transient('tempPressureUnits', _.Get('pressureUnits')))

        if not ((h.get_s('typeOfLevel') == "surface")):

            if (h.get_s('tempPressureUnits') == "Pa"):
                h.add(_.Scale('marsLevel', _.Get('level'), _.Get('one'), _.Get('hundred')))
                h.alias('mars.levelist', 'marsLevel')
            else:
                h.alias('mars.levelist', 'level')


        h.alias('mars.levtype', 'typeOfFirstFixedSurface')

        if (h.get_s('levtype') == "sfc"):
            h.unalias('mars.levelist')

    if ((h.get_l('typeOfFirstFixedSurface') == 151) and (h.get_l('typeOfSecondFixedSurface') == 151)):
        h.alias('mars.levelist', 'bottomLevel')

    h.alias('ls.typeOfLevel', 'typeOfLevel')
コード例 #11
0
def load(h):

    h.add(
        _.Codetable('parameterCategory', 1, "4.1.[discipline:l].table",
                    _.Get('masterDir'), _.Get('localDir')))
    h.add(
        _.Codetable('parameterNumber', 1,
                    "4.2.[discipline:l].[parameterCategory:l].table",
                    _.Get('masterDir'), _.Get('localDir')))
    h.add(_.Codetable_units('parameterUnits', _.Get('parameterNumber')))
    h.add(_.Codetable_title('parameterName', _.Get('parameterNumber')))
    h.add(
        _.Codetable('aerosolType', 2, "4.233.table", _.Get('masterDir'),
                    _.Get('localDir')))
    h.add(
        _.Codetable('sourceSinkChemicalPhysicalProcess', 1, "4.238.table",
                    _.Get('masterDir'), _.Get('localDir')))
    h.add(
        _.Codetable('typeOfSizeInterval', 1, "4.91.table", _.Get('masterDir'),
                    _.Get('localDir')))
    h.alias('typeOfIntervalForFirstAndSecondSize', 'typeOfSizeInterval')
    h.add(_.Signed('scaleFactorOfFirstSize', 1))
    h.add(_.Signed('scaledValueOfFirstSize', 4))
    h.add(_.Signed('scaleFactorOfSecondSize', 1))
    h.add(_.Signed('scaledValueOfSecondSize', 4))
    h.add(
        _.Codetable('typeOfWavelengthInterval', 1, "4.91.table",
                    _.Get('masterDir'), _.Get('localDir')))
    h.alias('typeOfIntervalForFirstAndSecondWavelength',
            'typeOfWavelengthInterval')
    h.add(_.Signed('scaleFactorOfFirstWavelength', 1))
    h.add(_.Signed('scaledValueOfFirstWavelength', 4))
    h.add(_.Signed('scaleFactorOfSecondWavelength', 1))
    h.add(_.Signed('scaledValueOfSecondWavelength', 4))
    h.add(
        _.Codetable('typeOfGeneratingProcess', 1, "4.3.table",
                    _.Get('masterDir'), _.Get('localDir')))
    h.add(_.Unsigned('backgroundProcess', 1))
    h.alias('backgroundGeneratingProcessIdentifier', 'backgroundProcess')
    h.add(_.Unsigned('generatingProcessIdentifier', 1))
    h.add(_.Unsigned('hoursAfterDataCutoff', 2))
    h.alias('hoursAfterReferenceTimeOfDataCutoff', 'hoursAfterDataCutoff')
    h.add(_.Unsigned('minutesAfterDataCutoff', 1))
    h.alias('minutesAfterReferenceTimeOfDataCutoff', 'minutesAfterDataCutoff')
    h.add(
        _.Codetable('indicatorOfUnitOfTimeRange', 1, "4.4.table",
                    _.Get('masterDir'), _.Get('localDir')))
    h.alias('defaultStepUnits', 'one')
    _.Template('grib2/localConcepts/[centre:s]/default_step_units.def',
               True).load(h)
    h.add(_.TransientCodetable('stepUnits', 1, "stepUnits.table"))
    h.add(_.Signed('forecastTime', 4))
    h.add(
        _.Step_in_units('startStep', _.Get('forecastTime'),
                        _.Get('indicatorOfUnitOfTimeRange'),
                        _.Get('stepUnits')))
    h.add(_.G2end_step('endStep', _.Get('startStep'), _.Get('stepUnits')))
    h.alias('step', 'startStep')
    h.alias('marsStep', 'startStep')
    h.alias('mars.step', 'startStep')
    h.alias('marsStartStep', 'startStep')
    h.alias('marsEndStep', 'endStep')
    h.add(_.G2step_range('stepRange', _.Get('startStep')))
    h.alias('ls.stepRange', 'stepRange')

    def stepTypeInternal_inline_concept(h):
        def wrapped(h):

            dummy = h.get_l('dummy')

            if dummy == 1:
                return 'instant'

        return wrapped

    h.add(
        _.Concept('stepTypeInternal',
                  None,
                  concepts=stepTypeInternal_inline_concept(h)))

    h.alias('time.stepType', 'stepType')
    h.alias('time.stepRange', 'stepRange')
    h.alias('time.stepUnits', 'stepUnits')
    h.alias('time.dataDate', 'dataDate')
    h.alias('time.dataTime', 'dataTime')
    h.alias('time.startStep', 'startStep')
    h.alias('time.endStep', 'endStep')
    h.add(
        _.Validity_date('validityDate', _.Get('dataDate'), _.Get('dataTime'),
                        _.Get('step'), _.Get('stepUnits')))
    h.alias('time.validityDate', 'validityDate')
    h.add(
        _.Validity_time('validityTime', _.Get('dataDate'), _.Get('dataTime'),
                        _.Get('step'), _.Get('stepUnits')))
    h.alias('time.validityTime', 'validityTime')
    h.add(
        _.StringCodetable('typeOfFirstFixedSurface', 1, "4.5.table",
                          _.Get('masterDir'), _.Get('localDir')))
    h.add(
        _.Codetable_units('unitsOfFirstFixedSurface',
                          _.Get('typeOfFirstFixedSurface')))
    h.add(
        _.Codetable_title('nameOfFirstFixedSurface',
                          _.Get('typeOfFirstFixedSurface')))
    h.add(_.Signed('scaleFactorOfFirstFixedSurface', 1))
    h.add(_.Unsigned('scaledValueOfFirstFixedSurface', 4))
    h.add(
        _.Codetable('typeOfSecondFixedSurface', 1, "4.5.table",
                    _.Get('masterDir'), _.Get('localDir')))
    h.add(
        _.Codetable_units('unitsOfSecondFixedSurface',
                          _.Get('typeOfSecondFixedSurface')))
    h.add(
        _.Codetable_title('nameOfSecondFixedSurface',
                          _.Get('typeOfSecondFixedSurface')))
    h.add(_.Signed('scaleFactorOfSecondFixedSurface', 1))
    h.add(_.Unsigned('scaledValueOfSecondFixedSurface', 4))
    h.add(_.Transient('pressureUnits', "hPa"))

    def typeOfLevel_inline_concept(h):
        def wrapped(h):

            typeOfFirstFixedSurface = h.get_l('typeOfFirstFixedSurface')
            typeOfSecondFixedSurface = h.get_l('typeOfSecondFixedSurface')

            if typeOfFirstFixedSurface == 1 and typeOfSecondFixedSurface == 255:
                return 'surface'

            if typeOfFirstFixedSurface == 2 and typeOfSecondFixedSurface == 255:
                return 'cloudBase'

            if typeOfFirstFixedSurface == 3 and typeOfSecondFixedSurface == 255:
                return 'cloudTop'

            if typeOfFirstFixedSurface == 4 and typeOfSecondFixedSurface == 255:
                return 'isothermZero'

            if typeOfFirstFixedSurface == 5 and typeOfSecondFixedSurface == 255:
                return 'adiabaticCondensation'

            if typeOfFirstFixedSurface == 6 and typeOfSecondFixedSurface == 255:
                return 'maxWind'

            if typeOfFirstFixedSurface == 7 and typeOfSecondFixedSurface == 255:
                return 'tropopause'

            if typeOfFirstFixedSurface == 8 and typeOfSecondFixedSurface == 255:
                return 'nominalTop'

            if typeOfFirstFixedSurface == 9 and typeOfSecondFixedSurface == 255:
                return 'seaBottom'

            if typeOfFirstFixedSurface == 10 and typeOfSecondFixedSurface == 255:
                return 'atmosphere'

            if typeOfFirstFixedSurface == 20 and typeOfSecondFixedSurface == 255:
                return 'isothermal'

            pressureUnits = h.get_s('pressureUnits')

            if typeOfFirstFixedSurface == 100 and typeOfSecondFixedSurface == 255 and pressureUnits == "Pa":
                return 'isobaricInPa'

            if typeOfFirstFixedSurface == 100 and pressureUnits == "hPa" and typeOfSecondFixedSurface == 255:
                return 'isobaricInhPa'

            if typeOfFirstFixedSurface == 100 and typeOfSecondFixedSurface == 100:
                return 'isobaricLayer'

            if typeOfFirstFixedSurface == 101 and typeOfSecondFixedSurface == 255:
                return 'meanSea'

            if typeOfFirstFixedSurface == 102 and typeOfSecondFixedSurface == 255:
                return 'heightAboveSea'

            if typeOfFirstFixedSurface == 102 and typeOfSecondFixedSurface == 102:
                return 'heightAboveSeaLayer'

            if typeOfFirstFixedSurface == 103 and typeOfSecondFixedSurface == 255:
                return 'heightAboveGround'

            if typeOfFirstFixedSurface == 103 and typeOfSecondFixedSurface == 103:
                return 'heightAboveGroundLayer'

            if typeOfFirstFixedSurface == 104 and typeOfSecondFixedSurface == 255:
                return 'sigma'

            if typeOfFirstFixedSurface == 104 and typeOfSecondFixedSurface == 104:
                return 'sigmaLayer'

            if typeOfFirstFixedSurface == 105 and typeOfSecondFixedSurface == 255:
                return 'hybrid'

            if typeOfFirstFixedSurface == 118 and typeOfSecondFixedSurface == 255:
                return 'hybridHeight'

            if typeOfFirstFixedSurface == 105 and typeOfSecondFixedSurface == 105:
                return 'hybridLayer'

            if typeOfFirstFixedSurface == 106 and typeOfSecondFixedSurface == 255:
                return 'depthBelowLand'

            if typeOfFirstFixedSurface == 106 and typeOfSecondFixedSurface == 106:
                return 'depthBelowLandLayer'

            if typeOfFirstFixedSurface == 107 and typeOfSecondFixedSurface == 255:
                return 'theta'

            if typeOfFirstFixedSurface == 107 and typeOfSecondFixedSurface == 107:
                return 'thetaLayer'

            if typeOfFirstFixedSurface == 108 and typeOfSecondFixedSurface == 255:
                return 'pressureFromGround'

            if typeOfFirstFixedSurface == 108 and typeOfSecondFixedSurface == 108:
                return 'pressureFromGroundLayer'

            if typeOfFirstFixedSurface == 109 and typeOfSecondFixedSurface == 255:
                return 'potentialVorticity'

            if typeOfFirstFixedSurface == 111 and typeOfSecondFixedSurface == 255:
                return 'eta'

            if typeOfFirstFixedSurface == 151 and typeOfSecondFixedSurface == 255:
                return 'soil'

            if typeOfFirstFixedSurface == 151 and typeOfSecondFixedSurface == 151:
                return 'soilLayer'

            genVertHeightCoords = h.get_l('genVertHeightCoords')
            NV = h.get_l('NV')

            if genVertHeightCoords == 1 and typeOfFirstFixedSurface == 150 and NV == 6:
                return 'generalVertical'

            if genVertHeightCoords == 1 and typeOfFirstFixedSurface == 150 and typeOfSecondFixedSurface == 150 and NV == 6:
                return 'generalVerticalLayer'

            if typeOfFirstFixedSurface == 160 and typeOfSecondFixedSurface == 255:
                return 'depthBelowSea'

            if typeOfFirstFixedSurface == 1 and typeOfSecondFixedSurface == 8:
                return 'entireAtmosphere'

            if typeOfFirstFixedSurface == 1 and typeOfSecondFixedSurface == 9:
                return 'entireOcean'

            if typeOfFirstFixedSurface == 114 and typeOfSecondFixedSurface == 255:
                return 'snow'

            if typeOfFirstFixedSurface == 114 and typeOfSecondFixedSurface == 114:
                return 'snowLayer'

            scaleFactorOfFirstFixedSurface = h.get_l(
                'scaleFactorOfFirstFixedSurface')
            scaledValueOfFirstFixedSurface = h.get_l(
                'scaledValueOfFirstFixedSurface')

            if typeOfFirstFixedSurface == 160 and scaleFactorOfFirstFixedSurface == 0 and scaledValueOfFirstFixedSurface == 0 and typeOfSecondFixedSurface == 255:
                return 'oceanSurface'

            if typeOfFirstFixedSurface == 160 and typeOfSecondFixedSurface == 160:
                return 'oceanLayer'

            if typeOfFirstFixedSurface == 169 and typeOfSecondFixedSurface == 255:
                return 'mixedLayerDepth'

        return wrapped

    h.add(
        _.Concept('typeOfLevel',
                  'unknown',
                  concepts=typeOfLevel_inline_concept(h)))

    h.alias('vertical.typeOfLevel', 'typeOfLevel')
    h.alias('levelType', 'typeOfFirstFixedSurface')

    if (h.get_l('typeOfSecondFixedSurface') == 255):
        h.add(
            _.G2level('level', _.Get('typeOfFirstFixedSurface'),
                      _.Get('scaleFactorOfFirstFixedSurface'),
                      _.Get('scaledValueOfFirstFixedSurface'),
                      _.Get('pressureUnits')))
        h.add(_.Transient('bottomLevel', _.Get('level')))
        h.add(_.Transient('topLevel', _.Get('level')))
    else:
        h.add(
            _.G2level('topLevel', _.Get('typeOfFirstFixedSurface'),
                      _.Get('scaleFactorOfFirstFixedSurface'),
                      _.Get('scaledValueOfFirstFixedSurface'),
                      _.Get('pressureUnits')))
        h.add(
            _.G2level('bottomLevel', _.Get('typeOfSecondFixedSurface'),
                      _.Get('scaleFactorOfSecondFixedSurface'),
                      _.Get('scaledValueOfSecondFixedSurface'),
                      _.Get('pressureUnits')))
        h.alias('level', 'topLevel')

    h.alias('ls.level', 'level')
    h.alias('vertical.level', 'level')
    h.alias('vertical.bottomLevel', 'bottomLevel')
    h.alias('vertical.topLevel', 'topLevel')
    h.alias('extraDim', 'zero')

    if h._defined('extraDimensionPresent'):

        if h.get_l('extraDimensionPresent'):
            h.alias('extraDim', 'one')

    if h.get_l('extraDim'):
        h.alias('mars.levelist', 'dimension')
        h.alias('mars.levtype', 'dimensionType')
    else:
        h.add(_.Transient('tempPressureUnits', _.Get('pressureUnits')))

        if not ((h.get_s('typeOfLevel') == "surface")):

            if (h.get_s('tempPressureUnits') == "Pa"):
                h.add(
                    _.Scale('marsLevel', _.Get('level'), _.Get('one'),
                            _.Get('hundred')))
                h.alias('mars.levelist', 'marsLevel')
            else:
                h.alias('mars.levelist', 'level')

        h.alias('mars.levtype', 'typeOfFirstFixedSurface')

        if (h.get_s('levtype') == "sfc"):
            h.unalias('mars.levelist')

    if ((h.get_l('typeOfFirstFixedSurface') == 151)
            and (h.get_l('typeOfSecondFixedSurface') == 151)):
        h.alias('mars.levelist', 'bottomLevel')

    h.alias('ls.typeOfLevel', 'typeOfLevel')
    h.add(
        _.Codetable('typeOfEnsembleForecast', 1, "4.6.table",
                    _.Get('masterDir'), _.Get('localDir')))
    h.add(_.Unsigned('perturbationNumber', 1))
    h.alias('number', 'perturbationNumber')
    h.add(_.Unsigned('numberOfForecastsInEnsemble', 1))
    h.alias('totalNumber', 'numberOfForecastsInEnsemble')

    if ((((((((h.get_l('productionStatusOfProcessedData') == 4) or
              (h.get_l('productionStatusOfProcessedData') == 5)) or
             (h.get_l('productionStatusOfProcessedData') == 6)) or
            (h.get_l('productionStatusOfProcessedData') == 7)) or
           (h.get_l('productionStatusOfProcessedData') == 8)) or
          (h.get_l('productionStatusOfProcessedData') == 9)) or
         (h.get_l('productionStatusOfProcessedData') == 10))
            or (h.get_l('productionStatusOfProcessedData') == 11)):
        h.alias('mars.number', 'perturbationNumber')
コード例 #12
0
def load(h):

    h.add(_.Constant('dataRepresentationType', 90))
    h.add(
        _.Codetable('parameterCategory', 1, "4.1.[discipline:l].table",
                    _.Get('masterDir'), _.Get('localDir')))
    h.add(
        _.Codetable('parameterNumber', 1,
                    "4.2.[discipline:l].[parameterCategory:l].table",
                    _.Get('masterDir'), _.Get('localDir')))
    h.add(_.Codetable_units('parameterUnits', _.Get('parameterNumber')))
    h.add(_.Codetable_title('parameterName', _.Get('parameterNumber')))
    h.add(
        _.Codetable('typeOfGeneratingProcess', 1, "4.3.table",
                    _.Get('masterDir'), _.Get('localDir')))
    h.add(_.Unsigned('backgroundProcess', 1))
    h.alias('backgroundGeneratingProcessIdentifier', 'backgroundProcess')
    h.add(_.Unsigned('generatingProcessIdentifier', 1))
    h.add(_.Unsigned('hoursAfterDataCutoff', 2))
    h.alias('hoursAfterReferenceTimeOfDataCutoff', 'hoursAfterDataCutoff')
    h.add(_.Unsigned('minutesAfterDataCutoff', 1))
    h.alias('minutesAfterReferenceTimeOfDataCutoff', 'minutesAfterDataCutoff')
    h.add(
        _.Codetable('indicatorOfUnitOfTimeRange', 1, "4.4.table",
                    _.Get('masterDir'), _.Get('localDir')))
    h.alias('defaultStepUnits', 'one')
    _.Template('grib2/localConcepts/[centre:s]/default_step_units.def',
               True).load(h)
    h.add(_.TransientCodetable('stepUnits', 1, "stepUnits.table"))
    h.add(_.Signed('forecastTime', 4))
    h.add(
        _.Step_in_units('startStep', _.Get('forecastTime'),
                        _.Get('indicatorOfUnitOfTimeRange'),
                        _.Get('stepUnits')))
    h.add(_.G2end_step('endStep', _.Get('startStep'), _.Get('stepUnits')))
    h.alias('step', 'startStep')
    h.alias('marsStep', 'startStep')
    h.alias('mars.step', 'startStep')
    h.alias('marsStartStep', 'startStep')
    h.alias('marsEndStep', 'endStep')
    h.add(_.G2step_range('stepRange', _.Get('startStep')))
    h.alias('ls.stepRange', 'stepRange')

    def stepTypeInternal_inline_concept(h):
        def wrapped(h):

            dummy = h.get_l('dummy')

            if dummy == 1:
                return 'instant'

        return wrapped

    h.add(
        _.Concept('stepTypeInternal',
                  None,
                  concepts=stepTypeInternal_inline_concept(h)))

    h.alias('time.stepType', 'stepType')
    h.alias('time.stepRange', 'stepRange')
    h.alias('time.stepUnits', 'stepUnits')
    h.alias('time.dataDate', 'dataDate')
    h.alias('time.dataTime', 'dataTime')
    h.alias('time.startStep', 'startStep')
    h.alias('time.endStep', 'endStep')
    h.add(
        _.Validity_date('validityDate', _.Get('dataDate'), _.Get('dataTime'),
                        _.Get('step'), _.Get('stepUnits')))
    h.alias('time.validityDate', 'validityDate')
    h.add(
        _.Validity_time('validityTime', _.Get('dataDate'), _.Get('dataTime'),
                        _.Get('step'), _.Get('stepUnits')))
    h.alias('time.validityTime', 'validityTime')
    h.add(_.Constant('typeOfLevel', "surface"))
    h.add(_.Constant('levelType', "surface"))
    h.add(_.Constant('level', 0))
    h.add(_.Unsigned('NB', 1))
    h.alias('numberOfContributingSpectralBands', 'NB')

    with h.list('listOfContributingSpectralBands'):
        for i in range(0, h.get_l('numberOfContributingSpectralBands')):
            h.add(_.Unsigned('satelliteSeries', 2))
            h.add(_.Unsigned('satelliteNumber', 2))
            h.add(_.Unsigned('instrumentType', 2))
            h.add(_.Unsigned('scaleFactorOfCentralWaveNumber', 1))
            h.add(_.Unsigned('scaledValueOfCentralWaveNumber', 4))
    h.add(
        _.Codetable('typeOfEnsembleForecast', 1, "4.6.table",
                    _.Get('masterDir'), _.Get('localDir')))
    h.add(_.Unsigned('perturbationNumber', 1))
    h.alias('number', 'perturbationNumber')
    h.add(_.Unsigned('numberOfForecastsInEnsemble', 1))
    h.alias('totalNumber', 'numberOfForecastsInEnsemble')

    if ((((((((h.get_l('productionStatusOfProcessedData') == 4) or
              (h.get_l('productionStatusOfProcessedData') == 5)) or
             (h.get_l('productionStatusOfProcessedData') == 6)) or
            (h.get_l('productionStatusOfProcessedData') == 7)) or
           (h.get_l('productionStatusOfProcessedData') == 8)) or
          (h.get_l('productionStatusOfProcessedData') == 9)) or
         (h.get_l('productionStatusOfProcessedData') == 10))
            or (h.get_l('productionStatusOfProcessedData') == 11)):
        h.alias('mars.number', 'perturbationNumber')

    h.add(_.Unsigned('yearOfEndOfOverallTimeInterval', 2))
    h.add(_.Unsigned('monthOfEndOfOverallTimeInterval', 1))
    h.add(_.Unsigned('dayOfEndOfOverallTimeInterval', 1))
    h.add(_.Unsigned('hourOfEndOfOverallTimeInterval', 1))
    h.add(_.Unsigned('minuteOfEndOfOverallTimeInterval', 1))
    h.add(_.Unsigned('secondOfEndOfOverallTimeInterval', 1))
    h.add(_.Unsigned('numberOfTimeRange', 1))
    h.alias('n', 'numberOfTimeRange')
    h.add(_.Unsigned('numberOfMissingInStatisticalProcess', 4))
    h.alias('totalNumberOfDataValuesMissingInStatisticalProcess',
            'numberOfMissingInStatisticalProcess')

    with h.list('statisticalProcessesList'):
        for i in range(0, h.get_l('numberOfTimeRange')):
            h.add(
                _.Codetable('typeOfStatisticalProcessing', 1, "4.10.table",
                            _.Get('masterDir'), _.Get('localDir')))
            h.add(
                _.Codetable('typeOfTimeIncrement', 1, "4.11.table",
                            _.Get('masterDir'), _.Get('localDir')))
            h.alias(
                'typeOfTimeIncrementBetweenSuccessiveFieldsUsedInTheStatisticalProcessing',
                'typeOfTimeIncrement')
            h.add(
                _.Codetable('indicatorOfUnitForTimeRange', 1, "4.4.table",
                            _.Get('masterDir'), _.Get('localDir')))
            h.add(_.Unsigned('lengthOfTimeRange', 4))
            h.add(
                _.Codetable('indicatorOfUnitForTimeIncrement', 1, "4.4.table",
                            _.Get('masterDir'), _.Get('localDir')))
            h.add(_.Unsigned('timeIncrement', 4))
            h.alias('timeIncrementBetweenSuccessiveFields', 'timeIncrement')

    if ((h.get_l('numberOfTimeRange') == 1)
            or (h.get_l('numberOfTimeRange') == 2)):

        def stepTypeInternal_inline_concept(h):
            def wrapped(h):

                typeOfStatisticalProcessing = h.get_l(
                    'typeOfStatisticalProcessing')

                if typeOfStatisticalProcessing == 255:
                    return 'instant'

                typeOfTimeIncrement = h.get_l('typeOfTimeIncrement')

                if typeOfStatisticalProcessing == 0 and typeOfTimeIncrement == 2:
                    return 'avg'

                if typeOfStatisticalProcessing == 0 and typeOfTimeIncrement == 3:
                    return 'avg'

                if typeOfStatisticalProcessing == 0 and typeOfTimeIncrement == 1:
                    return 'avgd'

                if typeOfStatisticalProcessing == 1 and typeOfTimeIncrement == 2:
                    return 'accum'

                if typeOfStatisticalProcessing == 2:
                    return 'max'

                if typeOfStatisticalProcessing == 3:
                    return 'min'

                if typeOfStatisticalProcessing == 4:
                    return 'diff'

                if typeOfStatisticalProcessing == 5:
                    return 'rms'

                if typeOfStatisticalProcessing == 6:
                    return 'sd'

                if typeOfStatisticalProcessing == 7:
                    return 'cov'

                if typeOfStatisticalProcessing == 8:
                    return 'sdiff'

                if typeOfStatisticalProcessing == 9:
                    return 'ratio'

                if typeOfStatisticalProcessing == 10:
                    return 'stdanom'

                if typeOfStatisticalProcessing == 11:
                    return 'sum'

            return wrapped

        h.add(
            _.Concept('stepTypeInternal',
                      None,
                      concepts=stepTypeInternal_inline_concept(h)))

        h.add(
            _.Step_in_units('startStep', _.Get('forecastTime'),
                            _.Get('indicatorOfUnitOfTimeRange'),
                            _.Get('stepUnits'),
                            _.Get('indicatorOfUnitForTimeRange'),
                            _.Get('lengthOfTimeRange')))
        h.add(
            _.G2end_step('endStep', _.Get('startStep'), _.Get('stepUnits'),
                         _.Get('year'), _.Get('month'), _.Get('day'),
                         _.Get('hour'), _.Get('minute'), _.Get('second'),
                         _.Get('yearOfEndOfOverallTimeInterval'),
                         _.Get('monthOfEndOfOverallTimeInterval'),
                         _.Get('dayOfEndOfOverallTimeInterval'),
                         _.Get('hourOfEndOfOverallTimeInterval'),
                         _.Get('minuteOfEndOfOverallTimeInterval'),
                         _.Get('secondOfEndOfOverallTimeInterval'),
                         _.Get('indicatorOfUnitForTimeRange'),
                         _.Get('lengthOfTimeRange'),
                         _.Get('typeOfTimeIncrement'),
                         _.Get('numberOfTimeRange')))
        h.add(_.G2step_range('stepRange', _.Get('startStep'),
                             _.Get('endStep')))
    else:
        h.add(_.Constant('stepType', "multiple steps"))
        h.add(_.Constant('stepTypeInternal', "multiple steps"))
        h.add(_.Constant('endStep', "unavailable"))
        h.add(_.Constant('startStep', "unavailable"))
        h.add(_.Constant('stepRange', "unavailable"))

    h.alias('ls.stepRange', 'stepRange')
    h.alias('mars.step', 'endStep')
    h.alias('time.stepType', 'stepType')
    h.alias('time.stepRange', 'stepRange')
    h.alias('time.stepUnits', 'stepUnits')
    h.alias('time.dataDate', 'dataDate')
    h.alias('time.dataTime', 'dataTime')
    h.alias('time.startStep', 'startStep')
    h.alias('time.endStep', 'endStep')
    h.add(
        _.Validity_date('validityDate', _.Get('date'), _.Get('dataTime'),
                        _.Get('step'), _.Get('stepUnits'),
                        _.Get('yearOfEndOfOverallTimeInterval'),
                        _.Get('monthOfEndOfOverallTimeInterval'),
                        _.Get('dayOfEndOfOverallTimeInterval')))
    h.alias('time.validityDate', 'validityDate')
    h.add(
        _.Validity_time('validityTime', _.Get('date'), _.Get('dataTime'),
                        _.Get('step'), _.Get('stepUnits'),
                        _.Get('hourOfEndOfOverallTimeInterval'),
                        _.Get('minuteOfEndOfOverallTimeInterval')))
    h.alias('time.validityTime', 'validityTime')
    h.alias('instrument', 'instrumentType')
    h.alias('ident', 'satelliteNumber')
コード例 #13
0
def load(h):

    h.add(
        _.Codetable('parameterCategory', 1, "4.1.[discipline:l].table",
                    _.Get('masterDir'), _.Get('localDir')))
    h.add(
        _.Codetable('parameterNumber', 1,
                    "4.2.[discipline:l].[parameterCategory:l].table",
                    _.Get('masterDir'), _.Get('localDir')))
    h.add(_.Codetable_units('parameterUnits', _.Get('parameterNumber')))
    h.add(_.Codetable_title('parameterName', _.Get('parameterNumber')))
    h.add(
        _.Codetable('typeOfGeneratingProcess', 1, "4.3.table",
                    _.Get('masterDir'), _.Get('localDir')))
    h.add(_.Unsigned('backgroundProcess', 1))
    h.alias('backgroundGeneratingProcessIdentifier', 'backgroundProcess')
    h.add(_.Unsigned('generatingProcessIdentifier', 1))
    h.add(_.Unsigned('hoursAfterDataCutoff', 2))
    h.alias('hoursAfterReferenceTimeOfDataCutoff', 'hoursAfterDataCutoff')
    h.add(_.Unsigned('minutesAfterDataCutoff', 1))
    h.alias('minutesAfterReferenceTimeOfDataCutoff', 'minutesAfterDataCutoff')
    h.add(
        _.Codetable('indicatorOfUnitOfTimeRange', 1, "4.4.table",
                    _.Get('masterDir'), _.Get('localDir')))
    h.alias('defaultStepUnits', 'one')
    _.Template('grib2/localConcepts/[centre:s]/default_step_units.def',
               True).load(h)
    h.add(_.TransientCodetable('stepUnits', 1, "stepUnits.table"))
    h.add(_.Signed('forecastTime', 4))
    h.add(
        _.StringCodetable('typeOfFirstFixedSurface', 1, "4.5.table",
                          _.Get('masterDir'), _.Get('localDir')))
    h.add(
        _.Codetable_units('unitsOfFirstFixedSurface',
                          _.Get('typeOfFirstFixedSurface')))
    h.add(
        _.Codetable_title('nameOfFirstFixedSurface',
                          _.Get('typeOfFirstFixedSurface')))
    h.add(_.Signed('scaleFactorOfFirstFixedSurface', 1))
    h.add(_.Unsigned('scaledValueOfFirstFixedSurface', 4))
    h.add(
        _.Codetable('typeOfSecondFixedSurface', 1, "4.5.table",
                    _.Get('masterDir'), _.Get('localDir')))
    h.add(
        _.Codetable_units('unitsOfSecondFixedSurface',
                          _.Get('typeOfSecondFixedSurface')))
    h.add(
        _.Codetable_title('nameOfSecondFixedSurface',
                          _.Get('typeOfSecondFixedSurface')))
    h.add(_.Signed('scaleFactorOfSecondFixedSurface', 1))
    h.add(_.Unsigned('scaledValueOfSecondFixedSurface', 4))
    h.add(_.Transient('pressureUnits', "hPa"))

    def typeOfLevel_inline_concept(h):
        def wrapped(h):

            typeOfFirstFixedSurface = h.get_l('typeOfFirstFixedSurface')
            typeOfSecondFixedSurface = h.get_l('typeOfSecondFixedSurface')

            if typeOfFirstFixedSurface == 1 and typeOfSecondFixedSurface == 255:
                return 'surface'

            if typeOfFirstFixedSurface == 2 and typeOfSecondFixedSurface == 255:
                return 'cloudBase'

            if typeOfFirstFixedSurface == 3 and typeOfSecondFixedSurface == 255:
                return 'cloudTop'

            if typeOfFirstFixedSurface == 4 and typeOfSecondFixedSurface == 255:
                return 'isothermZero'

            if typeOfFirstFixedSurface == 5 and typeOfSecondFixedSurface == 255:
                return 'adiabaticCondensation'

            if typeOfFirstFixedSurface == 6 and typeOfSecondFixedSurface == 255:
                return 'maxWind'

            if typeOfFirstFixedSurface == 7 and typeOfSecondFixedSurface == 255:
                return 'tropopause'

            if typeOfFirstFixedSurface == 8 and typeOfSecondFixedSurface == 255:
                return 'nominalTop'

            if typeOfFirstFixedSurface == 9 and typeOfSecondFixedSurface == 255:
                return 'seaBottom'

            if typeOfFirstFixedSurface == 10 and typeOfSecondFixedSurface == 255:
                return 'atmosphere'

            if typeOfFirstFixedSurface == 20 and typeOfSecondFixedSurface == 255:
                return 'isothermal'

            pressureUnits = h.get_s('pressureUnits')

            if typeOfFirstFixedSurface == 100 and typeOfSecondFixedSurface == 255 and pressureUnits == "Pa":
                return 'isobaricInPa'

            if typeOfFirstFixedSurface == 100 and pressureUnits == "hPa" and typeOfSecondFixedSurface == 255:
                return 'isobaricInhPa'

            if typeOfFirstFixedSurface == 100 and typeOfSecondFixedSurface == 100:
                return 'isobaricLayer'

            if typeOfFirstFixedSurface == 101 and typeOfSecondFixedSurface == 255:
                return 'meanSea'

            if typeOfFirstFixedSurface == 102 and typeOfSecondFixedSurface == 255:
                return 'heightAboveSea'

            if typeOfFirstFixedSurface == 102 and typeOfSecondFixedSurface == 102:
                return 'heightAboveSeaLayer'

            if typeOfFirstFixedSurface == 103 and typeOfSecondFixedSurface == 255:
                return 'heightAboveGround'

            if typeOfFirstFixedSurface == 103 and typeOfSecondFixedSurface == 103:
                return 'heightAboveGroundLayer'

            if typeOfFirstFixedSurface == 104 and typeOfSecondFixedSurface == 255:
                return 'sigma'

            if typeOfFirstFixedSurface == 104 and typeOfSecondFixedSurface == 104:
                return 'sigmaLayer'

            if typeOfFirstFixedSurface == 105 and typeOfSecondFixedSurface == 255:
                return 'hybrid'

            if typeOfFirstFixedSurface == 118 and typeOfSecondFixedSurface == 255:
                return 'hybridHeight'

            if typeOfFirstFixedSurface == 105 and typeOfSecondFixedSurface == 105:
                return 'hybridLayer'

            if typeOfFirstFixedSurface == 106 and typeOfSecondFixedSurface == 255:
                return 'depthBelowLand'

            if typeOfFirstFixedSurface == 106 and typeOfSecondFixedSurface == 106:
                return 'depthBelowLandLayer'

            if typeOfFirstFixedSurface == 107 and typeOfSecondFixedSurface == 255:
                return 'theta'

            if typeOfFirstFixedSurface == 107 and typeOfSecondFixedSurface == 107:
                return 'thetaLayer'

            if typeOfFirstFixedSurface == 108 and typeOfSecondFixedSurface == 255:
                return 'pressureFromGround'

            if typeOfFirstFixedSurface == 108 and typeOfSecondFixedSurface == 108:
                return 'pressureFromGroundLayer'

            if typeOfFirstFixedSurface == 109 and typeOfSecondFixedSurface == 255:
                return 'potentialVorticity'

            if typeOfFirstFixedSurface == 111 and typeOfSecondFixedSurface == 255:
                return 'eta'

            if typeOfFirstFixedSurface == 151 and typeOfSecondFixedSurface == 255:
                return 'soil'

            if typeOfFirstFixedSurface == 151 and typeOfSecondFixedSurface == 151:
                return 'soilLayer'

            genVertHeightCoords = h.get_l('genVertHeightCoords')
            NV = h.get_l('NV')

            if genVertHeightCoords == 1 and typeOfFirstFixedSurface == 150 and NV == 6:
                return 'generalVertical'

            if genVertHeightCoords == 1 and typeOfFirstFixedSurface == 150 and typeOfSecondFixedSurface == 150 and NV == 6:
                return 'generalVerticalLayer'

            if typeOfFirstFixedSurface == 160 and typeOfSecondFixedSurface == 255:
                return 'depthBelowSea'

            if typeOfFirstFixedSurface == 1 and typeOfSecondFixedSurface == 8:
                return 'entireAtmosphere'

            if typeOfFirstFixedSurface == 1 and typeOfSecondFixedSurface == 9:
                return 'entireOcean'

            if typeOfFirstFixedSurface == 114 and typeOfSecondFixedSurface == 255:
                return 'snow'

            if typeOfFirstFixedSurface == 114 and typeOfSecondFixedSurface == 114:
                return 'snowLayer'

            scaleFactorOfFirstFixedSurface = h.get_l(
                'scaleFactorOfFirstFixedSurface')
            scaledValueOfFirstFixedSurface = h.get_l(
                'scaledValueOfFirstFixedSurface')

            if typeOfFirstFixedSurface == 160 and scaleFactorOfFirstFixedSurface == 0 and scaledValueOfFirstFixedSurface == 0 and typeOfSecondFixedSurface == 255:
                return 'oceanSurface'

            if typeOfFirstFixedSurface == 160 and typeOfSecondFixedSurface == 160:
                return 'oceanLayer'

            if typeOfFirstFixedSurface == 169 and typeOfSecondFixedSurface == 255:
                return 'mixedLayerDepth'

        return wrapped

    h.add(
        _.Concept('typeOfLevel',
                  'unknown',
                  concepts=typeOfLevel_inline_concept(h)))

    h.alias('vertical.typeOfLevel', 'typeOfLevel')
    h.alias('levelType', 'typeOfFirstFixedSurface')

    if (h.get_l('typeOfSecondFixedSurface') == 255):
        h.add(
            _.G2level('level', _.Get('typeOfFirstFixedSurface'),
                      _.Get('scaleFactorOfFirstFixedSurface'),
                      _.Get('scaledValueOfFirstFixedSurface'),
                      _.Get('pressureUnits')))
        h.add(_.Transient('bottomLevel', _.Get('level')))
        h.add(_.Transient('topLevel', _.Get('level')))
    else:
        h.add(
            _.G2level('topLevel', _.Get('typeOfFirstFixedSurface'),
                      _.Get('scaleFactorOfFirstFixedSurface'),
                      _.Get('scaledValueOfFirstFixedSurface'),
                      _.Get('pressureUnits')))
        h.add(
            _.G2level('bottomLevel', _.Get('typeOfSecondFixedSurface'),
                      _.Get('scaleFactorOfSecondFixedSurface'),
                      _.Get('scaledValueOfSecondFixedSurface'),
                      _.Get('pressureUnits')))
        h.alias('level', 'topLevel')

    h.alias('ls.level', 'level')
    h.alias('vertical.level', 'level')
    h.alias('vertical.bottomLevel', 'bottomLevel')
    h.alias('vertical.topLevel', 'topLevel')
    h.alias('extraDim', 'zero')

    if h._defined('extraDimensionPresent'):

        if h.get_l('extraDimensionPresent'):
            h.alias('extraDim', 'one')

    if h.get_l('extraDim'):
        h.alias('mars.levelist', 'dimension')
        h.alias('mars.levtype', 'dimensionType')
    else:
        h.add(_.Transient('tempPressureUnits', _.Get('pressureUnits')))

        if not ((h.get_s('typeOfLevel') == "surface")):

            if (h.get_s('tempPressureUnits') == "Pa"):
                h.add(
                    _.Scale('marsLevel', _.Get('level'), _.Get('one'),
                            _.Get('hundred')))
                h.alias('mars.levelist', 'marsLevel')
            else:
                h.alias('mars.levelist', 'level')

        h.alias('mars.levtype', 'typeOfFirstFixedSurface')

        if (h.get_s('levtype') == "sfc"):
            h.unalias('mars.levelist')

    if ((h.get_l('typeOfFirstFixedSurface') == 151)
            and (h.get_l('typeOfSecondFixedSurface') == 151)):
        h.alias('mars.levelist', 'bottomLevel')

    h.alias('ls.typeOfLevel', 'typeOfLevel')
    h.add(
        _.Codetable('derivedForecast', 1, "4.7.table", _.Get('masterDir'),
                    _.Get('localDir')))
    h.add(_.Unsigned('numberOfForecastsInEnsemble', 1))
    h.alias('totalNumber', 'numberOfForecastsInEnsemble')
    h.add(_.Unsigned('clusterIdentifier', 1))
    h.alias('number', 'clusterIdentifier')
    h.add(_.Unsigned('numberOfClusterHighResolution', 1))
    h.add(_.Unsigned('numberOfClusterLowResolution', 1))
    h.add(_.Unsigned('totalNumberOfClusters', 1))
    h.alias('totalNumber', 'totalNumberOfClusters')
    h.add(
        _.Codetable('clusteringMethod', 1, "4.8.table", _.Get('masterDir'),
                    _.Get('localDir')))
    h.add(_.Unsigned('latitudeOfCentralPointInClusterDomain', 4))
    h.add(_.Unsigned('longitudeOfCentralPointInClusterDomain', 4))
    h.add(_.Unsigned('radiusOfClusterDomain', 4))
    h.add(_.Unsigned('numberOfForecastsInTheCluster', 1))
    h.alias('NC', 'numberOfForecastsInTheCluster')
    h.add(_.Unsigned('scaleFactorOfStandardDeviation', 1))
    h.alias('scaleFactorOfStandardDeviationInTheCluster',
            'scaleFactorOfStandardDeviation')
    h.add(_.Unsigned('scaledValueOfStandardDeviation', 4))
    h.alias('scaledValueOfStandardDeviationInTheCluster',
            'scaledValueOfStandardDeviation')
    h.add(_.Unsigned('scaleFactorOfDistanceFromEnsembleMean', 1))
    h.add(_.Unsigned('scaleFactorOfDistanceFromEnsembleMean', 4))
    h.add(_.Unsigned('yearOfEndOfOverallTimeInterval', 2))
    h.add(_.Unsigned('monthOfEndOfOverallTimeInterval', 1))
    h.add(_.Unsigned('dayOfEndOfOverallTimeInterval', 1))
    h.add(_.Unsigned('hourOfEndOfOverallTimeInterval', 1))
    h.add(_.Unsigned('minuteOfEndOfOverallTimeInterval', 1))
    h.add(_.Unsigned('secondOfEndOfOverallTimeInterval', 1))
    h.add(_.Unsigned('numberOfTimeRange', 1))
    h.alias('n', 'numberOfTimeRange')
    h.add(_.Unsigned('numberOfMissingInStatisticalProcess', 4))
    h.alias('totalNumberOfDataValuesMissingInStatisticalProcess',
            'numberOfMissingInStatisticalProcess')

    with h.list('statisticalProcessesList'):
        for i in range(0, h.get_l('numberOfTimeRange')):
            h.add(
                _.Codetable('typeOfStatisticalProcessing', 1, "4.10.table",
                            _.Get('masterDir'), _.Get('localDir')))
            h.add(
                _.Codetable('typeOfTimeIncrement', 1, "4.11.table",
                            _.Get('masterDir'), _.Get('localDir')))
            h.alias(
                'typeOfTimeIncrementBetweenSuccessiveFieldsUsedInTheStatisticalProcessing',
                'typeOfTimeIncrement')
            h.add(
                _.Codetable('indicatorOfUnitForTimeRange', 1, "4.4.table",
                            _.Get('masterDir'), _.Get('localDir')))
            h.add(_.Unsigned('lengthOfTimeRange', 4))
            h.add(
                _.Codetable('indicatorOfUnitForTimeIncrement', 1, "4.4.table",
                            _.Get('masterDir'), _.Get('localDir')))
            h.add(_.Unsigned('timeIncrement', 4))
            h.alias('timeIncrementBetweenSuccessiveFields', 'timeIncrement')

    if ((h.get_l('numberOfTimeRange') == 1)
            or (h.get_l('numberOfTimeRange') == 2)):

        def stepTypeInternal_inline_concept(h):
            def wrapped(h):

                typeOfStatisticalProcessing = h.get_l(
                    'typeOfStatisticalProcessing')

                if typeOfStatisticalProcessing == 255:
                    return 'instant'

                typeOfTimeIncrement = h.get_l('typeOfTimeIncrement')

                if typeOfStatisticalProcessing == 0 and typeOfTimeIncrement == 2:
                    return 'avg'

                if typeOfStatisticalProcessing == 0 and typeOfTimeIncrement == 3:
                    return 'avg'

                if typeOfStatisticalProcessing == 0 and typeOfTimeIncrement == 1:
                    return 'avgd'

                if typeOfStatisticalProcessing == 1 and typeOfTimeIncrement == 2:
                    return 'accum'

                if typeOfStatisticalProcessing == 2:
                    return 'max'

                if typeOfStatisticalProcessing == 3:
                    return 'min'

                if typeOfStatisticalProcessing == 4:
                    return 'diff'

                if typeOfStatisticalProcessing == 5:
                    return 'rms'

                if typeOfStatisticalProcessing == 6:
                    return 'sd'

                if typeOfStatisticalProcessing == 7:
                    return 'cov'

                if typeOfStatisticalProcessing == 8:
                    return 'sdiff'

                if typeOfStatisticalProcessing == 9:
                    return 'ratio'

                if typeOfStatisticalProcessing == 10:
                    return 'stdanom'

                if typeOfStatisticalProcessing == 11:
                    return 'sum'

            return wrapped

        h.add(
            _.Concept('stepTypeInternal',
                      None,
                      concepts=stepTypeInternal_inline_concept(h)))

        h.add(
            _.Step_in_units('startStep', _.Get('forecastTime'),
                            _.Get('indicatorOfUnitOfTimeRange'),
                            _.Get('stepUnits'),
                            _.Get('indicatorOfUnitForTimeRange'),
                            _.Get('lengthOfTimeRange')))
        h.add(
            _.G2end_step('endStep', _.Get('startStep'), _.Get('stepUnits'),
                         _.Get('year'), _.Get('month'), _.Get('day'),
                         _.Get('hour'), _.Get('minute'), _.Get('second'),
                         _.Get('yearOfEndOfOverallTimeInterval'),
                         _.Get('monthOfEndOfOverallTimeInterval'),
                         _.Get('dayOfEndOfOverallTimeInterval'),
                         _.Get('hourOfEndOfOverallTimeInterval'),
                         _.Get('minuteOfEndOfOverallTimeInterval'),
                         _.Get('secondOfEndOfOverallTimeInterval'),
                         _.Get('indicatorOfUnitForTimeRange'),
                         _.Get('lengthOfTimeRange'),
                         _.Get('typeOfTimeIncrement'),
                         _.Get('numberOfTimeRange')))
        h.add(_.G2step_range('stepRange', _.Get('startStep'),
                             _.Get('endStep')))
    else:
        h.add(_.Constant('stepType', "multiple steps"))
        h.add(_.Constant('stepTypeInternal', "multiple steps"))
        h.add(_.Constant('endStep', "unavailable"))
        h.add(_.Constant('startStep', "unavailable"))
        h.add(_.Constant('stepRange', "unavailable"))

    h.alias('ls.stepRange', 'stepRange')
    h.alias('mars.step', 'endStep')
    h.alias('time.stepType', 'stepType')
    h.alias('time.stepRange', 'stepRange')
    h.alias('time.stepUnits', 'stepUnits')
    h.alias('time.dataDate', 'dataDate')
    h.alias('time.dataTime', 'dataTime')
    h.alias('time.startStep', 'startStep')
    h.alias('time.endStep', 'endStep')
    h.add(
        _.Validity_date('validityDate', _.Get('date'), _.Get('dataTime'),
                        _.Get('step'), _.Get('stepUnits'),
                        _.Get('yearOfEndOfOverallTimeInterval'),
                        _.Get('monthOfEndOfOverallTimeInterval'),
                        _.Get('dayOfEndOfOverallTimeInterval')))
    h.alias('time.validityDate', 'validityDate')
    h.add(
        _.Validity_time('validityTime', _.Get('date'), _.Get('dataTime'),
                        _.Get('step'), _.Get('stepUnits'),
                        _.Get('hourOfEndOfOverallTimeInterval'),
                        _.Get('minuteOfEndOfOverallTimeInterval')))
    h.alias('time.validityTime', 'validityTime')

    with h.list('ensembleForecastNumbersList'):
        for i in range(0, h.get_l('numberOfForecastsInTheCluster')):
            h.add(_.Unsigned('ensembleForecastNumbers', 1))
コード例 #14
0
def load(h):

    h.add(_.Constant('gridDescriptionSectionPresent', 1))
    h.add(_.Position('offsetSection3'))
    h.add(_.Section_length('section3Length', 4))
    h.add(
        _.Section_pointer('section3Pointer', _.Get('offsetSection3'),
                          _.Get('section3Length'), 3))
    h.add(_.Unsigned('numberOfSection', 1))
    h.add(
        _.Codetable('sourceOfGridDefinition', 1, "3.0.table",
                    _.Get('masterDir'), _.Get('localDir')))
    h.add(_.Unsigned('numberOfDataPoints', 4))
    h.alias('numberOfPoints', 'numberOfDataPoints')
    h.add(_.Unsigned('numberOfOctectsForNumberOfPoints', 1))
    h.add(
        _.Codetable('interpretationOfNumberOfPoints', 1, "3.11.table",
                    _.Get('masterDir'), _.Get('localDir')))

    if (h.get_l('numberOfOctectsForNumberOfPoints') == 0):
        h.add(_.Transient('PLPresent', 0))
    else:
        h.add(_.Transient('PLPresent', 1))

    h.add(
        _.Codetable('gridDefinitionTemplateNumber', 2, "3.1.table",
                    _.Get('masterDir'), _.Get('localDir')))
    h.add(
        _.Codetable_title('gridDefinitionDescription',
                          _.Get('gridDefinitionTemplateNumber')))
    h.alias('isRotatedGrid', 'zero')
    _.Template('grib2/template.3.[gridDefinitionTemplateNumber:l].def').load(h)

    if h.get_l('PLPresent'):

        if (h.get_l('numberOfOctectsForNumberOfPoints') == 1):
            h.add(_.Unsigned('pl', 1, _.Get('Nj')))

        if (h.get_l('numberOfOctectsForNumberOfPoints') == 2):
            h.add(_.Unsigned('pl', 2, _.Get('Nj')))

        if (h.get_l('numberOfOctectsForNumberOfPoints') == 3):
            h.add(_.Unsigned('pl', 3, _.Get('Nj')))

        h.alias('geography.pl', 'pl')

    pass  # when block
    h.add(_.Section_padding('section3Padding'))

    def gridType_inline_concept(h):
        def wrapped(h):

            gridDefinitionTemplateNumber = h.get_l(
                'gridDefinitionTemplateNumber')
            PLPresent = h.get_l('PLPresent')

            if gridDefinitionTemplateNumber == 0 and PLPresent == 0:
                return 'regular_ll'

            if gridDefinitionTemplateNumber == 0 and PLPresent == 1:
                return 'reduced_ll'

            if gridDefinitionTemplateNumber == 1 and PLPresent == 0:
                return 'rotated_ll'

            if gridDefinitionTemplateNumber == 2 and PLPresent == 0:
                return 'stretched_ll'

            if gridDefinitionTemplateNumber == 3 and PLPresent == 0:
                return 'stretched_rotated_ll'

            if gridDefinitionTemplateNumber == 10 and PLPresent == 0:
                return 'mercator'

            if gridDefinitionTemplateNumber == 12 and PLPresent == 0:
                return 'transverse_mercator'

            if gridDefinitionTemplateNumber == 20 and PLPresent == 0:
                return 'polar_stereographic'

            if gridDefinitionTemplateNumber == 30 and PLPresent == 0:
                return 'lambert'

            if gridDefinitionTemplateNumber == 31 and PLPresent == 0:
                return 'albers'

            if gridDefinitionTemplateNumber == 40 and PLPresent == 0:
                return 'regular_gg'

            numberOfOctectsForNumberOfPoints = h.get_l(
                'numberOfOctectsForNumberOfPoints')
            iDirectionIncrementGiven = h.get_l('iDirectionIncrementGiven')
            numberOfPointsAlongAParallel = h.get_l(
                'numberOfPointsAlongAParallel')

            if gridDefinitionTemplateNumber == 40 and PLPresent == 1 and numberOfOctectsForNumberOfPoints == 2 and iDirectionIncrementGiven == 0 and numberOfPointsAlongAParallel == h._missing(
            ):
                return 'reduced_gg'

            if gridDefinitionTemplateNumber == 41 and PLPresent == 0:
                return 'rotated_gg'

            if gridDefinitionTemplateNumber == 41 and PLPresent == 1 and numberOfOctectsForNumberOfPoints == 2 and iDirectionIncrementGiven == 0 and numberOfPointsAlongAParallel == h._missing(
            ):
                return 'reduced_rotated_gg'

            if gridDefinitionTemplateNumber == 42 and PLPresent == 0:
                return 'stretched_gg'

            if gridDefinitionTemplateNumber == 42 and PLPresent == 1 and numberOfOctectsForNumberOfPoints == 2 and iDirectionIncrementGiven == 0 and numberOfPointsAlongAParallel == h._missing(
            ):
                return 'reduced_stretched_gg'

            if gridDefinitionTemplateNumber == 43 and PLPresent == 0:
                return 'stretched_rotated_gg'

            if gridDefinitionTemplateNumber == 43 and PLPresent == 1 and numberOfOctectsForNumberOfPoints == 2 and iDirectionIncrementGiven == 0 and numberOfPointsAlongAParallel == h._missing(
            ):
                return 'reduced_stretched_rotated_gg'

            if gridDefinitionTemplateNumber == 41 and PLPresent == 0:
                return 'regular_rotated_gg'

            if gridDefinitionTemplateNumber == 42 and PLPresent == 0:
                return 'regular_stretched_gg'

            if gridDefinitionTemplateNumber == 43 and PLPresent == 0:
                return 'regular_stretched_rotated_gg'

            if gridDefinitionTemplateNumber == 50 and PLPresent == 0:
                return 'sh'

            if gridDefinitionTemplateNumber == 51 and PLPresent == 0:
                return 'rotated_sh'

            if gridDefinitionTemplateNumber == 52 and PLPresent == 0:
                return 'stretched_sh'

            if gridDefinitionTemplateNumber == 53 and PLPresent == 0:
                return 'stretched_rotated_sh'

            if gridDefinitionTemplateNumber == 90 and PLPresent == 0:
                return 'space_view'

            if gridDefinitionTemplateNumber == 100 and PLPresent == 0:
                return 'triangular_grid'

            if gridDefinitionTemplateNumber == 101 and PLPresent == 0:
                return 'unstructured_grid'

            if gridDefinitionTemplateNumber == 110 and PLPresent == 0:
                return 'equatorial_azimuthal_equidistant'

            if gridDefinitionTemplateNumber == 120 and PLPresent == 0:
                return 'azimuth_range'

            if gridDefinitionTemplateNumber == 130 and PLPresent == 0:
                return 'irregular_latlon'

            if gridDefinitionTemplateNumber == 140 and PLPresent == 0:
                return 'lambert_azimuthal_equal_area'

            if gridDefinitionTemplateNumber == 1000 and PLPresent == 0:
                return 'cross_section'

            if gridDefinitionTemplateNumber == 1100 and PLPresent == 0:
                return 'Hovmoller'

            if gridDefinitionTemplateNumber == 1200 and PLPresent == 0:
                return 'time_section'

            if gridDefinitionTemplateNumber == 33 and PLPresent == 0:
                return 'lambert_lam'

            if gridDefinitionTemplateNumber == 13 and PLPresent == 0:
                return 'mercator_lam'

            if gridDefinitionTemplateNumber == 23 and PLPresent == 0:
                return 'polar_stereographic_lam'

            if gridDefinitionTemplateNumber == 63 and PLPresent == 0:
                return 'lambert_bf'

            if gridDefinitionTemplateNumber == 61 and PLPresent == 0:
                return 'mercator_bf'

            if gridDefinitionTemplateNumber == 62 and PLPresent == 0:
                return 'polar_stereographic_bf'

            if PLPresent == 0:
                return 'unknown'

            if PLPresent == 1:
                return 'unknown_PLPresent'

        return wrapped

    h.add(_.Concept('gridType', None, concepts=gridType_inline_concept(h)))

    h.alias('ls.gridType', 'gridType')
    h.alias('geography.gridType', 'gridType')
    h.alias('typeOfGrid', 'gridType')
    h.add(
        _.Md5('md5Section3', _.Get('offsetSection3'), _.Get('section3Length')))
    h.alias('md5GridSection', 'md5Section3')
コード例 #15
0
def load(h):

    h.add(_.Constant('ECMWF', 98))
    h.add(_.Constant('ECMWF_s', "ecmf"))
    h.add(_.Constant('WMO', 0))
    h.add(_.Constant('conceptsMasterDir', "grib1"))
    h.add(_.Constant('conceptsLocalDirECMF', "grib1/localConcepts/ecmf"))
    h.add(_.Constant('conceptsLocalDirAll', "grib1/localConcepts/[centre:s]"))
    h.add(_.Constant('tablesMasterDir', "grib1"))
    h.add(_.Constant('tablesLocalDir', "grib1/local/[centre:s]"))
    h.add(_.Transient('productionStatusOfProcessedData', 0))
    h.add(_.Position('offsetSection1'))
    h.add(_.Section_length('section1Length', 3))
    h.add(_.Section_pointer('section1Pointer', _.Get('offsetSection1'), _.Get('section1Length'), 1))
    h.add(_.Constant('wrongPadding', 0))
    h.add(_.Unsigned('table2Version', 1))
    h.alias('gribTablesVersionNo', 'table2Version')
    h.add(_.StringCodetable('centre', 1, "common/c-1.table"))
    h.alias('identificationOfOriginatingGeneratingCentre', 'centre')
    h.add(_.Codetable_title('centreDescription', _.Get('centre')))
    h.alias('parameter.centre', 'centre')
    h.alias('originatingCentre', 'centre')
    h.alias('ls.centre', 'centre')
    h.add(_.Unsigned('generatingProcessIdentifier', 1))
    h.alias('generatingProcessIdentificationNumber', 'generatingProcessIdentifier')
    h.alias('process', 'generatingProcessIdentifier')
    h.add(_.Unsigned('gridDefinition', 1))
    h.add(_.Codeflag('section1Flags', 1, "grib1/1.table"))
    h.alias('centreForTable2', 'centre')
    h.add(_.Codetable('indicatorOfParameter', 1, "grib1/2.[centreForTable2:l].[table2Version:l].table"))
    h.add(_.Codetable_title('parameterName', _.Get('indicatorOfParameter')))
    h.add(_.Codetable_units('parameterUnits', _.Get('indicatorOfParameter')))
    h.add(_.StringCodetable('indicatorOfTypeOfLevel', 1, "3.table", _.Get('tablesLocalDir'), _.Get('tablesMasterDir')))
    h.alias('levelType', 'indicatorOfTypeOfLevel')
    h.add(_.Transient('pressureUnits', "hPa"))
    h.add(_.Concept('typeOfLevelECMF', 'unknown', 'typeOfLevel.def', 'conceptsMasterDir', 'conceptsLocalDirECMF', True))
    h.add(_.Concept('typeOfLevel', 'typeOfLevelECMF', 'typeOfLevel.def', 'conceptsMasterDir', 'conceptsLocalDirAll', True))
    h.alias('vertical.typeOfLevel', 'typeOfLevel')
    pass  # when block
    h.alias('ls.typeOfLevel', 'typeOfLevel')

    if ((((((((((((h.get_l('indicatorOfTypeOfLevel') == 101) or (h.get_l('indicatorOfTypeOfLevel') == 104)) or (h.get_l('indicatorOfTypeOfLevel') == 106)) or (h.get_l('indicatorOfTypeOfLevel') == 108)) or (h.get_l('indicatorOfTypeOfLevel') == 110)) or (h.get_l('indicatorOfTypeOfLevel') == 112)) or (h.get_l('indicatorOfTypeOfLevel') == 114)) or (h.get_l('indicatorOfTypeOfLevel') == 116)) or (h.get_l('indicatorOfTypeOfLevel') == 120)) or (h.get_l('indicatorOfTypeOfLevel') == 121)) or (h.get_l('indicatorOfTypeOfLevel') == 128)) or (h.get_l('indicatorOfTypeOfLevel') == 141)):
        h.add(_.Unsigned('topLevel', 1))
        h.add(_.Unsigned('bottomLevel', 1))
        h.add(_.Sprintf('levels', "%d-%d", _.Get('topLevel'), _.Get('bottomLevel')))
        h.alias('ls.levels', 'levels')
        h.alias('vertical.level', 'topLevel')
        h.alias('vertical.topLevel', 'topLevel')
        h.alias('vertical.bottomLevel', 'bottomLevel')
    else:
        h.add(_.Unsigned('level', 2))

        if (h.get_l('indicatorOfTypeOfLevel') == 210):
            h.add(_.Scale('marsLevel', _.Get('level'), _.Get('oneConstant'), _.Get('hundred')))
            h.alias('mars.levelist', 'marsLevel')

        h.alias('vertical.level', 'level')
        h.alias('vertical.topLevel', 'level')
        h.alias('vertical.bottomLevel', 'level')
        h.alias('ls.level', 'level')
        h.alias('lev', 'level')

    if (((((h.get_l('indicatorOfTypeOfLevel') == 109) or (h.get_l('indicatorOfTypeOfLevel') == 100)) or (h.get_l('indicatorOfTypeOfLevel') == 110)) or (h.get_l('indicatorOfTypeOfLevel') == 113)) or (h.get_l('indicatorOfTypeOfLevel') == 117)):
        h.alias('mars.levelist', 'level')

    h.add(_.Unsigned('yearOfCentury', 1))
    h.add(_.Unsigned('month', 1))
    h.add(_.Unsigned('day', 1))
    h.add(_.Unsigned('hour', 1))
    h.add(_.Unsigned('minute', 1))
    h.add(_.Transient('second', 0))
    h.add(_.Codetable('unitOfTimeRange', 1, "grib1/4.table"))
    h.alias('unitOfTime', 'unitOfTimeRange')
    h.alias('indicatorOfUnitOfTimeRange', 'unitOfTimeRange')
    h.add(_.Unsigned('P1', 1))
    h.add(_.Unsigned('P2', 1))
    h.add(_.Codetable('timeRangeIndicator', 1, "5.table", _.Get('tablesLocalDir'), _.Get('tablesMasterDir')))
    h.add(_.Unsigned('numberIncludedInAverage', 2))
    h.add(_.Bits('mybits', _.Get('numberIncludedInAverage'), 0, 12))
    h.add(_.Unsigned('numberMissingFromAveragesOrAccumulations', 1))
    h.add(_.Unsigned('centuryOfReferenceTimeOfData', 1))
    h.add(_.Codetable('subCentre', 1, "grib1/0.[centre].table"))

    if (h.get_l('table2Version') >= 128):

        if ((h.get_l('centre') != 98) and (h.get_l('subCentre') == 98)):
            h.alias('centreForTable2', 'subCentre')
        else:
            h.alias('centreForTable2', 'centre')

    else:
        h.alias('centreForTable2', 'WMO')

    h.add(_.Concept('paramIdECMF', 'defaultParameter', 'paramId.def', 'conceptsMasterDir', 'conceptsLocalDirECMF', False))
    h.add(_.Concept('paramId', 'paramIdECMF', 'paramId.def', 'conceptsMasterDir', 'conceptsLocalDirAll', False))
    h.add(_.Concept('cfNameECMF', 'defaultName', 'cfName.def', 'conceptsMasterDir', 'conceptsLocalDirECMF', False))
    h.add(_.Concept('cfName', 'cfNameECMF', 'cfName.def', 'conceptsMasterDir', 'conceptsLocalDirAll', False))
    h.add(_.Concept('cfVarNameECMF', 'defaultName', 'cfVarName.def', 'conceptsMasterDir', 'conceptsLocalDirECMF', False))
    h.add(_.Concept('cfVarName', 'cfVarNameECMF', 'cfVarName.def', 'conceptsMasterDir', 'conceptsLocalDirAll', False))
    h.add(_.Concept('unitsECMF', 'defaultName', 'units.def', 'conceptsMasterDir', 'conceptsLocalDirECMF', False))
    h.add(_.Concept('units', 'unitsECMF', 'units.def', 'conceptsMasterDir', 'conceptsLocalDirAll', False))
    h.add(_.Concept('nameECMF', 'defaultName', 'name.def', 'conceptsMasterDir', 'conceptsLocalDirECMF', False))
    h.add(_.Concept('name', 'nameECMF', 'name.def', 'conceptsMasterDir', 'conceptsLocalDirAll', False))
    h.add(_.Signed('decimalScaleFactor', 2))
    h.add(_.Transient('setLocalDefinition', 0))
    h.add(_.Transient('optimizeScaleFactor', 0))
    h.add(_.G1date('dataDate', _.Get('centuryOfReferenceTimeOfData'), _.Get('yearOfCentury'), _.Get('month'), _.Get('day')))
    h.add(_.Evaluate('year', (_.Get('dataDate') / 10000)))
    h.add(_.Time('dataTime', _.Get('hour'), _.Get('minute'), _.Get('second')))
    h.add(_.Julian_day('julianDay', _.Get('dataDate'), _.Get('hour'), _.Get('minute'), _.Get('second')))
    h.add(_.TransientCodetable('stepUnits', 1, "stepUnits.table"))
    h.add(_.Concept('stepType', 'timeRangeIndicator', 'stepType.def', 'conceptsMasterDir', 'conceptsLocalDirAll', True))

    if (h.get_s('stepType') == "instant"):
        h.alias('productDefinitionTemplateNumber', 'zero')
    else:
        h.alias('productDefinitionTemplateNumber', 'eight')

    h.add(_.G1step_range('stepRange', _.Get('P1'), _.Get('P2'), _.Get('timeRangeIndicator'), _.Get('unitOfTimeRange'), _.Get('stepUnits'), _.Get('stepType')))
    h.add(_.Long_vector('startStep', _.Get('stepRange'), 0))
    h.add(_.Long_vector('endStep', _.Get('stepRange'), 1))
    h.alias('stepInHours', 'endStep')
    h.alias('ls.stepRange', 'stepRange')
    h.alias('ls.dataDate', 'dataDate')
    h.alias('mars.step', 'endStep')
    h.alias('mars.date', 'dataDate')
    h.alias('mars.levtype', 'indicatorOfTypeOfLevel')
    h.alias('mars.time', 'dataTime')
    h.add(_.Mars_param('marsParam', _.Get('paramId'), _.Get('gribTablesVersionNo'), _.Get('indicatorOfParameter')))
    h.alias('mars.param', 'marsParam')

    if ((h.get_l('centre') == 34) and (h.get_l('subCentre') == 241)):
        h.alias('mars.param', 'paramId')

        if (h.get_l('indicatorOfTypeOfLevel') == 101):
            h.add(_.Constant('sfc_levtype', "sfc"))
            h.alias('mars.levtype', 'sfc_levtype')


    h.add(_.Validity_date('validityDate', _.Get('dataDate'), _.Get('dataTime'), _.Get('step'), _.Get('stepUnits')))
    h.alias('time.validityDate', 'validityDate')
    h.add(_.Validity_time('validityTime', _.Get('dataDate'), _.Get('dataTime'), _.Get('step'), _.Get('stepUnits')))
    h.alias('time.validityTime', 'validityTime')
    h.add(_.Transient('deleteLocalDefinition', 0))

    if ((((h.get_l('section1Length') > 40) or h._new()) or (h.get_l('setLocalDefinition') > 0)) and (h.get_l('deleteLocalDefinition') == 0)):
        h.add(_.Constant('localUsePresent', 1))
        h.alias('grib2LocalSectionPresent', 'present')

        if ((h.get_l('centre') == h.get_l('ECMWF')) or ((h.get_l('centre') != h.get_l('ECMWF')) and (h.get_l('subCentre') == h.get_l('ECMWF')))):
            h.add(_.Pad('reservedNeedNotBePresent', 12))
            h.add(_.Codetable('localDefinitionNumber', 1, "grib1/localDefinitionNumber.98.table"))
            _.Template('grib1/local.98.[localDefinitionNumber:l].def', True).load(h)

            if h._changed('localDefinitionNumber'):

                if (not (h._new()) and (h.get_l('localDefinitionNumber') != 4)):
                    h.add(_.Section_padding('localExtensionPadding'))


            _.Template('mars/grib.[stream:s].[type:s].def', True).load(h)
        else:

            if (not (h._new()) or h.get_l('setLocalDefinition')):
                h.add(_.Pad('reservedNeedNotBePresent', 12))
                _.Template('grib1/local.[centre:l].def', True).load(h)
                h.add(_.Section_padding('localExtensionPadding'))

    else:
        h.add(_.Constant('localUsePresent', 0))

    h.add(_.Section_padding('section1Padding'))
    h.add(_.Concept('shortNameECMF', 'defaultShortName', 'shortName.def', 'conceptsMasterDir', 'conceptsLocalDirECMF', False))
    h.add(_.Concept('shortName', 'shortNameECMF', 'shortName.def', 'conceptsMasterDir', 'conceptsLocalDirAll', False))
    h.alias('ls.shortName', 'shortName')
    h.add(_.Ifs_param('ifsParam', _.Get('paramId'), _.Get('type')))
    h.alias('parameter.paramId', 'paramId')
    h.alias('parameter.shortName', 'shortName')
    h.alias('parameter.units', 'units')
    h.alias('parameter.name', 'name')
    h.alias('parameter', 'paramId')
    h.alias('short_name', 'shortName')
    h.alias('time.stepRange', 'stepRange')
    h.alias('time.stepUnits', 'stepUnits')
    h.alias('time.dataDate', 'dataDate')
    h.alias('time.dataTime', 'dataTime')
    h.alias('time.startStep', 'startStep')
    h.alias('time.endStep', 'endStep')
    h.alias('time.stepType', 'stepType')
    h.add(_.Concept('stepTypeForConversion', 'unknown', 'stepTypeForConversion.def', 'conceptsMasterDir', 'conceptsLocalDirAll', True))

    if (h.get_s('stepTypeForConversion') == "accum"):
        h.alias('productDefinitionTemplateNumber', 'eight')

    h.add(_.Md5('md5Section1', _.Get('offsetSection1'), _.Get('section1Length')))
    h.add(_.Md5('md5Product', _.Get('offsetSection1'), _.Get('section1Length'), _.Get('gridDefinition'), _.Get('section1Flags'), _.Get('decimalScaleFactor')))
コード例 #16
0
def load(h):

    h.add(_.Constant('dataRepresentationType', 90))
    h.add(
        _.Codetable('parameterCategory', 1, "4.1.[discipline:l].table",
                    _.Get('masterDir'), _.Get('localDir')))
    h.add(
        _.Codetable('parameterNumber', 1,
                    "4.2.[discipline:l].[parameterCategory:l].table",
                    _.Get('masterDir'), _.Get('localDir')))
    h.add(_.Codetable_units('parameterUnits', _.Get('parameterNumber')))
    h.add(_.Codetable_title('parameterName', _.Get('parameterNumber')))
    h.add(
        _.Codetable('typeOfGeneratingProcess', 1, "4.3.table",
                    _.Get('masterDir'), _.Get('localDir')))
    h.add(_.Unsigned('backgroundProcess', 1))
    h.alias('backgroundGeneratingProcessIdentifier', 'backgroundProcess')
    h.add(_.Unsigned('generatingProcessIdentifier', 1))
    h.add(_.Unsigned('hoursAfterDataCutoff', 2))
    h.alias('hoursAfterReferenceTimeOfDataCutoff', 'hoursAfterDataCutoff')
    h.add(_.Unsigned('minutesAfterDataCutoff', 1))
    h.alias('minutesAfterReferenceTimeOfDataCutoff', 'minutesAfterDataCutoff')
    h.add(
        _.Codetable('indicatorOfUnitOfTimeRange', 1, "4.4.table",
                    _.Get('masterDir'), _.Get('localDir')))
    h.alias('defaultStepUnits', 'one')
    _.Template('grib2/localConcepts/[centre:s]/default_step_units.def',
               True).load(h)
    h.add(_.TransientCodetable('stepUnits', 1, "stepUnits.table"))
    h.add(_.Signed('forecastTime', 4))
    h.add(
        _.Step_in_units('startStep', _.Get('forecastTime'),
                        _.Get('indicatorOfUnitOfTimeRange'),
                        _.Get('stepUnits')))
    h.add(_.G2end_step('endStep', _.Get('startStep'), _.Get('stepUnits')))
    h.alias('step', 'startStep')
    h.alias('marsStep', 'startStep')
    h.alias('mars.step', 'startStep')
    h.alias('marsStartStep', 'startStep')
    h.alias('marsEndStep', 'endStep')
    h.add(_.G2step_range('stepRange', _.Get('startStep')))
    h.alias('ls.stepRange', 'stepRange')

    def stepTypeInternal_inline_concept(h):
        def wrapped(h):

            dummy = h.get_l('dummy')

            if dummy == 1:
                return 'instant'

        return wrapped

    h.add(
        _.Concept('stepTypeInternal',
                  None,
                  concepts=stepTypeInternal_inline_concept(h)))

    h.alias('time.stepType', 'stepType')
    h.alias('time.stepRange', 'stepRange')
    h.alias('time.stepUnits', 'stepUnits')
    h.alias('time.dataDate', 'dataDate')
    h.alias('time.dataTime', 'dataTime')
    h.alias('time.startStep', 'startStep')
    h.alias('time.endStep', 'endStep')
    h.add(
        _.Validity_date('validityDate', _.Get('dataDate'), _.Get('dataTime'),
                        _.Get('step'), _.Get('stepUnits')))
    h.alias('time.validityDate', 'validityDate')
    h.add(
        _.Validity_time('validityTime', _.Get('dataDate'), _.Get('dataTime'),
                        _.Get('step'), _.Get('stepUnits')))
    h.alias('time.validityTime', 'validityTime')
    h.add(_.Constant('typeOfLevel', "surface"))
    h.add(_.Constant('levelType', "surface"))
    h.add(_.Constant('level', 0))
    h.add(_.Unsigned('NB', 1))
    h.alias('numberOfContributingSpectralBands', 'NB')

    with h.list('listOfContributingSpectralBands'):
        for i in range(0, h.get_l('numberOfContributingSpectralBands')):
            h.add(_.Unsigned('satelliteSeries', 2))
            h.add(_.Unsigned('satelliteNumber', 2))
            h.add(_.Unsigned('instrumentType', 2))
            h.add(_.Unsigned('scaleFactorOfCentralWaveNumber', 1))
            h.add(_.Unsigned('scaledValueOfCentralWaveNumber', 4))
    h.add(
        _.Codetable('typeOfEnsembleForecast', 1, "4.6.table",
                    _.Get('masterDir'), _.Get('localDir')))
    h.add(_.Unsigned('perturbationNumber', 1))
    h.alias('number', 'perturbationNumber')
    h.add(_.Unsigned('numberOfForecastsInEnsemble', 1))
    h.alias('totalNumber', 'numberOfForecastsInEnsemble')

    if ((((((((h.get_l('productionStatusOfProcessedData') == 4) or
              (h.get_l('productionStatusOfProcessedData') == 5)) or
             (h.get_l('productionStatusOfProcessedData') == 6)) or
            (h.get_l('productionStatusOfProcessedData') == 7)) or
           (h.get_l('productionStatusOfProcessedData') == 8)) or
          (h.get_l('productionStatusOfProcessedData') == 9)) or
         (h.get_l('productionStatusOfProcessedData') == 10))
            or (h.get_l('productionStatusOfProcessedData') == 11)):
        h.alias('mars.number', 'perturbationNumber')

    h.alias('instrument', 'instrumentType')
    h.alias('ident', 'satelliteNumber')
コード例 #17
0
def load(h):

    h.add(_.Position('offsetSection2'))
    h.add(_.Section_length('section2Length', 3))
    h.add(_.Section_pointer('section2Pointer', _.Get('offsetSection2'), _.Get('section2Length'), 2))
    h.add(_.Transient('radius', 6367470))
    h.alias('radiusOfTheEarth', 'radius')
    h.alias('radiusInMetres', 'radius')
    h.add(_.Transient('shapeOfTheEarth', 6))
    h.add(_.Unsigned('numberOfVerticalCoordinateValues', 1))
    h.add(_.Constant('neitherPresent', 255))
    h.alias('NV', 'numberOfVerticalCoordinateValues')
    h.alias('numberOfCoordinatesValues', 'numberOfVerticalCoordinateValues')
    h.add(_.Unsigned('pvlLocation', 1))
    h.add(_.Codetable('dataRepresentationType', 1, "grib1/6.table"))
    h.add(_.Codetable_title('gridDefinitionDescription', _.Get('dataRepresentationType')))
    h.alias('isRotatedGrid', 'zero')

    if (h.get_l('dataRepresentationType') < 192):
        _.Template('grib1/grid_definition_[dataRepresentationType:l].def').load(h)
    else:
        _.Template('grib1/grid_definition_[dataRepresentationType:l].[centre:l].def').load(h)

    h.add(_.Position('endGridDefinition'))
    h.add(_.Position('offsetBeforePV'))
    h.add(_.Transient('PVPresent', (_.Get('NV') > 0)))

    if (h.get_l('pvlLocation') != h.get_l('neitherPresent')):
        h.add(_.Padto('padding_sec2_2', ((_.Get('offsetSection2') + _.Get('pvlLocation')) - 1)))
    else:
        h.add(_.Padto('padding_sec2_2', (_.Get('offsetSection2') + 32)))

    if h.get_l('PVPresent'):
        h.add(_.Ibmfloat('pv', 4, _.Get('NV')))
        h.alias('vertical.pv', 'pv')

    h.add(_.Position('offsetBeforePL'))
    h.add(_.Transient('PLPresent', _.And((_.Get('section2Length') > (_.Get('offsetBeforePL') - _.Get('offsetSection2'))), (_.Get('section2Length') >= (((_.Get('Nj') * 2) + _.Get('offsetBeforePL')) - _.Get('offsetSection2'))))))

    if h.get_l('PLPresent'):
        h.add(_.Constant('numberOfOctectsForNumberOfPoints', 2))
        h.add(_.Constant('interpretationOfNumberOfPoints', 1))
        h.add(_.Unsigned('pl', 2, _.Get('Nj')))
        h.alias('geography.pl', 'pl')

    if ((h.get_l('PVPresent') == 0) and (h.get_l('PLPresent') == 0)):
        h.add(_.Padto('padding_sec2_1', (_.Get('offsetSection2') + 32)))

    pass  # when block
    pass  # when block
    h.alias('reducedGrid', 'PLPresent')

    def deletePV_inline_concept(h):
        def wrapped(h):

            PVPresent = h.get_l('PVPresent')
            NV = h.get_l('NV')

            if PVPresent == 0 and NV == 0:
                return 1

        return wrapped

    h.add(_.Concept('deletePV', 'unknown', concepts=deletePV_inline_concept(h)))

    h.add(_.Padtoeven('padding_sec2_3', _.Get('offsetSection2'), _.Get('section2Length')))
    h.add(_.Md5('md5Section2', _.Get('offsetSection2'), _.Get('section2Length')))
    h.alias('md5GridSection', 'md5Section2')
コード例 #18
0
ファイル: section_1_def.py プロジェクト: ecmwf/pyeccodes
def load(h):

    h.add(_.Position('offsetSection1'))
    h.add(_.Section_length('section1Length', 4))
    h.add(_.Section_pointer('section1Pointer', _.Get('offsetSection1'), _.Get('section1Length'), 1))
    h.add(_.Unsigned('numberOfSection', 1))
    h.add(_.StringCodetable('centre', 2, "common/c-11.table"))
    h.alias('identificationOfOriginatingGeneratingCentre', 'centre')
    h.add(_.Codetable_title('centreDescription', _.Get('centre')))
    h.alias('parameter.centre', 'centre')
    h.alias('ls.centre', 'centre')
    h.alias('originatingCentre', 'centre')
    h.add(_.Unsigned('subCentre', 2))

    if (h.get_l('subCentre') == 98):
        h.alias('centreForLocal', 'subCentre')
    else:
        h.alias('centreForLocal', 'centre')

    h.add(_.Codetable('tablesVersion', 1, "grib2/tables/1.0.table"))
    h.alias('gribMasterTablesVersionNumber', 'tablesVersion')
    h.add(_.Transient('masterDir', "grib2/tables/[tablesVersion]"))

    if (h.get_l('tablesVersion') > h.get_l('tablesVersionLatest')):
        h.add(_.Transient('masterDir', "grib2/tables/[tablesVersionLatest]"))

    pass  # when block
    h.add(_.Codetable('localTablesVersion', 1, "grib2/tables/local/[centreForLocal]/1.1.table"))
    h.alias('versionNumberOfGribLocalTables', 'localTablesVersion')
    h.add(_.Transient('localDir', ""))

    if ((h.get_l('localTablesVersion') != 0) and (h.get_l('localTablesVersion') != 255)):
        h.add(_.Transient('localDir', "grib2/tables/local/[centre]/[localTablesVersion]"))

    h.add(_.Codetable('significanceOfReferenceTime', 1, "1.2.table", _.Get('masterDir'), _.Get('localDir')))
    h.add(_.Unsigned('year', 2))
    h.add(_.Unsigned('month', 1))
    h.add(_.Unsigned('day', 1))
    h.add(_.Unsigned('hour', 1))
    h.add(_.Unsigned('minute', 1))
    h.add(_.Unsigned('second', 1))
    h.add(_.G2date('dataDate', _.Get('year'), _.Get('month'), _.Get('day')))
    h.alias('mars.date', 'dataDate')
    h.alias('ls.date', 'dataDate')
    h.add(_.Julian_day('julianDay', _.Get('dataDate'), _.Get('hour'), _.Get('minute'), _.Get('second')))
    h.add(_.Time('dataTime', _.Get('hour'), _.Get('minute'), _.Get('second')))
    h.alias('mars.time', 'dataTime')
    h.add(_.Codetable('productionStatusOfProcessedData', 1, "1.3.table", _.Get('masterDir'), _.Get('localDir')))
    h.add(_.StringCodetable('typeOfProcessedData', 1, "1.4.table", _.Get('masterDir'), _.Get('localDir')))
    h.alias('ls.dataType', 'typeOfProcessedData')
    h.add(_.Md5('md5Section1', _.Get('offsetSection1'), _.Get('section1Length')))
    h.add(_.Select_step_template('selectStepTemplateInterval', _.Get('productDefinitionTemplateNumber'), 0))
    h.add(_.Select_step_template('selectStepTemplateInstant', _.Get('productDefinitionTemplateNumber'), 1))
    h.add(_.Transient('stepTypeInternal', "instant"))

    def stepType_inline_concept(h):
        def wrapped(h):

            selectStepTemplateInstant = h.get_l('selectStepTemplateInstant')
            stepTypeInternal = h.get_s('stepTypeInternal')

            if selectStepTemplateInstant == 1 and stepTypeInternal == "instant":
                return 'instant'

            selectStepTemplateInterval = h.get_l('selectStepTemplateInterval')

            if selectStepTemplateInterval == 1 and stepTypeInternal == "avg":
                return 'avg'

            if selectStepTemplateInterval == 1 and stepTypeInternal == "avgd":
                return 'avgd'

            if selectStepTemplateInterval == 1 and stepTypeInternal == "accum":
                return 'accum'

            if selectStepTemplateInterval == 1 and stepTypeInternal == "max":
                return 'max'

            if selectStepTemplateInterval == 1 and stepTypeInternal == "min":
                return 'min'

            if selectStepTemplateInterval == 1 and stepTypeInternal == "diff":
                return 'diff'

            if selectStepTemplateInterval == 1 and stepTypeInternal == "sdiff":
                return 'sdiff'

            if selectStepTemplateInterval == 1 and stepTypeInternal == "rms":
                return 'rms'

            if selectStepTemplateInterval == 1 and stepTypeInternal == "sd":
                return 'sd'

            if selectStepTemplateInterval == 1 and stepTypeInternal == "cov":
                return 'cov'

            if selectStepTemplateInterval == 1 and stepTypeInternal == "ratio":
                return 'ratio'

            if selectStepTemplateInterval == 1 and stepTypeInternal == "stdanom":
                return 'stdanom'

            if selectStepTemplateInterval == 1 and stepTypeInternal == "sum":
                return 'sum'

        return wrapped

    h.add(_.Concept('stepType', None, concepts=stepType_inline_concept(h)))

    h.add(_.G2_chemical('is_chemical', _.Get('productDefinitionTemplateNumber'), _.Get('stepType'), 0))
    h.add(_.G2_chemical('is_chemical_distfn', _.Get('productDefinitionTemplateNumber'), _.Get('stepType'), 1))
    h.add(_.G2_aerosol('is_aerosol', _.Get('productDefinitionTemplateNumber'), _.Get('stepType'), 0))
    h.add(_.G2_aerosol('is_aerosol_optical', _.Get('productDefinitionTemplateNumber'), _.Get('stepType'), 1))
    h.add(_.Transient('setCalendarId', 0))
    h.add(_.Transient('deleteCalendarId', 0))
    h.alias('calendarIdPresent', 'zero')

    if (((h.get_l('section1Length') > 21) or (h.get_l('setCalendarId') > 0)) and (h.get_l('deleteCalendarId') == 0)):
        h.alias('calendarIdPresent', 'present')
        h.add(_.StringCodetable('calendarIdentificationTemplateNumber', 2, "1.5.table", _.Get('masterDir'), _.Get('localDir')))
        _.Template('grib2/template.1.[calendarIdentificationTemplateNumber:l].def').load(h)

    def is_uerra_inline_concept(h):
        def wrapped(h):

            productionStatusOfProcessedData = h.get_l('productionStatusOfProcessedData')

            if productionStatusOfProcessedData == 10:
                return 1

            if productionStatusOfProcessedData == 11:
                return 1

            if productionStatusOfProcessedData == 9:
                return 1

            if productionStatusOfProcessedData == 8:
                return 1

            dummy = h.get_l('dummy')

            if dummy == 1:
                return 0

        return wrapped

    h.add(_.Concept('is_uerra', 'zero', concepts=is_uerra_inline_concept(h)))
コード例 #19
0
def load(h):

    h.add(_.Codetable('parameterCategory', 1, "4.1.[discipline:l].table", _.Get('masterDir'), _.Get('localDir')))
    h.add(_.Codetable('parameterNumber', 1, "4.2.[discipline:l].[parameterCategory:l].table", _.Get('masterDir'), _.Get('localDir')))
    h.add(_.Codetable_units('parameterUnits', _.Get('parameterNumber')))
    h.add(_.Codetable_title('parameterName', _.Get('parameterNumber')))
    h.add(_.Codetable('tileClassification', 1, "4.242.table", _.Get('masterDir'), _.Get('localDir')))
    h.add(_.Unsigned('totalNumberOfTileAttributePairs', 1))
    h.add(_.Unsigned('numberOfUsedSpatialTiles', 1))
    h.add(_.Unsigned('tileIndex', 1))
    h.add(_.Unsigned('numberOfUsedTileAttributes', 1))
    h.add(_.Codetable('attributeOfTile', 1, "4.241.table", _.Get('masterDir'), _.Get('localDir')))
    h.alias('NT', 'totalNumberOfTileAttributePairs')
    h.alias('NUT', 'numberOfUsedSpatialTiles')
    h.alias('ITN', 'tileIndex')
    h.alias('NAT', 'numberOfUsedTileAttributes')
    h.add(_.Codetable('typeOfGeneratingProcess', 1, "4.3.table", _.Get('masterDir'), _.Get('localDir')))
    h.add(_.Unsigned('backgroundProcess', 1))
    h.alias('backgroundGeneratingProcessIdentifier', 'backgroundProcess')
    h.add(_.Unsigned('generatingProcessIdentifier', 1))
    h.add(_.Unsigned('hoursAfterDataCutoff', 2))
    h.alias('hoursAfterReferenceTimeOfDataCutoff', 'hoursAfterDataCutoff')
    h.add(_.Unsigned('minutesAfterDataCutoff', 1))
    h.alias('minutesAfterReferenceTimeOfDataCutoff', 'minutesAfterDataCutoff')
    h.add(_.Codetable('indicatorOfUnitOfTimeRange', 1, "4.4.table", _.Get('masterDir'), _.Get('localDir')))
    h.alias('defaultStepUnits', 'one')
    _.Template('grib2/localConcepts/[centre:s]/default_step_units.def', True).load(h)
    h.add(_.TransientCodetable('stepUnits', 1, "stepUnits.table"))
    h.add(_.Signed('forecastTime', 4))
    h.add(_.StringCodetable('typeOfFirstFixedSurface', 1, "4.5.table", _.Get('masterDir'), _.Get('localDir')))
    h.add(_.Codetable_units('unitsOfFirstFixedSurface', _.Get('typeOfFirstFixedSurface')))
    h.add(_.Codetable_title('nameOfFirstFixedSurface', _.Get('typeOfFirstFixedSurface')))
    h.add(_.Signed('scaleFactorOfFirstFixedSurface', 1))
    h.add(_.Unsigned('scaledValueOfFirstFixedSurface', 4))
    h.add(_.Codetable('typeOfSecondFixedSurface', 1, "4.5.table", _.Get('masterDir'), _.Get('localDir')))
    h.add(_.Codetable_units('unitsOfSecondFixedSurface', _.Get('typeOfSecondFixedSurface')))
    h.add(_.Codetable_title('nameOfSecondFixedSurface', _.Get('typeOfSecondFixedSurface')))
    h.add(_.Signed('scaleFactorOfSecondFixedSurface', 1))
    h.add(_.Unsigned('scaledValueOfSecondFixedSurface', 4))
    h.add(_.Transient('pressureUnits', "hPa"))

    def typeOfLevel_inline_concept(h):
        def wrapped(h):

            typeOfFirstFixedSurface = h.get_l('typeOfFirstFixedSurface')
            typeOfSecondFixedSurface = h.get_l('typeOfSecondFixedSurface')

            if typeOfFirstFixedSurface == 1 and typeOfSecondFixedSurface == 255:
                return 'surface'

            if typeOfFirstFixedSurface == 2 and typeOfSecondFixedSurface == 255:
                return 'cloudBase'

            if typeOfFirstFixedSurface == 3 and typeOfSecondFixedSurface == 255:
                return 'cloudTop'

            if typeOfFirstFixedSurface == 4 and typeOfSecondFixedSurface == 255:
                return 'isothermZero'

            if typeOfFirstFixedSurface == 5 and typeOfSecondFixedSurface == 255:
                return 'adiabaticCondensation'

            if typeOfFirstFixedSurface == 6 and typeOfSecondFixedSurface == 255:
                return 'maxWind'

            if typeOfFirstFixedSurface == 7 and typeOfSecondFixedSurface == 255:
                return 'tropopause'

            if typeOfFirstFixedSurface == 8 and typeOfSecondFixedSurface == 255:
                return 'nominalTop'

            if typeOfFirstFixedSurface == 9 and typeOfSecondFixedSurface == 255:
                return 'seaBottom'

            if typeOfFirstFixedSurface == 10 and typeOfSecondFixedSurface == 255:
                return 'atmosphere'

            if typeOfFirstFixedSurface == 20 and typeOfSecondFixedSurface == 255:
                return 'isothermal'

            pressureUnits = h.get_s('pressureUnits')

            if typeOfFirstFixedSurface == 100 and typeOfSecondFixedSurface == 255 and pressureUnits == "Pa":
                return 'isobaricInPa'

            if typeOfFirstFixedSurface == 100 and pressureUnits == "hPa" and typeOfSecondFixedSurface == 255:
                return 'isobaricInhPa'

            if typeOfFirstFixedSurface == 100 and typeOfSecondFixedSurface == 100:
                return 'isobaricLayer'

            if typeOfFirstFixedSurface == 101 and typeOfSecondFixedSurface == 255:
                return 'meanSea'

            if typeOfFirstFixedSurface == 102 and typeOfSecondFixedSurface == 255:
                return 'heightAboveSea'

            if typeOfFirstFixedSurface == 102 and typeOfSecondFixedSurface == 102:
                return 'heightAboveSeaLayer'

            if typeOfFirstFixedSurface == 103 and typeOfSecondFixedSurface == 255:
                return 'heightAboveGround'

            if typeOfFirstFixedSurface == 103 and typeOfSecondFixedSurface == 103:
                return 'heightAboveGroundLayer'

            if typeOfFirstFixedSurface == 104 and typeOfSecondFixedSurface == 255:
                return 'sigma'

            if typeOfFirstFixedSurface == 104 and typeOfSecondFixedSurface == 104:
                return 'sigmaLayer'

            if typeOfFirstFixedSurface == 105 and typeOfSecondFixedSurface == 255:
                return 'hybrid'

            if typeOfFirstFixedSurface == 118 and typeOfSecondFixedSurface == 255:
                return 'hybridHeight'

            if typeOfFirstFixedSurface == 105 and typeOfSecondFixedSurface == 105:
                return 'hybridLayer'

            if typeOfFirstFixedSurface == 106 and typeOfSecondFixedSurface == 255:
                return 'depthBelowLand'

            if typeOfFirstFixedSurface == 106 and typeOfSecondFixedSurface == 106:
                return 'depthBelowLandLayer'

            if typeOfFirstFixedSurface == 107 and typeOfSecondFixedSurface == 255:
                return 'theta'

            if typeOfFirstFixedSurface == 107 and typeOfSecondFixedSurface == 107:
                return 'thetaLayer'

            if typeOfFirstFixedSurface == 108 and typeOfSecondFixedSurface == 255:
                return 'pressureFromGround'

            if typeOfFirstFixedSurface == 108 and typeOfSecondFixedSurface == 108:
                return 'pressureFromGroundLayer'

            if typeOfFirstFixedSurface == 109 and typeOfSecondFixedSurface == 255:
                return 'potentialVorticity'

            if typeOfFirstFixedSurface == 111 and typeOfSecondFixedSurface == 255:
                return 'eta'

            if typeOfFirstFixedSurface == 151 and typeOfSecondFixedSurface == 255:
                return 'soil'

            if typeOfFirstFixedSurface == 151 and typeOfSecondFixedSurface == 151:
                return 'soilLayer'

            genVertHeightCoords = h.get_l('genVertHeightCoords')
            NV = h.get_l('NV')

            if genVertHeightCoords == 1 and typeOfFirstFixedSurface == 150 and NV == 6:
                return 'generalVertical'

            if genVertHeightCoords == 1 and typeOfFirstFixedSurface == 150 and typeOfSecondFixedSurface == 150 and NV == 6:
                return 'generalVerticalLayer'

            if typeOfFirstFixedSurface == 160 and typeOfSecondFixedSurface == 255:
                return 'depthBelowSea'

            if typeOfFirstFixedSurface == 1 and typeOfSecondFixedSurface == 8:
                return 'entireAtmosphere'

            if typeOfFirstFixedSurface == 1 and typeOfSecondFixedSurface == 9:
                return 'entireOcean'

            if typeOfFirstFixedSurface == 114 and typeOfSecondFixedSurface == 255:
                return 'snow'

            if typeOfFirstFixedSurface == 114 and typeOfSecondFixedSurface == 114:
                return 'snowLayer'

            scaleFactorOfFirstFixedSurface = h.get_l('scaleFactorOfFirstFixedSurface')
            scaledValueOfFirstFixedSurface = h.get_l('scaledValueOfFirstFixedSurface')

            if typeOfFirstFixedSurface == 160 and scaleFactorOfFirstFixedSurface == 0 and scaledValueOfFirstFixedSurface == 0 and typeOfSecondFixedSurface == 255:
                return 'oceanSurface'

            if typeOfFirstFixedSurface == 160 and typeOfSecondFixedSurface == 160:
                return 'oceanLayer'

            if typeOfFirstFixedSurface == 169 and typeOfSecondFixedSurface == 255:
                return 'mixedLayerDepth'

        return wrapped

    h.add(_.Concept('typeOfLevel', 'unknown', concepts=typeOfLevel_inline_concept(h)))

    h.alias('vertical.typeOfLevel', 'typeOfLevel')
    h.alias('levelType', 'typeOfFirstFixedSurface')

    if (h.get_l('typeOfSecondFixedSurface') == 255):
        h.add(_.G2level('level', _.Get('typeOfFirstFixedSurface'), _.Get('scaleFactorOfFirstFixedSurface'), _.Get('scaledValueOfFirstFixedSurface'), _.Get('pressureUnits')))
        h.add(_.Transient('bottomLevel', _.Get('level')))
        h.add(_.Transient('topLevel', _.Get('level')))
    else:
        h.add(_.G2level('topLevel', _.Get('typeOfFirstFixedSurface'), _.Get('scaleFactorOfFirstFixedSurface'), _.Get('scaledValueOfFirstFixedSurface'), _.Get('pressureUnits')))
        h.add(_.G2level('bottomLevel', _.Get('typeOfSecondFixedSurface'), _.Get('scaleFactorOfSecondFixedSurface'), _.Get('scaledValueOfSecondFixedSurface'), _.Get('pressureUnits')))
        h.alias('level', 'topLevel')

    h.alias('ls.level', 'level')
    h.alias('vertical.level', 'level')
    h.alias('vertical.bottomLevel', 'bottomLevel')
    h.alias('vertical.topLevel', 'topLevel')
    h.alias('extraDim', 'zero')

    if h._defined('extraDimensionPresent'):

        if h.get_l('extraDimensionPresent'):
            h.alias('extraDim', 'one')


    if h.get_l('extraDim'):
        h.alias('mars.levelist', 'dimension')
        h.alias('mars.levtype', 'dimensionType')
    else:
        h.add(_.Transient('tempPressureUnits', _.Get('pressureUnits')))

        if not ((h.get_s('typeOfLevel') == "surface")):

            if (h.get_s('tempPressureUnits') == "Pa"):
                h.add(_.Scale('marsLevel', _.Get('level'), _.Get('one'), _.Get('hundred')))
                h.alias('mars.levelist', 'marsLevel')
            else:
                h.alias('mars.levelist', 'level')


        h.alias('mars.levtype', 'typeOfFirstFixedSurface')

        if (h.get_s('levtype') == "sfc"):
            h.unalias('mars.levelist')

    if ((h.get_l('typeOfFirstFixedSurface') == 151) and (h.get_l('typeOfSecondFixedSurface') == 151)):
        h.alias('mars.levelist', 'bottomLevel')

    h.alias('ls.typeOfLevel', 'typeOfLevel')
    h.add(_.Unsigned('perturbationNumber', 1))
    h.alias('number', 'perturbationNumber')
    h.add(_.Unsigned('numberOfForecastsInEnsemble', 1))
    h.alias('totalNumber', 'numberOfForecastsInEnsemble')