ECC-789: GRIB: spectral_complex to spectral_simple conversion

This commit is contained in:
Shahram Najm 2022-04-01 15:33:04 +01:00
parent 6aa02e5d63
commit f9b4420bdf
2 changed files with 11 additions and 7 deletions

View File

@ -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;

View File

@ -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;
}