Documentation: Setting of P1 and P2 when timeRangeIndicator=10
@@ -540,6 +540,9 @@ static int pack_string(grib_accessor* a, const char* val, size_t* len)
}
if (timeRangeIndicator == 10) {
+ /*
+ * timeRangeIndicator = 10 means 'P1 occupies octets 19 and 20' i.e. 16 bits
+ */
long off = 0;
grib_accessor* p1_accessor = NULL;
if (theEnd != start && !h->context->gribex_mode_on) {
@@ -563,6 +566,7 @@ static int pack_string(grib_accessor* a, const char* val, size_t* len)
return GRIB_NOT_FOUND;
}
off = p1_accessor->offset * 8;
+ /* Note: here we assume the key P2 is one octet and immediately follows P1. Hence 16 bits */
ret = grib_encode_unsigned_long(grib_handle_of_accessor(a)->buffer->data, P1, &off, 16);
if (ret != 0)
return ret;
@@ -602,6 +606,9 @@ static int pack_string(grib_accessor* a, const char* val, size_t* len)
return GRIB_NOT_FOUND;
}
off = p1_accessor->offset * 8;
+ /* Note: case for timeRangeIndicator of 10
+ * We assume the key P2 is one octet and immediately follows P1. Hence 16 bits
+ */
ret = grib_encode_unsigned_long(grib_handle_of_accessor(a)->buffer->data, P1, &off, 16);
if (ret != 0)
return ret;
