ECC-1081: 'level' is not edition-independent for potential vorticity levels

This commit is contained in:
Shahram Najm 2023-02-06 12:16:17 +00:00
parent ffe6168aba
commit 3800ad4988
3 changed files with 19 additions and 0 deletions

View File

@ -112,6 +112,10 @@ if( indicatorOfTypeOfLevel == 109 ||
{
alias mars.levelist = level;
}
if (indicatorOfTypeOfLevel == 117) {
# See ECC-1081
constant levelFactor = 6;
}
unsigned[1] yearOfCentury : edition_specific;
unsigned[1] month;

View File

@ -292,6 +292,7 @@ static int pack_long(grib_accessor* a, const long* val, size_t* len)
long value_first = *val;
long scale_first = 0;
long type_first = 0;
long levelFactor = 1;
char pressure_units[10] = {0,};
size_t pressure_units_len = 10;
@ -324,6 +325,13 @@ static int pack_long(grib_accessor* a, const long* val, size_t* len)
if (!strcmp(pressure_units, "hPa"))
value_first *= 100;
break;
case 109:
//printf("type1 = 109\n");
if ((ret = grib_get_long(hand, "levelFactor", &levelFactor)) == GRIB_SUCCESS) {
// See ECC-1081
// printf(" Special case - change scale_first to %ld\n", levelFactor);
scale_first = levelFactor;
}
default:
break;

View File

@ -82,6 +82,13 @@ ${tools_dir}/grib_set -s scaledValueOfFirstFixedSurface=15,scaleFactorOfFirstFix
res=`${tools_dir}/grib_get -p level:d $temp`
[ "$res" = "1.5" ]
# ECC-1081: 'level' is not edition-independent for potential vorticity levels
${tools_dir}/grib_set -s typeOfLevel=potentialVorticity,shortName=q,level=1500 $sample_g1 $temp
${tools_dir}/grib_set -s edition=2 $temp $temp2
grib_check_key_equals $temp2 'mars.levelist,level,typeOfLevel' '1500 1500 potentialVorticity'
grib_check_key_equals $temp2 'scaleFactorOfFirstFixedSurface,scaledValueOfFirstFixedSurface' '6 1500'
# GRIB-637 grib2 Potential vorticity surface
input=${data_dir}/tigge_pf_ecmwf.grib2
res=`${tools_dir}/grib_get -wcount=7 -F%.20f -p level:d $input`