grib_util_set_spec: input grid_ccsds gets converted to grid_simple

This commit is contained in:
Shahram Najm 2023-02-16 18:29:32 +00:00
parent bc83ac61fc
commit 1ee583a7c9
2 changed files with 19 additions and 5 deletions

View File

@ -17,11 +17,11 @@ static int get_packing_type_code(const char* packingType)
{
int result = GRIB_UTIL_PACKING_TYPE_GRID_SIMPLE;
if (packingType == NULL)
return result;
return GRIB_UTIL_PACKING_TYPE_SAME_AS_INPUT;
if (STR_EQUAL(packingType, "grid_jpeg"))
result = GRIB_UTIL_PACKING_TYPE_JPEG;
if (STR_EQUAL(packingType, "grid_ccsds"))
else if (STR_EQUAL(packingType, "grid_ccsds"))
result = GRIB_UTIL_PACKING_TYPE_CCSDS;
else if (STR_EQUAL(packingType, "grid_simple"))
result = GRIB_UTIL_PACKING_TYPE_GRID_SIMPLE;
@ -90,7 +90,10 @@ static void test_reduced_gg(int remove_local_def, int edition, const char* packi
packing_spec.packing_type = get_packing_type_code(packingType);
packing_spec.bitsPerValue = 24;
packing_spec.accuracy = GRIB_UTIL_ACCURACY_USE_PROVIDED_BITS_PER_VALUES;
if (packingType)
packing_spec.packing = GRIB_UTIL_PACKING_USE_PROVIDED;
else
packing_spec.packing = GRIB_UTIL_PACKING_SAME_AS_INPUT;
/*Extra settings
packing_spec.extra_settings_count++;
@ -201,7 +204,10 @@ static void test_regular_ll(int remove_local_def, int edition, const char* packi
packing_spec.packing_type = get_packing_type_code(packingType);
packing_spec.bitsPerValue = 24;
packing_spec.accuracy = GRIB_UTIL_ACCURACY_USE_PROVIDED_BITS_PER_VALUES;
if (packingType)
packing_spec.packing = GRIB_UTIL_PACKING_USE_PROVIDED;
else
packing_spec.packing = GRIB_UTIL_PACKING_SAME_AS_INPUT;
packing_spec.extra_settings_count++;
packing_spec.extra_settings[0].type = GRIB_TYPE_LONG;

View File

@ -14,13 +14,21 @@
# --------------------------------------------------
# Regular Lat/Lon Grid
# --------------------------------------------------
infile=../data/latlon.grib
infile=${data_dir}/latlon.grib
outfile=out.grib_util_set_spec.grib
tempOut=temp.grib_util_set_spec.grib
grib_util_set_spec=${test_dir}/grib_util_set_spec
rm -f $outfile
# CCSDS input
$EXEC $grib_util_set_spec ${data_dir}/ccsds.grib2 $outfile > /dev/null
grib_check_key_equals $outfile packingType grid_ccsds
$EXEC $grib_util_set_spec -p grid_simple ${data_dir}/ccsds.grib2 $outfile > /dev/null
grib_check_key_equals $outfile packingType grid_simple
# GRIB1 with local definition for MARS. Convert to edition2 and remove local def
$EXEC $grib_util_set_spec -e 2 -r $infile $outfile > /dev/null