Set packingType=grid_ieee via grib_util_set_spec (experimental)

This commit is contained in:
Pedro Maciel 2020-07-14 14:35:04 +01:00
parent 1a260c942b
commit bb5c00de5a
4 changed files with 12 additions and 0 deletions

View File

@ -1253,6 +1253,7 @@ int codes_points_get_values(codes_handle* h, codes_points* points, double* val);
#define CODES_UTIL_PACKING_TYPE_GRID_SIMPLE_MATRIX GRIB_UTIL_PACKING_TYPE_GRID_SIMPLE_MATRIX
#define CODES_UTIL_PACKING_TYPE_GRID_SECOND_ORDER GRIB_UTIL_PACKING_TYPE_GRID_SECOND_ORDER
#define CODES_UTIL_PACKING_TYPE_CCSDS GRIB_UTIL_PACKING_TYPE_CCSDS
#define CODES_UTIL_PACKING_TYPE_IEEE GRIB_UTIL_PACKING_TYPE_IEEE
#define CODES_UTIL_PACKING_SAME_AS_INPUT GRIB_UTIL_PACKING_SAME_AS_INPUT
#define CODES_UTIL_PACKING_USE_PROVIDED GRIB_UTIL_PACKING_USE_PROVIDED

View File

@ -1522,6 +1522,7 @@ typedef struct grib_util_grid_spec2
#define GRIB_UTIL_PACKING_TYPE_GRID_SIMPLE_MATRIX 6
#define GRIB_UTIL_PACKING_TYPE_GRID_SECOND_ORDER 7
#define GRIB_UTIL_PACKING_TYPE_CCSDS 8
#define GRIB_UTIL_PACKING_TYPE_IEEE 9
#define GRIB_UTIL_PACKING_SAME_AS_INPUT 0
#define GRIB_UTIL_PACKING_USE_PROVIDED 1

View File

@ -974,6 +974,10 @@ grib_handle* grib_util_set_spec2(grib_handle* h,
if (strcmp(input_packing_type, "grid_ccsds") && !strcmp(input_packing_type, "grid_simple"))
SET_STRING_VALUE("packingType", "grid_ccsds");
break;
case GRIB_UTIL_PACKING_TYPE_IEEE:
if (strcmp(input_packing_type, "grid_ieee") && !strcmp(input_packing_type, "grid_simple"))
SET_STRING_VALUE("packingType", "grid_ieee");
break;
case GRIB_UTIL_PACKING_TYPE_GRID_SECOND_ORDER:
/* we delay the set of grid_second_order because we don't want
to do it on a field with bitsPerValue=0 */
@ -1402,6 +1406,10 @@ grib_handle* grib_util_set_spec2(grib_handle* h,
if (strcmp(input_packing_type, "grid_ccsds") && !strcmp(input_packing_type, "grid_simple"))
setCcsdsPacking = 1;
break;
case GRIB_UTIL_PACKING_TYPE_IEEE:
if (strcmp(input_packing_type, "grid_ieee") && !strcmp(input_packing_type, "grid_simple"))
SET_STRING_VALUE("packingType", "grid_ieee");
break;
case GRIB_UTIL_PACKING_TYPE_GRID_SECOND_ORDER:
/* we delay the set of grid_second_order because we don't want
to do it on a field with bitsPerValue=0 */

View File

@ -28,6 +28,8 @@ static int get_packing_type_code(const char* packingType)
result = GRIB_UTIL_PACKING_TYPE_GRID_SIMPLE;
else if (STR_EQUAL(packingType, "grid_second_order"))
result = GRIB_UTIL_PACKING_TYPE_GRID_SECOND_ORDER;
else if (STR_EQUAL(packingType, "grid_ieee"))
result = GRIB_UTIL_PACKING_TYPE_IEEE;
return result;
}