Created
May 12, 2016 15:25
-
-
Save erget/9664a4307f1ed9092675faee47cbd6df to your computer and use it in GitHub Desktop.
Patch for ecCodes / GRIB API for correct CCSDS encoding
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/definitions/grib2/template.5.42.def b/definitions/grib2/template.5.42.def | |
index 21bcb3e..f8e9229 100644 | |
--- a/definitions/grib2/template.5.42.def | |
+++ b/definitions/grib2/template.5.42.def | |
@@ -15,7 +15,7 @@ include "grib2/template.5.original_values.def"; | |
unsigned[1] ccsdsFlags : dump; | |
flagbit AEC_DATA_SIGNED_OPTION_MASK(ccsdsFlags,0) = 0; | |
-flagbit AEC_DATA_3BYTE_OPTION_MASK(ccsdsFlags,1) = 0; | |
+flagbit AEC_DATA_3BYTE_OPTION_MASK(ccsdsFlags,1) = 1; | |
flagbit AEC_DATA_MSB_OPTION_MASK(ccsdsFlags,2) = 1; | |
flagbit AEC_DATA_PREPROCESS_OPTION_MASK(ccsdsFlags,3) = 1; | |
flagbit AEC_RESTRICTED_OPTION_MASK(ccsdsFlags,4) = 0; | |
diff --git a/src/grib_accessor_class_data_ccsds_packing.c b/src/grib_accessor_class_data_ccsds_packing.c | |
index 00f7d96..c97fe1f 100644 | |
--- a/src/grib_accessor_class_data_ccsds_packing.c | |
+++ b/src/grib_accessor_class_data_ccsds_packing.c | |
@@ -275,7 +275,7 @@ static int unpack_double(grib_accessor* a, double* val, size_t *len) | |
*/ | |
bits8 = ((bits_per_value + 7)/8)*8; | |
- size = n_vals * (bits_per_value + 7)/8; | |
+ size = n_vals * ((bits_per_value + 7)/8); | |
decoded = grib_context_buffer_malloc_clear(a->context,size); | |
if(!decoded) { | |
err = GRIB_OUT_OF_MEMORY; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment