diff --git a/definitions/grib2/template.7.50.def b/definitions/grib2/template.7.50.def index a905f224b..60dcddd12 100644 --- a/definitions/grib2/template.7.50.def +++ b/definitions/grib2/template.7.50.def @@ -10,7 +10,7 @@ transient numberOfPackedValues = numberOfValues - 1 : no_copy; transient numberOfValues = ( J + 1 ) * ( J + 2 ) : no_copy ; transient numberOfPackedValues = numberOfValues - 1 : no_copy; - meta codedValues data_g2simple_packing( +meta codedValues data_g2simple_packing( section7Length, offsetBeforeData, offsetSection7, @@ -22,14 +22,13 @@ transient numberOfPackedValues = numberOfValues - 1 : no_copy; referenceValue, binaryScaleFactor, decimalScaleFactor, - optimizeScaleFactor - ) : read_only; + optimizeScaleFactor) : read_only; - meta values data_g2shsimple_packing( +meta values data_g2shsimple_packing( codedValues, realPartOf00, - numberOfValues - ) ; + numberOfValues, + numberOfDataPoints); meta packingError simple_packing_error(bitsPerValue,binaryScaleFactor,decimalScaleFactor,referenceValue,ieee) : no_copy; meta unpackedError simple_packing_error(zero,binaryScaleFactor,decimalScaleFactor,referenceValue,ieee) : no_copy; diff --git a/src/grib_accessor_class_data_g2shsimple_packing.c b/src/grib_accessor_class_data_g2shsimple_packing.c index 497b188d0..b735be0de 100644 --- a/src/grib_accessor_class_data_g2shsimple_packing.c +++ b/src/grib_accessor_class_data_g2shsimple_packing.c @@ -21,6 +21,7 @@ IMPLEMENTS = pack_double IMPLEMENTS = value_count MEMBERS=const char* numberOfValues + MEMBERS=const char* numberOfDataPoints END_CLASS_DEF */ @@ -50,6 +51,7 @@ typedef struct grib_accessor_data_g2shsimple_packing int dirty; /* Members defined in data_g2shsimple_packing */ const char* numberOfValues; + const char* numberOfDataPoints; } grib_accessor_data_g2shsimple_packing; extern grib_accessor_class* grib_accessor_class_data_shsimple_packing; @@ -140,7 +142,8 @@ static void init(grib_accessor* a, const long v, grib_arguments* args) { grib_accessor_data_g2shsimple_packing* self = (grib_accessor_data_g2shsimple_packing*)a; - self->numberOfValues = grib_arguments_get_name(grib_handle_of_accessor(a), args, 2); + self->numberOfValues = grib_arguments_get_name(grib_handle_of_accessor(a), args, 2); + self->numberOfDataPoints = grib_arguments_get_name(grib_handle_of_accessor(a), args, 3); a->flags |= GRIB_ACCESSOR_FLAG_DATA; } @@ -214,6 +217,8 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len) if ((err = grib_set_long_internal(grib_handle_of_accessor(a), self->numberOfValues, (long)n_vals)) != GRIB_SUCCESS) return err; + if ((err = grib_set_long_internal(grib_handle_of_accessor(a), self->numberOfDataPoints, (long)n_vals)) != GRIB_SUCCESS) + return err; return err; }