GRIB3: template components

This commit is contained in:
Shahram Najm 2016-08-22 17:59:39 +01:00
parent 2693016341
commit c5653956f2
16 changed files with 329 additions and 0 deletions

View File

@ -0,0 +1,17 @@
# Time Domain Section Template Component 3.0 - Forecast point in time
# Hours of observational data cut-off after reference time
# Note: Hours greater than 65534 will be coded as 65534
unsigned[2] hoursAfterDataCutoff =missing() : edition_specific,can_be_missing;
alias hoursAfterReferenceTimeOfDataCutoff=hoursAfterDataCutoff;
# Minutes of observational data cut-off after reference time
unsigned[1] minutesAfterDataCutoff = missing() : edition_specific,can_be_missing;
alias minutesAfterReferenceTimeOfDataCutoff=minutesAfterDataCutoff;
# Indicator of unit of time range
codetable[1] indicatorOfUnitOfTimeRange ('3.3.table',masterDir,localDir) : dump;
codetable[1] stepUnits 'stepUnits.table' = 1 : transient,dump,no_copy;
# Forecast time in units defined by previous octet (GRIB-29: supports negative forecast time)
signed[4] forecastTime : dump;

View File

@ -0,0 +1,25 @@
# Horizontal Domain Section Template Component 4.0 - Ellipsoid of revolution defined with axis lengths
# Scale factor of length of semi-major axis
unsigned[1] scaleFactorOfLengthOfSemiMajorAxis = missing() : can_be_missing, edition_specific;
# Scaled value of length of semi-major axis (equatorial radius)
unsigned[4] scaledValueOfLengthOfSemiMajorAxis = missing(): can_be_missing, edition_specific;
# Scale factor of prime meridian offset
unsigned[1] scaleFactorOfPrimeMeridianOffset = missing(): can_be_missing, edition_specific;
# Scaled value of prime meridian offset
# Note: Basic angle of the initial production domain and subdivisions of this basic angle are
# provided to manage cases where the recommended unit of 10^-6 degrees is not applicable
# to describe the extreme longitudes and latitudes, and direction increments.
# For these descriptors, the unit is equal to the ratio of the basic angle and the subdivisions number.
# For ordinary cases, zero and missing values should be coded, equivalent to respective values
# of 1 and 10^6 (10^-6 degrees unit)
unsigned[4] scaledValueOfPrimeMeridianOffset = missing(): can_be_missing, edition_specific;
# Scale factor of length of semi-minor axis
unsigned[1] scaleFactorOfLengthOfSemiMinorAxis = missing() : can_be_missing, edition_specific;
# Scaled value of length of semi-minor axis (distance from ellipsoid centre to pole)
unsigned[4] scaledValueOfLengthOfSemiMinorAxis = missing() : can_be_missing, edition_specific;

View File

