ECC-1530: grib_util_set_spec: Input packing type of grid_second_order changed to grid_simple

This commit is contained in:
Shahram Najm 2023-02-17 13:50:44 +00:00
parent 9b97ad3066
commit 1db0f4fc6f
2 changed files with 20 additions and 9 deletions

View File

@ -982,8 +982,8 @@ grib_handle* grib_util_set_spec2(grib_handle* h,
fprintf(stderr, "ECCODES DEBUG grib_util: input_decimal_scale_factor = %ld\n", input_decimal_scale_factor); fprintf(stderr, "ECCODES DEBUG grib_util: input_decimal_scale_factor = %ld\n", input_decimal_scale_factor);
} }
/* ECC-1201 /* ECC-1201, ECC-1529, ECC-1530
TODO: make sure input packing type is preserved */ Make sure input packing type is preserved */
if (packing_spec->packing == GRIB_UTIL_PACKING_SAME_AS_INPUT && if (packing_spec->packing == GRIB_UTIL_PACKING_SAME_AS_INPUT &&
packing_spec->packing_type == GRIB_UTIL_PACKING_TYPE_SAME_AS_INPUT) packing_spec->packing_type == GRIB_UTIL_PACKING_TYPE_SAME_AS_INPUT)
{ {
@ -993,6 +993,9 @@ grib_handle* grib_util_set_spec2(grib_handle* h,
if (STR_EQUAL(input_packing_type, "grid_ccsds")) { if (STR_EQUAL(input_packing_type, "grid_ccsds")) {
setCcsdsPacking = 1; setCcsdsPacking = 1;
} }
if (STR_EQUAL(input_packing_type, "grid_second_order")) {
setSecondOrder = 1;
}
} }
/*if ( (*err=check_values(data_values, data_values_count))!=GRIB_SUCCESS ) { /*if ( (*err=check_values(data_values, data_values_count))!=GRIB_SUCCESS ) {

View File

@ -104,17 +104,25 @@ ${tools_dir}/grib_get_data $outfile > /dev/null
# CCSDS input # CCSDS input
# --------------------------- # ---------------------------
infile=${data_dir}/ccsds.grib2 if [ $HAVE_AEC -eq 1 ]; then
$EXEC $grib_util_set_spec $infile $outfile infile=${data_dir}/ccsds.grib2
grib_check_key_equals $outfile packingType grid_ccsds $EXEC $grib_util_set_spec $infile $outfile
grib_check_key_equals $outfile packingType grid_ccsds
$EXEC $grib_util_set_spec -p grid_simple $infile $outfile $EXEC $grib_util_set_spec -p grid_simple $infile $outfile
grib_check_key_equals $outfile packingType grid_simple grib_check_key_equals $outfile packingType grid_simple
$EXEC $grib_util_set_spec -p grid_second_order $infile $outfile $EXEC $grib_util_set_spec -p grid_second_order $infile $outfile
grib_check_key_equals $outfile packingType grid_second_order
fi
# Second order input
# ---------------------------
${tools_dir}/grib_set -r -s packingType=grid_second_order ${data_dir}/sample.grib2 $tempOut
grib_check_key_equals $tempOut packingType grid_second_order
$EXEC $grib_util_set_spec $tempOut $outfile
grib_check_key_equals $outfile packingType grid_second_order grib_check_key_equals $outfile packingType grid_second_order
### Clean up ### Clean up
rm -f $outfile $tempOut rm -f $outfile $tempOut
rm -f error.data rm -f error.data