diff --git a/definitions/grib1/localConcepts/ecmf/stepType.def b/definitions/grib1/localConcepts/ecmf/stepType.def index ae1d35b3b..d8d56f2a4 100644 --- a/definitions/grib1/localConcepts/ecmf/stepType.def +++ b/definitions/grib1/localConcepts/ecmf/stepType.def @@ -32,8 +32,3 @@ "avgas" = {timeRangeIndicator=128;} "avgad" = {timeRangeIndicator=130;} "avgid" = {timeRangeIndicator=133;} - - -# ECC-457: ECMWF Total Precipitation -"accum" = {timeRangeIndicator=0;indicatorOfParameter=228;gribTablesVersionNo=128;centre=98;} -"accum" = {timeRangeIndicator=1;indicatorOfParameter=228;gribTablesVersionNo=128;centre=98;} diff --git a/definitions/grib1/localConcepts/ecmf/stepTypeForConversion.def b/definitions/grib1/localConcepts/ecmf/stepTypeForConversion.def new file mode 100644 index 000000000..5b370d16e --- /dev/null +++ b/definitions/grib1/localConcepts/ecmf/stepTypeForConversion.def @@ -0,0 +1,7 @@ +# Concept stepTypeForConversion for ECMWF +# set uses the FIRST one +# get returns the LAST match + +# ECC-457: ECMWF Total Precipitation +"accum" = {timeRangeIndicator=0;indicatorOfParameter=228;gribTablesVersionNo=128;centre=98;} +"accum" = {timeRangeIndicator=1;indicatorOfParameter=228;gribTablesVersionNo=128;centre=98;} diff --git a/definitions/grib1/section.1.def b/definitions/grib1/section.1.def index 062dc81c3..5a48e3ebb 100644 --- a/definitions/grib1/section.1.def +++ b/definitions/grib1/section.1.def @@ -92,26 +92,25 @@ if ( indicatorOfTypeOfLevel == 101 or } else { - unsigned[2] level : can_be_missing,dump; - if (indicatorOfTypeOfLevel == 210) { - meta marsLevel scale(level,oneConstant,hundred) : read_only; - alias mars.levelist = marsLevel; - } - alias vertical.level=level; - alias vertical.topLevel = level; - alias vertical.bottomLevel = level; - alias ls.level=level; - alias lev=level; - + unsigned[2] level : can_be_missing,dump; + if (indicatorOfTypeOfLevel == 210) { + meta marsLevel scale(level,oneConstant,hundred) : read_only; + alias mars.levelist = marsLevel; + } + alias vertical.level=level; + alias vertical.topLevel = level; + alias vertical.bottomLevel = level; + alias ls.level=level; + alias lev=level; } -if( indicatorOfTypeOfLevel == 109 || - indicatorOfTypeOfLevel == 100 || - indicatorOfTypeOfLevel == 110 || - indicatorOfTypeOfLevel == 113 || - indicatorOfTypeOfLevel == 117) +if( indicatorOfTypeOfLevel == 109 || + indicatorOfTypeOfLevel == 100 || + indicatorOfTypeOfLevel == 110 || + indicatorOfTypeOfLevel == 113 || + indicatorOfTypeOfLevel == 117) { - alias mars.levelist = level; + alias mars.levelist = level; } unsigned[1] yearOfCentury : edition_specific ; @@ -144,9 +143,9 @@ codetable[1] subCentre 'grib1/0.[centre].table' : dump; if(table2Version >= 128) { _if (centre != 98 && subCentre == 98) { alias centreForTable2 = subCentre; -} else { + } else { alias centreForTable2 = centre; -} + } } else { alias centreForTable2 = WMO; } @@ -178,15 +177,15 @@ transient setLocalDefinition= 0 : no_copy; # Try different values of binaryScaleFactor and decimalScaleFactor to reduce packing error transient optimizeScaleFactor = 0; -meta dataDate g1date(centuryOfReferenceTimeOfData,yearOfCentury,month,day) : dump; -meta year evaluate(dataDate / 10000) ; +meta dataDate g1date(centuryOfReferenceTimeOfData,yearOfCentury,month,day) : dump; +meta year evaluate(dataDate / 10000) ; meta dataTime time(hour,minute,second) : dump; meta julianDay julian_day(dataDate,hour,minute,second) : edition_specific; codetable[1] stepUnits 'stepUnits.table' = 1 : transient,dump,no_copy; -concept_nofail stepType (timeRangeIndicator, "stepType.def", conceptsMasterDir, conceptsLocalDirAll) +concept_nofail stepType (timeRangeIndicator, "stepType.def", conceptsMasterDir, conceptsLocalDirAll); #alias stepTypeInternal=stepType; #alias lengthOfTimeRange=numberIncludedInAverage; @@ -195,18 +194,18 @@ concept_nofail stepType (timeRangeIndicator, "stepType.def", conceptsMasterDir, #alias timeIncrement=zero; #if (timeRangeIndicator==113) { -# alias lengthOfTimeRange=numberIncludedInAverage; -# alias indicatorOfUnitForTimeRange=unitOfTimeRange; -# alias indicatorOfUnitForTimeIncrement=unitOfTimeRange; -# alias timeIncrement=P2; -# alias forecastTime=P1; +# alias lengthOfTimeRange=numberIncludedInAverage; +# alias indicatorOfUnitForTimeRange=unitOfTimeRange; +# alias indicatorOfUnitForTimeIncrement=unitOfTimeRange; +# alias timeIncrement=P2; +# alias forecastTime=P1; #} #if (stepType is "accum") { -# transient accumulationRange=P2-P1; -# alias lengthOfTimeRange=accumulationRange; -# alias forecastTime=P1; -# alias indicatorOfUnitForTimeRange=unitOfTimeRange; +# transient accumulationRange=P2-P1; +# alias lengthOfTimeRange=accumulationRange; +# alias forecastTime=P1; +# alias indicatorOfUnitForTimeRange=unitOfTimeRange; #} #conversion 1->2 @@ -262,21 +261,20 @@ if(((section1Length > 40) or new() or setLocalDefinition> 0) and deleteLocalDefi } } - template_nofail marsKeywords "mars/grib.[stream:s].[type:s].def"; - #template marsKeywords "mars/grib.[stream:s].[type:s].def"; + template_nofail marsKeywords "mars/grib.[stream:s].[type:s].def"; + #template marsKeywords "mars/grib.[stream:s].[type:s].def"; } else - { - if ( !new() || setLocalDefinition ) { - # Other centres - pad reservedNeedNotBePresent(12); - template_nofail localDefinition "grib1/local.[centre:l].def"; + { + if ( !new() || setLocalDefinition ) { + # Other centres + pad reservedNeedNotBePresent(12); + template_nofail localDefinition "grib1/local.[centre:l].def"; - section_padding localExtensionPadding : read_only; - } + section_padding localExtensionPadding : read_only; + } } - } else { @@ -311,4 +309,10 @@ alias time.startStep=startStep; alias time.endStep=endStep; alias time.stepType=stepType; +# ECC-457: GRIB1 to GRIB2 conversion +concept_nofail stepTypeForConversion (unknown, "stepTypeForConversion.def", conceptsMasterDir, conceptsLocalDirAll); +if (stepTypeForConversion is "accum" ) { + alias productDefinitionTemplateNumber=eight; +} + meta md5Section1 md5(offsetSection1,section1Length); diff --git a/definitions/grib1/stepTypeForConversion.def b/definitions/grib1/stepTypeForConversion.def new file mode 100644 index 000000000..c8b68e6cd --- /dev/null +++ b/definitions/grib1/stepTypeForConversion.def @@ -0,0 +1,3 @@ +# Concept stepTypeForConversion +# See ECC-457 +"unknown" = {dummy=0;} diff --git a/tests/grib_step.sh b/tests/grib_step.sh index 8c4c7625d..22f18920b 100755 --- a/tests/grib_step.sh +++ b/tests/grib_step.sh @@ -94,6 +94,10 @@ ${tools_dir}/grib_set -s indicatorOfUnitOfTimeRange=m $grib2_sample $temp unit=`${tools_dir}/grib_get -p indicatorOfUnitOfTimeRange $temp` [ "$unit" = "0" ] +# ECC-457 +input=${data_dir}/tp_ecmwf.grib +stepRange=`${tools_dir}/grib_get -w count=1 -p stepRange,startStep,endStep,stepType $input` +[ "$stepRange" = "12 12 12 instant" ] + rm -f $temp rm -f $grib2File.p8tmp ${grib2File}.tmp x.grib -