@ -0,0 +1,135 @@
# Horizontal Domain Section Template Component 4.1 - Latitude/longitude regular grid
# Ni - number of points along a parallel
unsigned[4] Ni : dump; # Note: This is for a REGULAR GRID so Ni cannot be missing
alias numberOfPointsAlongAParallel=Ni;
alias Nx = Ni;
alias geography.Ni=Ni;
# Nj - number of points along a meridian
unsigned[4] Nj : dump;
alias numberOfPointsAlongAMeridian=Nj;
alias Ny = Nj ;
alias geography.Nj=Nj;
# Basic angle of the initial production domain
unsigned[4] basicAngleOfTheInitialProductionDomain = 0;
transient mBasicAngle=basicAngleOfTheInitialProductionDomain*oneMillionConstant;
transient angleMultiplier = 1;
transient mAngleMultiplier = 1000000;
when (basicAngleOfTheInitialProductionDomain == 0) {
set angleMultiplier = 1;
set mAngleMultiplier = 1000000;
} else {
set angleMultiplier = basicAngleOfTheInitialProductionDomain;
set mAngleMultiplier = mBasicAngle;
}
# Subdivisions of basic angle used to define extreme longitudes and latitudes, and direction increments
unsigned[4] subdivisionsOfBasicAngle = missing() : can_be_missing;
transient angleDivisor = 1000000;
when (missing(subdivisionsOfBasicAngle) || subdivisionsOfBasicAngle == 0) {
set angleDivisor = 1000000;
set angularPrecision = 1000000;
} else {
set angleDivisor = subdivisionsOfBasicAngle;
set angularPrecision = subdivisionsOfBasicAngle;
}
# Note: Basic angle of the initial production domain and subdivisions of this basic angle are
# provided to manage cases where the recommended unit of 10^-6 degrees is not applicable
# to describe the extreme longitudes and latitudes, and direction increments.
# For these descriptors, the unit is equal to the ratio of the basic angle and the subdivisions number.
# For ordinary cases, zero and missing values should be coded, equivalent to respective values
# of 1 and 10^6 (10^-6 degrees unit)
# La1 - latitude of first grid point
signed[4] latitudeOfFirstGridPoint : edition_specific;
alias La1 = latitudeOfFirstGridPoint;
# Lo1 - longitude of first grid point
signed[4] longitudeOfFirstGridPoint ;
alias Lo1 = longitudeOfFirstGridPoint;
include "grib3/template.4.resolution_flags.def"
# La2 - latitude of last grid point
signed[4] latitudeOfLastGridPoint : edition_specific;
alias La2 = latitudeOfLastGridPoint;
# Lo2 - longitude of last grid point
signed[4] longitudeOfLastGridPoint : edition_specific;
alias Lo2 = longitudeOfLastGridPoint;
# Di - i direction increment
# Direction increments are unsigned and direction of increment is represented in the scanning mode
unsigned[4] iDirectionIncrement : can_be_missing,edition_specific;
alias Di = iDirectionIncrement;
alias Dx = iDirectionIncrement;
# Dj - j direction increment
# Direction increments are unsigned and direction of increment is represented in the scanning mode
unsigned[4] jDirectionIncrement : can_be_missing,edition_specific;
alias Dj = jDirectionIncrement;
alias Dy = jDirectionIncrement;
include "grib3/template.4.scanning_mode.def";
meta g2grid g2grid(
latitudeOfFirstGridPoint,
longitudeOfFirstGridPoint,
latitudeOfLastGridPoint,
longitudeOfLastGridPoint,
iDirectionIncrement,
jDirectionIncrement,
basicAngleOfTheInitialProductionDomain,
subdivisionsOfBasicAngle
);
meta geography.latitudeOfFirstGridPointInDegrees g2latlon(g2grid,0) : dump;
meta geography.longitudeOfFirstGridPointInDegrees g2latlon(g2grid,1) : dump;
meta geography.latitudeOfLastGridPointInDegrees g2latlon(g2grid,2) : dump;
meta geography.longitudeOfLastGridPointInDegrees g2latlon(g2grid,3) : dump;
alias xFirst=longitudeOfFirstGridPointInDegrees;
alias yFirst=latitudeOfFirstGridPointInDegrees;
alias xLast=longitudeOfLastGridPointInDegrees;
alias yLast=latitudeOfLastGridPointInDegrees;
meta geography.iDirectionIncrementInDegrees g2latlon(g2grid,4,
iDirectionIncrementGiven) : can_be_missing,dump;
meta geography.jDirectionIncrementInDegrees g2latlon(g2grid,5,
jDirectionIncrementGiven) : can_be_missing,dump;
alias latitudeFirstInDegrees = latitudeOfFirstGridPointInDegrees;
alias longitudeFirstInDegrees = longitudeOfFirstGridPointInDegrees;
alias latitudeLastInDegrees = latitudeOfLastGridPointInDegrees;
alias longitudeLastInDegrees = longitudeOfLastGridPointInDegrees;
alias DiInDegrees = iDirectionIncrementInDegrees;
alias DxInDegrees = iDirectionIncrementInDegrees;
alias DjInDegrees = jDirectionIncrementInDegrees;
alias DyInDegrees = jDirectionIncrementInDegrees;
#_if ( missing(Ni) && PLPresent == 1 ) {
# iterator latlon_reduced(numberOfPoints,missingValue,values,
# latitudeFirstInDegrees,longitudeFirstInDegrees,
# latitudeLastInDegrees,longitudeLastInDegrees,
# Nj,DjInDegrees,pl);
# nearest latlon_reduced(values,radius,Nj,pl,longitudeFirstInDegrees,longitudeLastInDegrees);
#} else {
# iterator latlon(numberOfPoints,missingValue,values,
# longitudeFirstInDegrees,DiInDegrees ,
# Ni,Nj,iScansNegatively,
# latitudeFirstInDegrees, DjInDegrees,jScansPositively);
# nearest regular(values,radius,Ni,Nj);
#}
meta latLonValues latlonvalues(values);
alias latitudeLongitudeValues=latLonValues;
meta latitudes latitudes(values,0);
meta longitudes longitudes(values,0);
meta distinctLatitudes latitudes(values,1);
meta distinctLongitudes longitudes(values,1);

