GRIB-363: grib_filter: cannot convert to grib2 and set typeOfFirstFixedSurface=150

This commit is contained in:
Shahram Najm 2013-05-08 11:53:09 +01:00
parent 32900991ac
commit 91c38a8094
3 changed files with 20 additions and 5 deletions

View File

@ -49,16 +49,16 @@ transient genVertHeightCoords = 0;
if (defined(typeOfFirstFixedSurface)) { if (defined(typeOfFirstFixedSurface)) {
if (typeOfFirstFixedSurface == 150) { if (typeOfFirstFixedSurface == 150) {
transient genVertHeightCoords = 1; transient genVertHeightCoords = 1;
transient PVPresent = 0;
ieeefloat nlev : dump ;
ieeefloat numberOfVGridUsed : dump;
byte[16] uuidOfVGrid : dump;
} }
} }
if (genVertHeightCoords) { if (genVertHeightCoords) {
# Generalized vertical height coordinate case # Generalized vertical height coordinate case
transient PVPresent = 0;
ieeefloat nlev : dump ;
alias numberOfVerticalCoordinateValues = nlev ; alias numberOfVerticalCoordinateValues = nlev ;
ieeefloat numberOfVGridUsed : dump;
byte[16] uuidOfVGrid : dump;
} }
else { else {
if (NV == 0){ if (NV == 0){

View File

@ -58,5 +58,20 @@ EOF
result=`${tools_dir}/grib_filter ${data_dir}/formatint.rules $GRIB_SAMPLES_PATH/GRIB1.tmpl` result=`${tools_dir}/grib_filter ${data_dir}/formatint.rules $GRIB_SAMPLES_PATH/GRIB1.tmpl`
[ "$result" = "edition=001, level= 500" ] [ "$result" = "edition=001, level= 500" ]
# Convert from grib1 to grib2 "Generalized vertical height coordinates"
cat >temp.filt <<EOF
set edition=2;
set PVPresent=1;
set NV=6;
set typeOfFirstFixedSurface=150;
set nlev=41.0;
write;
EOF
${tools_dir}/grib_filter -o temp.grib2 temp.filt $GRIB_SAMPLES_PATH/GRIB1.tmpl
result=`${tools_dir}/grib_get -p typeOfFirstFixedSurface,NV,nlev temp.grib2`
[ "$result" = "150 6 41" ]
rm -f temp.grib2 temp.filt
rm -f ${data_dir}/formatint.rules rm -f ${data_dir}/formatint.rules

View File

@ -70,7 +70,7 @@ do
${tools_dir}grib_set -s edition=2 loc1.grib1 loc1.grib2 ${tools_dir}grib_set -s edition=2 loc1.grib1 loc1.grib2
${tools_dir}grib_get -p localDefinitionNumber loc1.grib1 >> local.log ${tools_dir}grib_get -p localDefinitionNumber loc1.grib1 >> local.log
${tools_dir}grib_get -p localDefinitionNumber loc1.grib2 >> local.log ${tools_dir}grib_get -p localDefinitionNumber loc1.grib2 >> local.log
for localEps in 1 15 26 30 for localEps in 1 15 26 30
do do
${tools_dir}grib_set -s localDefinitionNumber=$localEps,eps=1,perturbationNumber=2,numberOfForecastsInEnsemble=50 loc1.grib2 eps.grib2 ${tools_dir}grib_set -s localDefinitionNumber=$localEps,eps=1,perturbationNumber=2,numberOfForecastsInEnsemble=50 loc1.grib2 eps.grib2