From f2e980eb3c5e34d01fbc8ff30df3767609b472e1 Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Tue, 12 Nov 2019 14:56:40 +0000 Subject: [PATCH] Cleanup --- definitions/grib1/section.4.def | 19 ++++++++----------- ...rib_accessor_class_g1_half_byte_codeflag.c | 7 ++----- 2 files changed, 10 insertions(+), 16 deletions(-) diff --git a/definitions/grib1/section.4.def b/definitions/grib1/section.4.def index 8c8d54fa6..b9f8560e3 100644 --- a/definitions/grib1/section.4.def +++ b/definitions/grib1/section.4.def @@ -1,6 +1,5 @@ -# START grib1::section -# SECTION 4, Binary data section -# Length of section +# GRIB1 SECTION 4, Binary data section +# Length of section position offsetSection4; # Due to a trick done by GRIBEX to support large GRIBs, we need a special treatment @@ -125,9 +124,8 @@ alias ls.packingType=packingType; alias typeOfPacking=packingType; if( binaryScaleFactor == -32767) { - -unsigned[1] bitsPerValue : dump ; -alias numberOfBitsContainingEachPackedValue = bitsPerValue; + unsigned[1] bitsPerValue : dump ; + alias numberOfBitsContainingEachPackedValue = bitsPerValue; constant dataRepresentationTemplateNumber = 0; constant bitMapIndicator = 0; @@ -148,8 +146,8 @@ alias numberOfBitsContainingEachPackedValue = bitsPerValue; decimalScaleFactor, optimizeScaleFactor, halfByte, - packingType, - grid_ieee,precision, + packingType, + grid_ieee,precision, missingValue, numberOfPoints, bitmap @@ -169,7 +167,7 @@ if (bitmapPresent==1) { } _if (sphericalHarmonics) { - alias numberOfEffectiveValues=numberOfValues; + alias numberOfEffectiveValues=numberOfValues; } meta changeDecimalPrecision decimal_precision(bitsPerValue,decimalScaleFactor,changingPrecision,values) : edition_specific; @@ -220,7 +218,6 @@ concept gridType { "regular_stretched_gg" = { dataRepresentationType = 24; sphericalHarmonics = 0; PLPresent=0; } # = stretched_gg "regular_stretched_rotated_gg" = { dataRepresentationType = 34; sphericalHarmonics = 0; PLPresent=0; } # = stretched_rotated_gg - "sh" = {dataRepresentationType = 50; sphericalHarmonics = 1; PLPresent=0; } "rotated_sh" = {dataRepresentationType = 60; sphericalHarmonics = 1; PLPresent=0; } "stretched_sh" = {dataRepresentationType = 70; sphericalHarmonics = 1; PLPresent=0; } @@ -237,7 +234,7 @@ alias typeOfGrid=gridType; meta getNumberOfValues size(values) : edition_specific,dump ; if (complexPacking==0 || sphericalHarmonics==1) { - padtoeven padding_sec4_1(offsetSection4,section4Length) ; + padtoeven padding_sec4_1(offsetSection4,section4Length) ; } meta md5Section4 md5(offsetSection4,section4Length); diff --git a/src/grib_accessor_class_g1_half_byte_codeflag.c b/src/grib_accessor_class_g1_half_byte_codeflag.c index bf4bfbb8e..acd0b6af6 100644 --- a/src/grib_accessor_class_g1_half_byte_codeflag.c +++ b/src/grib_accessor_class_g1_half_byte_codeflag.c @@ -142,9 +142,8 @@ static void dump(grib_accessor* a, grib_dumper* dumper) grib_dump_long(dumper,a,NULL); } -static int unpack_long (grib_accessor* a, long* val, size_t *len) +static int unpack_long(grib_accessor* a, long* val, size_t *len) { - unsigned char dat = 0; if(*len < 1) { @@ -154,13 +153,12 @@ static int unpack_long (grib_accessor* a, long* val, size_t *len) } dat = grib_handle_of_accessor(a)->buffer->data[a->offset] & 0x0f; - *val = dat; *len = 1; return GRIB_SUCCESS; } -static int pack_long (grib_accessor* a, const long *val, size_t *len) +static int pack_long(grib_accessor* a, const long *val, size_t *len) { int ret = 0; if(*len < 1) @@ -207,4 +205,3 @@ static int compare(grib_accessor* a,grib_accessor* b) { if (bval != aval) return GRIB_VALUE_MISMATCH; return GRIB_SUCCESS; } -