View File

@ -0,0 +1,21 @@
# Horizontal Domain Section Template Component 4.2 - Rotation of latitude/longitude coordinates system
# Latitude of the southern pole of projection
signed[4] latitudeOfSouthernPole : no_copy;
alias latitudeOfTheSouthernPoleOfProjection=latitudeOfSouthernPole;
# Longitude of the southern pole of projection
unsigned[4] longitudeOfSouthernPole : no_copy;
alias longitudeOfTheSouthernPoleOfProjection=longitudeOfSouthernPole;
meta geography.latitudeOfSouthernPoleInDegrees scale(latitudeOfSouthernPole,
one,grib3divider,truncateDegrees) : dump;
meta geography.longitudeOfSouthernPoleInDegrees g2lon(longitudeOfSouthernPole) : dump;
# Angle of rotation of projection
ieeefloat angleOfRotation : dump,edition_specific ;
alias geography.angleOfRotationInDegrees=angleOfRotation;
alias angleOfRotationOfProjection=angleOfRotation;
alias is_rotated_grid=one;

View File

@ -0,0 +1,20 @@
# Horizontal Domain Section Template Component 4.3 - Stretching of latitude/longitude coordinates system
label "Stretching information";
# Latitude of the pole of stretching
signed[4] latitudeOfThePoleOfStretching : edition_specific,no_copy;
# Longitude of the pole of stretching
signed[4] longitudeOfThePoleOfStretching : edition_specific,no_copy;
meta geography.latitudeOfStretchingPoleInDegrees
scale(latitudeOfThePoleOfStretching,oneConstant,grib3divider,truncateDegrees) : dump;
meta geography.longitudeOfStretchingPoleInDegrees
scale(longitudeOfThePoleOfStretching,oneConstant,grib3divider,truncateDegrees) : dump;
# Stretching factor
unsigned[4] stretchingFactorScaled : edition_specific,no_copy;
meta geography.stretchingFactor
scale(stretchingFactorScaled,oneConstant,grib3divider) : dump;

View File

@ -0,0 +1,12 @@
# Vertical Coordinate Section Template Component 5.0 - Vertical level
# Type of first fixed surface
codetable[1] typeOfFirstFixedSurface ('5.1.table',masterDir,localDir) : dump,no_copy,edition_specific,string_type;
meta unitsOfFirstFixedSurface codetable_units(typeOfFirstFixedSurface) : dump;
meta nameOfFirstFixedSurface codetable_title(typeOfFirstFixedSurface) : dump;
# Scale factor of first fixed surface
signed[1] scaleFactorOfFirstFixedSurface = missing() : can_be_missing,dump,no_copy,edition_specific;
# Scaled value of first fixed surface
unsigned[4] scaledValueOfFirstFixedSurface = missing() : can_be_missing,dump,no_copy,edition_specific;

View File

@ -0,0 +1,24 @@
# Vertical Coordinate Section Template Component 5.1 - Vertical layer
# Type of first fixed surface
codetable[1] typeOfFirstFixedSurface ('5.1.table',masterDir,localDir) : dump,no_copy,edition_specific,string_type;
meta unitsOfFirstFixedSurface codetable_units(typeOfFirstFixedSurface) : dump;
meta nameOfFirstFixedSurface codetable_title(typeOfFirstFixedSurface) : dump;
# Scale factor of first fixed surface
signed[1] scaleFactorOfFirstFixedSurface = missing() : can_be_missing,dump,no_copy,edition_specific;
# Scaled value of first fixed surface
unsigned[4] scaledValueOfFirstFixedSurface = missing() : can_be_missing,dump,no_copy,edition_specific;
# Type of second fixed surface
codetable[1] typeOfSecondFixedSurface ('5.1.table',masterDir,localDir) = 255 : dump,no_copy,edition_specific;
meta unitsOfSecondFixedSurface codetable_units(typeOfSecondFixedSurface) : dump;
meta nameOfSecondFixedSurface codetable_title(typeOfSecondFixedSurface) : dump;
# Scale factor of second fixed surface
signed[1] scaleFactorOfSecondFixedSurface = missing() : can_be_missing,dump,no_copy,edition_specific;
# Scaled value of second fixed surface
unsigned[4] scaledValueOfSecondFixedSurface = missing() : can_be_missing,dump,no_copy,edition_specific;

View File

@ -0,0 +1,8 @@
# Generating Process Section Template Component 6.0 - Process type and identifier
# Type of generating process
codetable[1] typeOfGeneratingProcess ('6.1.table',masterDir,localDir) : dump;
# Analysis or forecast generating processes identifier
# (managed by the originating centre)
unsigned[1] generatingProcessIdentifier : dump;

View File

@ -0,0 +1,5 @@
# Generating Process Section Template Component 6.1 - Ensemble size
# Number of members in ensemble
unsigned[2] numberOfMembersInEnsemble : dump;
alias totalNumber=numberOfMembersInEnsemble;

View File

@ -0,0 +1,9 @@
# Generating Process Section Template Component 6.2 - Ensemble member
# Type of ensemble member
codetable[1] typeOfEnsembleMember ('6.2.table',masterDir,localDir) = 255 : dump;
# Member (Perturbation) number
unsigned[2] memberNumber : dump;
alias perturbationNumber=memberNumber
alias number=memberNumber;

View File

@ -0,0 +1,3 @@
# Generating Process Section Template Component 6.3 - Statistical post-processing of all ensemble members
codetable[1] typeOfStatisticalPostProcessingOfEnsembleMembers ('6.3.table',masterDir,localDir) = 255 : dump;

View File

@ -0,0 +1,13 @@
# Observable Property Section Template Component 7.0 - Observable property by discipline, category and number
# Parameter Discipline
codetable[1] parameterDiscipline('7.1.table',masterDir,localDir) : dump;
alias discipline = parameterDiscipline;
# Parameter category
codetable[1] parameterCategory ('7.2.[discipline:l].table',masterDir,localDir) : dump;
# Parameter number
codetable[2] parameterNumber ('7.3.[discipline:l].[parameterCategory:l].table',masterDir,localDir) : dump;
meta parameterUnits codetable_units(parameterNumber) : dump;
meta parameterName codetable_title(parameterNumber) : dump;

View File

@ -0,0 +1,13 @@
# Observable Property Section Template Component 7.1 - Units conversion
ieeefloat unitsConversionScaleFactor : dump, edition_specific,no_copy;
ieeefloat unitsConversionOffset : dump, edition_specific,no_copy;
alias ucs = unitsConversionScaleFactor;
alias uco = unitsConversionOffset;
# Notes:
# Units conversion scale factor (ucs) and offset (uco) shall be used to encode fields in units different
# from the units reported in table 7.3.
# If the values encoded in the GRIB message are 've', then the values 'v' in the units provided in table 7.3
# shall be: v = ucs*ve + uco

View File

@ -0,0 +1,5 @@
# Observable Property Section Template Component 7.2 - Chemical or physical constituents
# Common code table C-14
codetable[2] atmosphericChemicalOrPhysicalConstituentType ('7.230.table',masterDir,localDir) : dump;
alias constituentType=atmosphericChemicalOrPhysicalConstituentType;

View File

@ -0,0 +1,9 @@
# Observable Property Section Template Component 7.3 - Aerosol size
codetable[1] typeOfSizeInterval ('7.4.table',masterDir,localDir) : dump;
alias typeOfIntervalForFirstAndSecondSize=typeOfSizeInterval;
signed[1] scaleFactorOfFirstSize : dump;
signed[4] scaledValueOfFirstSize :dump; # in metres
signed[1] scaleFactorOfSecondSize = missing() : can_be_missing,dump;
signed[4] scaledValueOfSecondSize = missing() : can_be_missing,dump; # in metres

View File

@ -0,0 +1,10 @@
# Observable Property Section Template Component 7.4 - Radiation wavelength interval
codetable[1] typeOfWavelengthInterval ('7.4.table',masterDir,localDir) : dump;
alias typeOfIntervalForFirstAndSecondWavelength=typeOfWavelengthInterval;
# wavelengths in metres
signed[1] scaleFactorOfFirstWavelength : dump;
signed[4] scaledValueOfFirstWavelength : dump; # in metres
signed[1] scaleFactorOfSecondWavelength = missing(): can_be_missing,dump;
signed[4] scaledValueOfSecondWavelength = missing(): can_be_missing,dump; # in metres